Skip to content

Commit 31086d9

Browse files
Add standalone testmode support (game-ci#219)
* Add standalone support. * Add standalone tests. * UnityStandaloneScripts volume on windows * Update test framework in test project. * Revert IL2CPP setting in test project. Add test for IL2CPP. * Update dist/test-standalone-scripts/Assets/Player/UnityTestRunnerAction/TestRunCallback.cs Co-authored-by: Webber Takken <webber.nl@gmail.com> * Use 2019.2.21f1 * Unity is being dumb, use 2019.4.40f1 for all workflows. * Disable PlayerConnection on build. Print player log. * Add comment about code coverage support in standalone. * Update node-version in test --------- Co-authored-by: Webber Takken <webber.nl@gmail.com>
1 parent cfa9076 commit 31086d9

40 files changed

+3882
-2698
lines changed

.github/workflows/main.yml

Lines changed: 117 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v3
1717
- uses: actions/setup-node@v3
1818
with:
19-
node-version: 12.x
19+
node-version: 18.x
2020
- run: yarn
2121
- run: yarn lint
2222
- run: yarn test
@@ -32,10 +32,11 @@ jobs:
3232
projectPath:
3333
- unity-project-with-correct-tests
3434
unityVersion:
35-
- 2019.2.11f1
35+
- 2019.4.40f1
3636
testMode:
3737
- playmode
3838
- editmode
39+
- standalone
3940
steps:
4041
###########################
4142
# Checkout #
@@ -77,7 +78,7 @@ jobs:
7778
projectPath:
7879
- unity-project-with-correct-tests
7980
unityVersion:
80-
- 2019.2.11f1
81+
- 2019.4.40f1
8182
steps:
8283
###########################
8384
# Checkout #
@@ -131,7 +132,7 @@ jobs:
131132
fail-fast: false
132133
matrix:
133134
unityVersion:
134-
- 2019.2.11f1
135+
- 2019.4.40f1
135136
projectPath:
136137
- unity-project-with-correct-tests
137138
steps:
@@ -188,7 +189,7 @@ jobs:
188189
projectPath:
189190
- unity-project-with-correct-tests
190191
unityVersion:
191-
- 2019.2.11f1
192+
- 2019.4.40f1
192193
steps:
193194
###########################
194195
# Checkout #
@@ -234,14 +235,115 @@ jobs:
234235
path: ${{ steps.playMode.outputs.coveragePath }}
235236
retention-days: 14
236237

238+
testRunnerInStandalone:
239+
name: Test standalone 📺
240+
runs-on: ubuntu-latest
241+
strategy:
242+
fail-fast: false
243+
matrix:
244+
projectPath:
245+
- unity-project-with-correct-tests
246+
unityVersion:
247+
- 2019.4.40f1
248+
steps:
249+
###########################
250+
# Checkout #
251+
###########################
252+
- uses: actions/checkout@v3
253+
with:
254+
lfs: true
255+
256+
###########################
257+
# Cache #
258+
###########################
259+
- uses: actions/cache@v3
260+
with:
261+
path: ${{ matrix.projectPath }}/Library
262+
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
263+
restore-keys: |
264+
Library-${{ matrix.projectPath }}-
265+
Library-
266+
267+
# Configure test runner
268+
- name: Run tests
269+
id: standalone
270+
uses: ./
271+
with:
272+
projectPath: ${{ matrix.projectPath }}
273+
unityVersion: ${{ matrix.unityVersion }}
274+
testMode: standalone
275+
artifactsPath: artifacts/standalone
276+
277+
# Upload artifacts
278+
- name: Upload test results
279+
uses: actions/upload-artifact@v3
280+
with:
281+
name: Test results (play mode)
282+
path: ${{ steps.standalone.outputs.artifactsPath }}
283+
retention-days: 14
284+
285+
testRunnerInStandaloneWithIL2CPP:
286+
name: Test standalone with IL2CPP 📺
287+
runs-on: ubuntu-latest
288+
strategy:
289+
fail-fast: false
290+
matrix:
291+
projectPath:
292+
- unity-project-with-correct-tests
293+
unityVersion:
294+
- 2019.4.40f1 # Only 2019.4+ docker images contain the IL2CPP backend installed.
295+
steps:
296+
###########################
297+
# Checkout #
298+
###########################
299+
- uses: actions/checkout@v3
300+
with:
301+
lfs: true
302+
303+
###########################
304+
# Cache #
305+
###########################
306+
- uses: actions/cache@v3
307+
with:
308+
path: ${{ matrix.projectPath }}/Library
309+
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
310+
restore-keys: |
311+
Library-${{ matrix.projectPath }}-
312+
Library-
313+
314+
# Set scripting backend to IL2CPP
315+
- name: Rewrite ProjectSettings
316+
run: |
317+
DefineOriginal=" scriptingBackend: {}"
318+
DefineReplace=" scriptingBackend: \\n Standalone: 1"
319+
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
320+
321+
# Configure test runner
322+
- name: Run tests
323+
id: standalone
324+
uses: ./
325+
with:
326+
projectPath: ${{ matrix.projectPath }}
327+
unityVersion: ${{ matrix.unityVersion }}
328+
testMode: standalone
329+
artifactsPath: artifacts/standalone
330+
331+
# Upload artifacts
332+
- name: Upload test results
333+
uses: actions/upload-artifact@v3
334+
with:
335+
name: Test results (play mode)
336+
path: ${{ steps.standalone.outputs.artifactsPath }}
337+
retention-days: 14
338+
237339
testEachModeSequentially:
238340
name: Test each mode sequentially 👩‍👩‍👧‍👦 # don't try this at home (it's much slower)
239341
runs-on: ubuntu-latest
240342
strategy:
241343
fail-fast: false
242344
matrix:
243345
unityVersion:
244-
- 2019.2.11f1
346+
- 2019.4.40f1
245347
projectPath:
246348
- unity-project-with-correct-tests
247349
steps:
@@ -281,6 +383,15 @@ jobs:
281383
testMode: playmode
282384
artifactsPath: artifacts/playmode
283385

386+
# Configure third test runner
387+
- name: Tests in standalone 📺
388+
uses: ./
389+
with:
390+
projectPath: ${{ matrix.projectPath }}
391+
unityVersion: ${{ matrix.unityVersion }}
392+
testMode: standalone
393+
artifactsPath: artifacts/playmode
394+
284395
# Upload combined artifacts
285396
- name: Upload combined test results
286397
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)