Skip to content

Commit 0456f36

Browse files
unity-test-summary@v1.0.5 (#7)
- fix NRE during trim operations
1 parent a2ca04f commit 0456f36

File tree

9 files changed

+171
-80
lines changed

9 files changed

+171
-80
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"os": [
3+
"ubuntu-latest",
4+
"windows-latest",
5+
"macos-latest"
6+
],
7+
"unity-version": [
8+
"2021",
9+
"2022",
10+
"6000.0",
11+
"6000.1",
12+
"6000.2"
13+
],
14+
"include": [
15+
{
16+
"os": "ubuntu-latest",
17+
"build-target": "StandaloneLinux64"
18+
},
19+
{
20+
"os": "ubuntu-latest",
21+
"build-target": "WebGL",
22+
"build-args": "-colorSpace Gamma"
23+
},
24+
{
25+
"os": "ubuntu-latest",
26+
"build-target": "Android"
27+
},
28+
{
29+
"os": "windows-latest",
30+
"build-target": "StandaloneWindows64"
31+
},
32+
{
33+
"os": "windows-latest",
34+
"build-target": "Android"
35+
},
36+
{
37+
"os": "macos-latest",
38+
"build-target": "StandaloneOSX"
39+
},
40+
{
41+
"os": "macos-latest",
42+
"build-target": "iOS"
43+
}
44+
]
45+
}

.github/workflows/build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: build
2+
permissions:
3+
contents: read
4+
on:
5+
workflow_call:
6+
inputs:
7+
matrix:
8+
required: true
9+
type: string
10+
secrets:
11+
UNITY_USERNAME:
12+
required: true
13+
UNITY_PASSWORD:
14+
required: true
15+
jobs:
16+
build:
17+
name: ${{ matrix.name }}
18+
strategy:
19+
matrix: ${{ fromJSON(inputs.matrix) }}
20+
fail-fast: false
21+
runs-on: ${{ matrix.os }}
22+
permissions:
23+
contents: read
24+
steps:
25+
- name: Free Disk Space
26+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.unity-version == '6000.2' }}
27+
uses: endersonmenezes/free-disk-space@713d134e243b926eba4a5cce0cf608bfd1efb89a # v2.1.1
28+
with:
29+
remove_android: true
30+
remove_dotnet: false
31+
- uses: actions/checkout@v5 # checkout self
32+
- uses: actions/checkout@v5 # checkout async test repo
33+
with:
34+
repository: RageAgainstThePixel/com.utilities.async
35+
path: com.utilities.async
36+
- uses: RageAgainstThePixel/unity-setup@main
37+
with:
38+
unity-version: ${{ matrix.unity-version }}
39+
build-targets: ${{ matrix.build-target }}
40+
version-file: ${{ github.workspace }}/com.utilities.async/Utilities.Async/ProjectSettings/ProjectVersion.txt
41+
- uses: RageAgainstThePixel/activate-unity-license@main
42+
with:
43+
license: personal
44+
username: ${{ secrets.UNITY_USERNAME }}
45+
password: ${{ secrets.UNITY_PASSWORD }}
46+
- uses: RageAgainstThePixel/unity-action@main
47+
name: ${{ matrix.build-target }}-Validate
48+
with:
49+
log-name: ${{ matrix.build-target }}-Validate
50+
args: -quit -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
51+
- uses: RageAgainstThePixel/unity-action@main
52+
name: ${{ matrix.build-target }}-Test
53+
with:
54+
log-name: ${{ matrix.build-target }}-Test
55+
build-target: ${{ matrix.build-target }}
56+
args: -runTests -testPlatform EditMode -testResults "${{ github.workspace }}/Logs/${{ matrix.build-target }}-results.xml"
57+
- uses: actions/upload-artifact@v4
58+
if: success() || failure()
59+
with:
60+
compression-level: 0
61+
retention-days: 1
62+
name: ${{ github.run_number }}.${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.unity-version }}-${{ matrix.build-target }}-Artifacts
63+
path: |
64+
${{ github.workspace }}/**/*.log
65+
- uses: ./ # RageAgainstThePixel/unity-test-summary
66+
if: success() || failure()
67+
with:
68+
test-results: ${{ github.workspace }}/Logs/*-results.xml

.github/workflows/validate.yml

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,53 @@
11
name: validate
22
on:
3+
schedule:
4+
- cron: '0 0 * * 0' # Every Sunday at midnight
35
push:
46
branches: ['main']
57
pull_request:
6-
branches: ['**']
7-
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
8+
branches: ['*']
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
workflow_dispatch:
811
concurrency:
912
group: ${{ github.workflow }}-${{ github.ref }}
1013
cancel-in-progress: true
1114
jobs:
15+
setup:
16+
if: github.event.pull_request.draft == false
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@v5
22+
with:
23+
sparse-checkout: .github/
24+
- uses: RageAgainstThePixel/job-builder@v1
25+
id: setup-jobs
26+
with:
27+
build-options: ./.github/workflows/build-options.json
28+
group-by: 'unity-version'
29+
outputs:
30+
jobs: ${{ steps.setup-jobs.outputs.jobs }}
1231
validate:
13-
runs-on: ${{ matrix.os }}
32+
if: ${{ needs.setup.outputs.jobs }}
33+
needs: setup
34+
name: build ${{ matrix.jobs.name }}
1435
permissions:
1536
contents: read
16-
actions: write
1737
strategy:
38+
matrix: ${{ fromJSON(needs.setup.outputs.jobs) }}
1839
fail-fast: false
19-
matrix:
20-
include: # for each os specify the build targets
21-
- os: ubuntu-latest
22-
unity-version: 2022.x
23-
build-target: StandaloneLinux64
24-
- os: ubuntu-latest
25-
unity-version: 6000.x
26-
build-target: StandaloneLinux64
27-
- os: windows-latest
28-
unity-version: 2022.x
29-
build-target: StandaloneWindows64
30-
- os: windows-latest
31-
unity-version: 6000.x
32-
build-target: StandaloneWindows64
33-
- os: macos-latest
34-
unity-version: 2022.x
35-
build-target: StandaloneOSX
36-
- os: macos-latest
37-
unity-version: 6000.x
38-
build-target: StandaloneOSX
40+
max-parallel: 1
41+
secrets: inherit
42+
uses: ./.github/workflows/build.yml
43+
with:
44+
matrix: ${{ toJSON(matrix.jobs.matrix) }}
45+
timeline:
46+
needs: [setup, validate]
47+
if: always()
48+
runs-on: ubuntu-latest
49+
permissions:
50+
contents: read
3951
steps:
40-
- uses: actions/checkout@v5 # checkout self
41-
- uses: actions/checkout@v5 # checkout async test repo
42-
with:
43-
repository: RageAgainstThePixel/com.utilities.async
44-
path: com.utilities.async
45-
- uses: RageAgainstThePixel/unity-setup@main
46-
with:
47-
unity-version: ${{ matrix.unity-version }}
48-
build-targets: ${{ matrix.build-target }}
49-
version-file: ${{ github.workspace }}/com.utilities.async/Utilities.Async/ProjectSettings/ProjectVersion.txt
50-
- uses: RageAgainstThePixel/activate-unity-license@main
51-
with:
52-
license: personal
53-
username: ${{ secrets.UNITY_USERNAME }}
54-
password: ${{ secrets.UNITY_PASSWORD }}
55-
- uses: RageAgainstThePixel/unity-action@main
56-
name: ${{ matrix.build-target }}-Validate
57-
with:
58-
log-name: ${{ matrix.build-target }}-Validate
59-
args: -quit -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
60-
- uses: RageAgainstThePixel/unity-action@main
61-
name: ${{ matrix.build-target }}-Test
62-
with:
63-
log-name: ${{ matrix.build-target }}-Test
64-
build-target: ${{ matrix.build-target }}
65-
args: -runTests -testPlatform EditMode -testResults "${{ github.workspace }}/Logs/${{ matrix.build-target }}-results.xml"
66-
- uses: actions/upload-artifact@v4
67-
if: success() || failure()
68-
with:
69-
compression-level: 0
70-
retention-days: 1
71-
name: ${{ github.run_number }}.${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.unity-version }}-${{ matrix.build-target }}-Artifacts
72-
path: |
73-
${{ github.workspace }}/**/*.log
74-
- uses: ./ # RageAgainstThePixel/unity-test-summary
75-
if: success() || failure()
76-
with:
77-
test-results: ${{ github.workspace }}/Logs/*-results.xml
52+
- uses: Kesin11/actions-timeline@c2f474758e8e9ac6f37ec64a6442dead7fd1dad2 # v2.2.5
53+
continue-on-error: true

dist/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30318,13 +30318,14 @@ function parseUtp(output) {
3031830318
return objs;
3031930319
}
3032030320
function parseLogs(output) {
30321+
var _a;
3032130322
const logs = [];
3032230323
const lines = output.split('\n');
3032330324
for (let line of lines) {
3032430325
if (line.match(/##utp:/)) {
3032530326
continue;
3032630327
}
30327-
line = line.replace(/\\u001b\[[0-9]*m/g, '').trim();
30328+
line = (_a = line.replace(/\\u001b\[[0-9]*m/g, '')) === null || _a === void 0 ? void 0 : _a.trim();
3032830329
if (line === '' || line.startsWith('Saving results to:')) {
3032930330
continue;
3033030331
}
@@ -32381,18 +32382,19 @@ function getTestSuiteDetails(testSuite) {
3238132382
return details;
3238232383
}
3238332384
function getTestCaseDetails(testCase) {
32385+
var _a, _b;
3238432386
const testCaseFullName = testCase['fullname'];
3238532387
const testCaseResult = testCase['result'];
3238632388
const testCaseResultIcon = testCaseResult === 'Passed' ? '✅' : '❌';
3238732389
const failure = testCase['failure'];
3238832390
let details = `\n\n`;
3238932391
if (failure) {
3239032392
details += `\`\`\`error\n`;
32391-
const failureMessage = failure['message'].trim();
32393+
const failureMessage = (_a = failure['message']) === null || _a === void 0 ? void 0 : _a.trim();
3239232394
if (failureMessage && failureMessage !== '') {
3239332395
details += `${failure['message']}\n`;
3239432396
}
32395-
const stackTrace = failure['stack-trace'].trim();
32397+
const stackTrace = (_b = failure['stack-trace']) === null || _b === void 0 ? void 0 : _b.trim();
3239632398
if (stackTrace && stackTrace !== '') {
3239732399
details += `${stackTrace}\n`;
3239832400
}

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unity-test-summary",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "A GitHub action to gather and display Unit Tests from the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",
@@ -34,4 +34,4 @@
3434
"clean": "npm install && shx rm -rf dist/ out/ node_modules/ && npm ci",
3535
"test": "jest"
3636
}
37-
}
37+
}

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ function getTestCaseDetails(testCase: any): string {
144144
let details = `\n\n`;
145145
if (failure) {
146146
details += `\`\`\`error\n`;
147-
const failureMessage = (failure['message'] as string).trim();
147+
const failureMessage = (failure['message'] as string)?.trim();
148148
if (failureMessage && failureMessage !== '') {
149149
details += `${failure['message']}\n`;
150150
}
151-
const stackTrace = (failure['stack-trace'] as string).trim();
151+
const stackTrace = (failure['stack-trace'] as string)?.trim();
152152
if (stackTrace && stackTrace !== '') {
153153
details += `${stackTrace}\n`;
154154
}

src/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export function parseLogs(output: string): any[] {
4343
if (line.match(/##utp:/)) {
4444
continue;
4545
}
46-
line = line.replace(/\\u001b\[[0-9]*m/g, '').trim();
47-
if (line === '' || line.startsWith('Saving results to:')) {
46+
line = line.replace(/\\u001b\[[0-9]*m/g, '')?.trim();
47+
if (!line || line === '' || line.startsWith('Saving results to:')) {
4848
continue;
4949
}
5050
logs.push(line);

0 commit comments

Comments
 (0)