Skip to content

Commit d083007

Browse files
committed
test: update test workflow
1 parent 934ff6f commit d083007

File tree

1 file changed

+79
-56
lines changed

1 file changed

+79
-56
lines changed

.github/workflows/unity-test.yml

Lines changed: 79 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,88 +12,111 @@ on:
1212
types:
1313
- opened
1414
- synchronize
15+
schedule:
16+
- cron: "0 0 * * 0" # weekly
17+
workflow_dispatch:
1518

1619
jobs:
17-
unity-test:
20+
setup:
1821
runs-on: ubuntu-latest
22+
outputs:
23+
versions: ${{ steps.setup.outputs.versions }}
24+
steps:
25+
- id: setup
26+
run: echo "::set-output name=versions::`npx unity-changeset list --versions --all --latest-patch --min 2018.4 --json`"
27+
28+
test:
29+
runs-on: ubuntu-latest
30+
needs: setup
1931
strategy:
32+
max-parallel: 4
2033
fail-fast: false
2134
matrix:
22-
unityVersion: [
23-
2018.4.30f1,
24-
2019.4.16f1,
25-
# 2020.1.16f1,
26-
2020.2.0f1,
27-
]
28-
env:
29-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
35+
version: ${{ fromJson(needs.setup.outputs.versions) }}
3036

3137
steps:
32-
- run: echo "$GITHUB_CONTEXT"
33-
env:
34-
GITHUB_CONTEXT: ${{ toJson(github) }}
35-
3638
# Checkout sandbox project
3739
- uses: actions/checkout@v2
3840
with:
39-
ref: "sandbox"
40-
submodules: "true"
41-
fetch-depth: "0"
41+
ref: sandbox
42+
submodules: true
43+
fetch-depth: 0
4244

4345
# Update package submodule
4446
- name: "Update package submodule"
4547
working-directory: Packages/dev
4648
run: git checkout ${{ github.sha }}
4749

48-
- uses: actions/cache@v2
49-
with:
50-
path: Library
51-
key: Library-${{ matrix.unityVersion }}-${{ github.sha }}
52-
restore-keys: |
53-
Library-${{ matrix.unityVersion }}-
54-
Library-
55-
56-
# Install codecoverage package
57-
- name: "Install codecoverage package"
58-
if: startsWith(matrix.unityVersion, '2019.4.')
50+
- name: "Setup"
51+
id: setup
5952
run: |
60-
npx openupm-cli add -f [email protected]
53+
# Remove CSC_SETTINGS_DEVELOP symbol
54+
sed -i -e 's/CSC_SETTINGS_DEVELOP//' ProjectSettings/ProjectSettings.asset
55+
56+
# IL2CPP Support
57+
echo '${{ matrix.version }}' | grep -q '\(2018\|2019.1\|2019.2\|2019.3\|2020.1\)' \
58+
&& echo "module=" >> $GITHUB_ENV | tee \
59+
|| echo "module=-linux-il2cpp" >> $GITHUB_ENV | tee
60+
61+
# Cache
62+
# - uses: actions/cache@v2
63+
# with:
64+
# path: Library
65+
# key: Library-${{ matrix.version }}-${{ github.sha }}
66+
# restore-keys: |
67+
# Library-${{ matrix.version }}-
68+
# Library-
6169

6270
# Run tests
63-
- name: "Run tests"
71+
- name: Run tests
6472
uses: game-ci/unity-test-runner@main
6573
with:
66-
unityVersion: ${{ matrix.unityVersion }}
67-
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
68-
customParameters: -enableCodeCoverage -coverageOptions assemblyFilters:+CSharpCompilerSettings_,-*-CSharp,-*.Tests,-IgnoreAccessibility
74+
customImage: mobsakai/unity3d:${{ matrix.version }}${{ env.module }}
75+
customParameters: -nographics
76+
testMode: playmode
77+
checkName: ${{ matrix.version }} Test Results
78+
githubToken: ${{ github.token }}
79+
env:
80+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
6981

70-
- uses: actions/upload-artifact@v2
71-
if: always()
82+
# Build (Mono)
83+
- name: Build (Mono)
84+
uses: game-ci/unity-builder@main
7285
with:
73-
name: TestResults-${{ matrix.unityVersion }}
74-
path: |
75-
artifacts/*.xml
76-
CodeCoverage/**/TestCoverageResults_*.xml
86+
customImage: mobsakai/unity3d:${{ matrix.version }}${{ env.module }}
87+
customParameters: -nographics /Headless /ScriptBackend Mono2x /BuildTarget StandaloneLinux64
88+
targetPlatform: StandaloneLinux64
89+
buildMethod: UnitTestBuilder.BuildUnitTest
90+
allowDirtyBuild: true
91+
versioning: Custom
92+
version: 1.0.0
93+
env:
94+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
7795

78-
publish:
79-
needs: unity-test
80-
runs-on: ubuntu-latest
81-
if: always()
82-
steps:
83-
84-
- uses: actions/download-artifact@v2
85-
with:
86-
path: artifacts
87-
88-
- run: |
89-
ls -R
90-
working-directory: artifacts
96+
# Execute unit test player (Mono)
97+
- name: "Execute unit test player (Mono)"
98+
run: |
99+
tree ./bin
100+
./bin/UnitTest/StandaloneLinux64_Mono2x/test
91101
92-
- uses: testspace-com/setup-testspace@v1
102+
# Build (IL2CPP)
103+
- name: Build (IL2CPP)
104+
uses: game-ci/unity-builder@main
105+
if: env.module == '-linux-il2cpp'
93106
with:
94-
domain: ${{github.repository_owner}}
107+
customImage: mobsakai/unity3d:${{ matrix.version }}${{ env.module }}
108+
customParameters: -nographics /Headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64
109+
targetPlatform: StandaloneLinux64
110+
buildMethod: UnitTestBuilder.BuildUnitTest
111+
allowDirtyBuild: true
112+
versioning: Custom
113+
version: 1.0.0
114+
env:
115+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
95116

96-
- name: Push test results
97-
if: always()
117+
# Execute unit test player (IL2CPP)
118+
- name: "Execute unit test player (IL2CPP)"
119+
if: env.module == '-linux-il2cpp'
98120
run: |
99-
testspace `find . -name '*.xml' | tr '\n' ' '`
121+
tree ./bin
122+
./bin/UnitTest/StandaloneLinux64_IL2CPP/test

0 commit comments

Comments
 (0)