Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/build-options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"os": [
"ubuntu-latest",
"windows-latest",
"macos-latest"
],
"unity-version": [
"2021",
"2022",
"6000.0",
"6000.1",
"6000.2"
],
"include": [
{
"os": "ubuntu-latest",
"build-target": "StandaloneLinux64"
},
{
"os": "ubuntu-latest",
"build-target": "WebGL",
"build-args": "-colorSpace Gamma"
},
{
"os": "ubuntu-latest",
"build-target": "Android"
},
{
"os": "windows-latest",
"build-target": "StandaloneWindows64"
},
{
"os": "windows-latest",
"build-target": "Android"
},
{
"os": "macos-latest",
"build-target": "StandaloneOSX"
},
{
"os": "macos-latest",
"build-target": "iOS"
}
]
}
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: build
permissions:
contents: read
on:
workflow_call:
inputs:
matrix:
required: true
type: string
secrets:
UNITY_USERNAME:
required: true
UNITY_PASSWORD:
required: true
jobs:
build:
name: ${{ matrix.name }}
strategy:
matrix: ${{ fromJSON(inputs.matrix) }}
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Free Disk Space
if: ${{ matrix.os == 'ubuntu-latest' && matrix.unity-version == '6000.2' }}
uses: endersonmenezes/free-disk-space@713d134e243b926eba4a5cce0cf608bfd1efb89a # v2.1.1
with:
remove_android: true
remove_dotnet: false
- uses: actions/checkout@v5 # checkout self
- uses: actions/checkout@v5 # checkout async test repo
with:
repository: RageAgainstThePixel/com.utilities.async
path: com.utilities.async
- uses: RageAgainstThePixel/unity-setup@main
with:
unity-version: ${{ matrix.unity-version }}
build-targets: ${{ matrix.build-target }}
version-file: ${{ github.workspace }}/com.utilities.async/Utilities.Async/ProjectSettings/ProjectVersion.txt
- uses: RageAgainstThePixel/activate-unity-license@main
with:
license: personal
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
- uses: RageAgainstThePixel/unity-action@main
name: ${{ matrix.build-target }}-Validate
with:
log-name: ${{ matrix.build-target }}-Validate
args: -quit -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
- uses: RageAgainstThePixel/unity-action@main
name: ${{ matrix.build-target }}-Test
with:
log-name: ${{ matrix.build-target }}-Test
build-target: ${{ matrix.build-target }}
args: -runTests -testPlatform EditMode -testResults "${{ github.workspace }}/Logs/${{ matrix.build-target }}-results.xml"
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
compression-level: 0
retention-days: 1
name: ${{ github.run_number }}.${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.unity-version }}-${{ matrix.build-target }}-Artifacts
path: |
${{ github.workspace }}/**/*.log
- uses: ./ # RageAgainstThePixel/unity-test-summary
if: success() || failure()
with:
test-results: ${{ github.workspace }}/Logs/*-results.xml
100 changes: 38 additions & 62 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,53 @@
name: validate
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight
push:
branches: ['main']
pull_request:
branches: ['**']
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
branches: ['*']
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: .github/
- uses: RageAgainstThePixel/job-builder@v1
id: setup-jobs
with:
build-options: ./.github/workflows/build-options.json
group-by: 'unity-version'
outputs:
jobs: ${{ steps.setup-jobs.outputs.jobs }}
validate:
runs-on: ${{ matrix.os }}
if: ${{ needs.setup.outputs.jobs }}
needs: setup
name: build ${{ matrix.jobs.name }}
permissions:
contents: read
actions: write
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.jobs) }}
fail-fast: false
matrix:
include: # for each os specify the build targets
- os: ubuntu-latest
unity-version: 2022.x
build-target: StandaloneLinux64
- os: ubuntu-latest
unity-version: 6000.x
build-target: StandaloneLinux64
- os: windows-latest
unity-version: 2022.x
build-target: StandaloneWindows64
- os: windows-latest
unity-version: 6000.x
build-target: StandaloneWindows64
- os: macos-latest
unity-version: 2022.x
build-target: StandaloneOSX
- os: macos-latest
unity-version: 6000.x
build-target: StandaloneOSX
max-parallel: 1
secrets: inherit
uses: ./.github/workflows/build.yml
with:
matrix: ${{ toJSON(matrix.jobs.matrix) }}
timeline:
needs: [setup, validate]
if: always()
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5 # checkout self
- uses: actions/checkout@v5 # checkout async test repo
with:
repository: RageAgainstThePixel/com.utilities.async
path: com.utilities.async
- uses: RageAgainstThePixel/unity-setup@main
with:
unity-version: ${{ matrix.unity-version }}
build-targets: ${{ matrix.build-target }}
version-file: ${{ github.workspace }}/com.utilities.async/Utilities.Async/ProjectSettings/ProjectVersion.txt
- uses: RageAgainstThePixel/activate-unity-license@main
with:
license: personal
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
- uses: RageAgainstThePixel/unity-action@main
name: ${{ matrix.build-target }}-Validate
with:
log-name: ${{ matrix.build-target }}-Validate
args: -quit -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
- uses: RageAgainstThePixel/unity-action@main
name: ${{ matrix.build-target }}-Test
with:
log-name: ${{ matrix.build-target }}-Test
build-target: ${{ matrix.build-target }}
args: -runTests -testPlatform EditMode -testResults "${{ github.workspace }}/Logs/${{ matrix.build-target }}-results.xml"
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
compression-level: 0
retention-days: 1
name: ${{ github.run_number }}.${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.unity-version }}-${{ matrix.build-target }}-Artifacts
path: |
${{ github.workspace }}/**/*.log
- uses: ./ # RageAgainstThePixel/unity-test-summary
if: success() || failure()
with:
test-results: ${{ github.workspace }}/Logs/*-results.xml
- uses: Kesin11/actions-timeline@c2f474758e8e9ac6f37ec64a6442dead7fd1dad2 # v2.2.5
continue-on-error: true
8 changes: 5 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30318,13 +30318,14 @@ function parseUtp(output) {
return objs;
}
function parseLogs(output) {
var _a;
const logs = [];
const lines = output.split('\n');
for (let line of lines) {
if (line.match(/##utp:/)) {
continue;
}
line = line.replace(/\\u001b\[[0-9]*m/g, '').trim();
line = (_a = line.replace(/\\u001b\[[0-9]*m/g, '')) === null || _a === void 0 ? void 0 : _a.trim();
if (line === '' || line.startsWith('Saving results to:')) {
continue;
}
Expand Down Expand Up @@ -32381,18 +32382,19 @@ function getTestSuiteDetails(testSuite) {
return details;
}
function getTestCaseDetails(testCase) {
var _a, _b;
const testCaseFullName = testCase['fullname'];
const testCaseResult = testCase['result'];
const testCaseResultIcon = testCaseResult === 'Passed' ? '✅' : '❌';
const failure = testCase['failure'];
let details = `\n\n`;
if (failure) {
details += `\`\`\`error\n`;
const failureMessage = failure['message'].trim();
const failureMessage = (_a = failure['message']) === null || _a === void 0 ? void 0 : _a.trim();
if (failureMessage && failureMessage !== '') {
details += `${failure['message']}\n`;
}
const stackTrace = failure['stack-trace'].trim();
const stackTrace = (_b = failure['stack-trace']) === null || _b === void 0 ? void 0 : _b.trim();
if (stackTrace && stackTrace !== '') {
details += `${stackTrace}\n`;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-test-summary",
"version": "1.0.4",
"version": "1.0.5",
"description": "A GitHub action to gather and display Unit Tests from the Unity Game Engine.",
"author": "RageAgainstThePixel",
"license": "MIT",
Expand Down Expand Up @@ -34,4 +34,4 @@
"clean": "npm install && shx rm -rf dist/ out/ node_modules/ && npm ci",
"test": "jest"
}
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ function getTestCaseDetails(testCase: any): string {
let details = `\n\n`;
if (failure) {
details += `\`\`\`error\n`;
const failureMessage = (failure['message'] as string).trim();
const failureMessage = (failure['message'] as string)?.trim();
if (failureMessage && failureMessage !== '') {
details += `${failure['message']}\n`;
}
const stackTrace = (failure['stack-trace'] as string).trim();
const stackTrace = (failure['stack-trace'] as string)?.trim();
if (stackTrace && stackTrace !== '') {
details += `${stackTrace}\n`;
}
Expand Down
4 changes: 2 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export function parseLogs(output: string): any[] {
if (line.match(/##utp:/)) {
continue;
}
line = line.replace(/\\u001b\[[0-9]*m/g, '').trim();
if (line === '' || line.startsWith('Saving results to:')) {
line = line.replace(/\\u001b\[[0-9]*m/g, '')?.trim();
if (!line || line === '' || line.startsWith('Saving results to:')) {
continue;
}
logs.push(line);
Expand Down