-
-
Notifications
You must be signed in to change notification settings - Fork 137
623 lines (569 loc) Β· 21 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
name: Actions π
on:
push:
env:
UNITY_LICENSE: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg==\"/>\n <SerialMasked Value=\"F4-BGRX-XD4E-ZCWV-C5JW-XXXX\"/>\n <StartDate Value=\"2021-02-08T00:00:00\"/>\n <UpdateDate Value=\"2021-02-09T00:34:57\"/>\n <InitialActivationDate Value=\"2021-02-08T00:34:56\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2018.4.30f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>"
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn
- run: yarn lint
- run: yarn test
- run: yarn build || { echo "build command should always succeed" ; exit 61; }
# - run: yarn build --quiet && git diff --quiet action || { echo "ERROR - index.js is different from repository version. Forgot to run `yarn build`?" ; exit 62; }
testAllModesLikeInTheReadme:
name: Test in ${{ matrix.testMode }} on version ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2022.3.7f1
testMode:
- playmode
- editmode
- standalone
steps:
###########################
# Checkout #
###########################
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}
restore-keys: |
Library-
- uses: ./
id: tests
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: ${{ matrix.testMode }}
artifactsPath: ${{ matrix.testMode }}-artifacts
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
- uses: actions/upload-artifact@v3
with:
name: Test results for ${{ matrix.testMode }}
path: ${{ steps.tests.outputs.artifactsPath }}
retention-days: 14
testRunnerInAllModes:
name: Test all modes β¨
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2022.3.7f1
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner
- name: Run tests
id: allTests
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: all
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+MyScripts;dontClear'
# Test implicit artifactsPath, by not setting it
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test results (all)
path: ${{ steps.allTests.outputs.artifactsPath }}
retention-days: 14
# Upload coverage
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: Coverage results (all)
path: ${{ steps.allTests.outputs.coveragePath }}
retention-days: 14
testRunnerInEditMode:
name: Test edit mode π
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2022.3.7f1
projectPath:
- unity-project-with-correct-tests
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner
- name: Run tests
id: editMode
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: editmode
artifactsPath: artifacts/editmode
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test results (edit mode)
path: ${{ steps.editMode.outputs.artifactsPath }}
retention-days: 14
# Upload coverage
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: Coverage results (edit mode)
path: ${{ steps.editMode.outputs.coveragePath }}
retention-days: 14
testRunnerInPlayMode:
name: Test play mode πΊ
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2022.3.7f1
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner
- name: Run tests
id: playMode
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: playmode
artifactsPath: artifacts/playmode
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test results (play mode)
path: ${{ steps.playMode.outputs.artifactsPath }}
retention-days: 14
# Upload coverage
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: Coverage results (play mode)
path: ${{ steps.playMode.outputs.coveragePath }}
retention-days: 14
testRunnerInStandalone:
name: Test standalone πΊ
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2022.3.7f1
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner
- name: Run tests
id: standalone
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: standalone
artifactsPath: artifacts/standalone
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test results (play mode)
path: ${{ steps.standalone.outputs.artifactsPath }}
retention-days: 14
testRunnerInStandaloneWithIL2CPP:
name: Test standalone with IL2CPP πΊ
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2022.3.7f1 # Only 2019.4+ docker images contain the IL2CPP backend installed.
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Set scripting backend to IL2CPP
- name: Rewrite ProjectSettings
run: |
DefineOriginal=" scriptingBackend: {}"
DefineReplace=" scriptingBackend: \\n Standalone: 1"
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
# Configure test runner
- name: Run tests
id: standalone
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: standalone
artifactsPath: artifacts/standalone
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test results (play mode)
path: ${{ steps.standalone.outputs.artifactsPath }}
retention-days: 14
testEachModeSequentially:
name: Test each mode sequentially π©βπ©βπ§βπ¦ # don't try this at home (it's much slower)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2022.3.7f1
projectPath:
- unity-project-with-correct-tests
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
###########################
# Cache #
###########################
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure first test runner
- name: Tests in editmode π
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: editmode
artifactsPath: artifacts/editmode
# Configure second test runner
- name: Tests in playmode πΊ
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: playmode
artifactsPath: artifacts/playmode
# Configure third test runner
- name: Tests in standalone πΊ
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: standalone
artifactsPath: artifacts/playmode
# Upload combined artifacts
- name: Upload combined test results
uses: actions/upload-artifact@v3
with:
name: Test results (combined)
path: artifacts/
retention-days: 14
testAllPackageModesLikeInTheReadme:
name: Test package mode π¦ in ${{ matrix.testMode }} on version ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
unityVersion:
- 2022.3.7f1
testMode:
- playmode
- editmode
steps:
###########################
# Checkout #
###########################
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- uses: ./
id: packageTests
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: ${{ matrix.testMode }}
artifactsPath: ${{ matrix.testMode }}-packageArtifacts
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
packageMode: true
- uses: actions/upload-artifact@v3
with:
name: Package test results for ${{ matrix.testMode }}
path: ${{ steps.packageTests.outputs.artifactsPath }}
retention-days: 14
testPackageRunnerInAllModes:
name: Test package mode in all modes π¦β¨
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
unityVersion:
- 2022.3.7f1
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
# Configure test runner
- name: Run tests
id: packageAllTests
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: all
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+example.testpackage.*,-*Tests*'
packageMode: true
# Test implicit artifactsPath, by not setting it
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Package test results (all)
path: ${{ steps.packageAllTests.outputs.artifactsPath }}
retention-days: 14
# Upload coverage
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: Package Coverage results (all)
path: ${{ steps.packageAllTests.outputs.coveragePath }}
retention-days: 14
testPackageRunnerInEditMode:
name: Test package mode in edit mode π¦π
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2022.3.7f1
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
# Configure test runner
- name: Run tests
id: packageEditMode
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: editmode
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+example.testpackage.*,-*Tests*'
artifactsPath: artifacts/packageeditmode
packageMode: true
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Package test results (edit mode)
path: ${{ steps.packageEditMode.outputs.artifactsPath }}
retention-days: 14
# Upload coverage
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: Package Coverage results (edit mode)
path: ${{ steps.packageEditMode.outputs.coveragePath }}
retention-days: 14
testPackageRunnerInPlayMode:
name: Test package mode in play mode π¦πΊ
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
unityVersion:
- 2022.3.7f1
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
# Configure test runner
- name: Run tests
id: packagePlayMode
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: playmode
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+example.testpackage.*,-*Tests*'
artifactsPath: artifacts/packageplaymode
packageMode: true
# Upload artifacts
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Package test results (play mode)
path: ${{ steps.packagePlayMode.outputs.artifactsPath }}
retention-days: 14
# Upload coverage
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: Package Coverage results (play mode)
path: ${{ steps.packagePlayMode.outputs.coveragePath }}
retention-days: 14
testPackageModeEachModeSequentially:
name: Test package mode in each mode sequentially π¦ π©βπ©βπ§βπ¦ # don't try this at home (it's much slower)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2022.3.7f1
projectPath:
- unity-package-with-correct-tests/com.example.testpackage
steps:
###########################
# Checkout #
###########################
- uses: actions/checkout@v4
with:
lfs: true
# Configure first test runner
- name: Test package mode in editmode π¦π
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: editmode
artifactsPath: packageArtifacts/editmode
packageMode: true
# Configure second test runner
- name: Test package mode in playmode π¦πΊ
uses: ./
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: playmode
artifactsPath: packageArtifacts/playmode
packageMode: true
# Upload combined artifacts
- name: Upload combined test results
uses: actions/upload-artifact@v3
with:
name: Package test results (combined)
path: packageArtifacts/
retention-days: 14