-
Notifications
You must be signed in to change notification settings - Fork 7
632 lines (631 loc) · 29.7 KB
/
run-tests-and-package.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
624
625
626
627
628
629
630
631
632
name: Run Tests and Package SDK
run-name: Run Tests and Package SDK on commit ${{ github.sha }}
on:
pull_request:
branches: # Made towards the following
- main
- dev*
types: # Only on the following activity
- opened
- synchronize # Changes to the branch like new commits, ammends, etc.
push:
branches: # Made towards the following
- main
- ci/*
tags:
- v**
workflow_dispatch:
inputs:
LL_URL:
description: Use a custom url for tests
type: string
jobs:
editor-smoke-test:
name: Test SDK in Editor
runs-on: [ubuntu-latest]
#runs-on: [k8s]
#container:
# image: ubuntu-latest
needs: []
timeout-minutes: 10
env:
LL_USE_STAGE: false
strategy:
fail-fast: false
matrix:
testMode:
- playmode
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
steps:
- name: Setup commandline dependencies (if on self-hosted runner)
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
apt update
apt-get install -y git
git config --global --add safe.directory unity-sdk
git config --global --add safe.directory unity-sdk-smoketest-project
apt-get install -y jq
apt-get install -y sed
apt-get install -y docker
apt-get install -y curl
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Select stage keys
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
echo "JOB_API_KEY=${{ SECRETS.SMOKE_TEST_LL_API_KEY }}" >> $GITHUB_ENV
echo "JOB_DOMAIN_KEY=${{ SECRETS.SMOKE_TEST_LL_DOMAIN_KEY }}" >> $GITHUB_ENV
- name: Select prod keys
if: ${{ env.LL_USE_STAGE == 'false' }}
run: |
echo "JOB_API_KEY=${{ SECRETS.LOOTLOCKER_API_KEY }}" >> $GITHUB_ENV
echo "JOB_DOMAIN_KEY=${{ SECRETS.LOOTLOCKER_DOMAIN_KEY }}" >> $GITHUB_ENV
- name: Checkout unity-sdk repository
uses: actions/checkout@v4
with:
path: unity-sdk
- name: Checkout unity-sdk-smoketest-project repository
uses: actions/checkout@v4
with:
repository: lootlocker/unity-sdk-smoketest-project
path: unity-sdk-smoketest-project
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
- name: Set package reference to local unity-sdk
run: |
echo "Updating unity-sdk-smoketest-project/Packages/manifest.json to use lootlocker sdk at relative path (from manifest) ../../unity-sdk"
jq ".\"dependencies\".\"com.lootlocker.lootlockersdk\"=\"file:../../unity-sdk\"" "unity-sdk-smoketest-project/Packages/manifest.json" > "unity-sdk-smoketest-project/Packages/tempmanifest.json"
rm "unity-sdk-smoketest-project/Packages/manifest.json"
mv "unity-sdk-smoketest-project/Packages/tempmanifest.json" "unity-sdk-smoketest-project/Packages/manifest.json"
- name: Configure LootLocker to take keys by commandline
run: |
sed -i 's/NO_LOOTLOCKER_COMMANDLINE_SETTINGS/LOOTLOCKER_COMMANDLINE_SETTINGS/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
- name: Configure LootLocker to target stage environment
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
- uses: actions/cache@v4
with:
path: unity-sdk-smoketest-project/Library
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
restore-keys: |
${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
Library-
- name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }}
id: editor-smoke-tests-gameci
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
with:
testMode: ${{ matrix.testMode }}
checkName: ${{ matrix.unityVersion }}-${{ matrix.testMode }} Test Results
artifactsPath: editor-smoke-tests-gameci-${{ matrix.unityVersion }}-${{ matrix.testMode }}-artifacts
projectPath: unity-sdk-smoketest-project
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
linux-build-smoke-test:
name: Test SDK in StandaloneLinux64 build
runs-on: [ubuntu-latest]
#runs-on: [k8s]
#container:
# image: ubuntu-latest
needs: []
timeout-minutes: 10
env:
LL_USE_STAGE: false
strategy:
fail-fast: false
matrix:
testMode:
- playmode
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
targetPlatform:
- StandaloneLinux64
steps:
- name: Setup commandline dependencies (if on self-hosted runner)
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
apt update
apt-get install -y git
git config --global --add safe.directory unity-sdk
git config --global --add safe.directory unity-sdk-smoketest-project
apt-get install -y jq
apt-get install -y sed
apt-get install -y docker
apt-get install -y curl
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Select stage keys
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
echo "JOB_API_KEY=${{ SECRETS.SMOKE_TEST_LL_API_KEY }}" >> $GITHUB_ENV
echo "JOB_DOMAIN_KEY=${{ SECRETS.SMOKE_TEST_LL_DOMAIN_KEY }}" >> $GITHUB_ENV
- name: Select prod keys
if: ${{ env.LL_USE_STAGE == 'false' }}
run: |
echo "JOB_API_KEY=${{ SECRETS.LOOTLOCKER_API_KEY }}" >> $GITHUB_ENV
echo "JOB_DOMAIN_KEY=${{ SECRETS.LOOTLOCKER_DOMAIN_KEY }}" >> $GITHUB_ENV
- name: Checkout unity-sdk repository
uses: actions/checkout@v4
with:
path: unity-sdk
- name: Checkout unity-sdk-smoketest-project repository
uses: actions/checkout@v4
with:
repository: lootlocker/unity-sdk-smoketest-project
path: unity-sdk-smoketest-project
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
- name: Set package reference to local unity-sdk
run: |
echo "Updating unity-sdk-smoketest-project/Packages/manifest.json to use lootlocker sdk at relative path (from manifest) ../../unity-sdk"
jq ".\"dependencies\".\"com.lootlocker.lootlockersdk\"=\"file:../../unity-sdk\"" "unity-sdk-smoketest-project/Packages/manifest.json" > "unity-sdk-smoketest-project/Packages/tempmanifest.json"
rm "unity-sdk-smoketest-project/Packages/manifest.json"
mv "unity-sdk-smoketest-project/Packages/tempmanifest.json" "unity-sdk-smoketest-project/Packages/manifest.json"
- name: Configure LootLocker to take keys by commandline
run: |
sed -i 's/NO_LOOTLOCKER_COMMANDLINE_SETTINGS/LOOTLOCKER_COMMANDLINE_SETTINGS/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
- name: Configure LootLocker to target stage environment
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
- name: Commit all changes to allow building
run: |
git config --global user.email "[email protected]"
git config --global user.name "Fake Name"
cd unity-sdk-smoketest-project
git add -A
git commit -m "Temporary changes for build"
- uses: actions/cache@v4
with:
path: unity-sdk-smoketest-project/Library
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
restore-keys: |
${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
Library-
- name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }}
id: build-smoke-tests-gameci
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
with:
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
buildsPath: builds
buildName: smokeTest
projectPath: unity-sdk-smoketest-project
customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
- name: Run the built game
run: |
sudo chmod 777 ./builds
sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/
sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/*
./builds/${{ matrix.targetPlatform }}/smokeTest -batchmode -nographics -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
while [ ! -f "./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt" ]; do sleep 10; ls -als ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/; done
- name: Test the output of the run
run: |
cat ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt
grep -q "Run Succeeded" ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt
exit $?
webgl-build-smoke-test:
name: Test SDK in WebGL build
runs-on: [ubuntu-latest]
#runs-on: [k8s]
#container:
# image: ubuntu-latest
needs: []
timeout-minutes: 20
if: (startsWith(github.ref, 'refs/pull') && endsWith(github.base_ref, 'main')) || startsWith(github.ref, 'refs/tags/v') || (startsWith(github.ref, 'refs/heads') && endsWith(github.ref, 'main'))
env:
LL_USE_STAGE: false
strategy:
fail-fast: false
matrix:
testMode:
- playmode
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
targetPlatform:
- WebGL
steps:
- name: Setup commandline dependencies (if on self-hosted runner)
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
apt update
apt-get install -y git
git config --global --add safe.directory unity-sdk
git config --global --add safe.directory unity-sdk-smoketest-project
apt-get install -y jq
apt-get install -y sed
apt-get install -y docker
apt-get install -y curl
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Select stage keys
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
echo "JOB_API_KEY=${{ SECRETS.SMOKE_TEST_LL_API_KEY }}" >> $GITHUB_ENV
echo "JOB_DOMAIN_KEY=${{ SECRETS.SMOKE_TEST_LL_DOMAIN_KEY }}" >> $GITHUB_ENV
- name: Select prod keys
if: ${{ env.LL_USE_STAGE == 'false' }}
run: |
echo "JOB_API_KEY=${{ SECRETS.LOOTLOCKER_API_KEY }}" >> $GITHUB_ENV
echo "JOB_DOMAIN_KEY=${{ SECRETS.LOOTLOCKER_DOMAIN_KEY }}" >> $GITHUB_ENV
- name: Checkout unity-sdk repository
uses: actions/checkout@v4
with:
path: unity-sdk
- name: Checkout unity-sdk-smoketest-project repository
uses: actions/checkout@v4
with:
repository: lootlocker/unity-sdk-smoketest-project
path: unity-sdk-smoketest-project
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
- name: Set package reference to local unity-sdk
run: |
echo "Updating unity-sdk-smoketest-project/Packages/manifest.json to use lootlocker sdk at relative path (from manifest) ../../unity-sdk"
jq ".\"dependencies\".\"com.lootlocker.lootlockersdk\"=\"file:../../unity-sdk\"" "unity-sdk-smoketest-project/Packages/manifest.json" > "unity-sdk-smoketest-project/Packages/tempmanifest.json"
rm "unity-sdk-smoketest-project/Packages/manifest.json"
mv "unity-sdk-smoketest-project/Packages/tempmanifest.json" "unity-sdk-smoketest-project/Packages/manifest.json"
- name: Configure LootLocker to take keys by commandline
run: |
sed -i 's/NO_LOOTLOCKER_COMMANDLINE_SETTINGS/LOOTLOCKER_COMMANDLINE_SETTINGS/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
- name: Configure LootLocker to target stage environment
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
- name: Commit all changes to allow building
run: |
git config --global user.email "[email protected]"
git config --global user.name "Fake Name"
cd unity-sdk-smoketest-project
git add -A
git commit -m "Temporary changes for build"
- uses: actions/cache@v4
with:
path: unity-sdk-smoketest-project/Library
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
restore-keys: |
${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
Library-
- name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }}
id: build-smoke-tests-gameci
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
with:
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
buildsPath: builds
buildName: smokeTest
projectPath: unity-sdk-smoketest-project
customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
run-integration-tests:
name: Run the integration tests
runs-on: ubuntu-latest
if: ${{ vars.ENABLE_INTEGRATION_TESTS == 'true' }}
needs: [editor-smoke-test, linux-build-smoke-test]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
testMode:
- playmode
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
jsonLibrary:
- zerodep
- newtonsoft
steps:
- name: Configure variables
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then echo "LOOTLOCKER_URL=${{ INPUTS.LL_URL }}" | sed -e 's/https:\/\///g' >> $GITHUB_ENV; elif [ ${{ vars.LL_USE_STAGE }} == 'true' ]; then echo "LOOTLOCKER_URL=${{ SECRETS.LOOTLOCKER_API_STAGE_URL }}" | sed -e 's/https:\/\///g' >> $GITHUB_ENV; else echo "LOOTLOCKER_URL=${{ SECRETS.LOOTLOCKER_API_PRODUCTION_URL }}" | sed -e 's/https:\/\///g' >> $GITHUB_ENV; fi
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then echo "TARGET_ENVIRONMENT=CUSTOM" >> $GITHUB_ENV; echo "USE_TAILSCALE=true" >> $GITHUB_ENV; elif [ ${{ vars.LL_USE_STAGE }} == 'true' ]; then echo "TARGET_ENVIRONMENT=STAGE" >> $GITHUB_ENV; echo "USE_TAILSCALE=true" >> $GITHUB_ENV; else echo "TARGET_ENVIRONMENT=PRODUCTION" >> $GITHUB_ENV; echo "USE_TAILSCALE=false" >> $GITHUB_ENV; fi
- name: Checkout this repository
uses: actions/checkout@v4
with:
path: ./sdk
- name: Create Test Project
run: |
mkdir TestProject
mkdir TestProject/Packages
DEPENDENCY_STRING=$'{\n "dependencies": {\n "com.lootlocker.lootlockersdk": "file:../../sdk"'
if [[ ${{ matrix.jsonLibrary == 'newtonsoft' }} ]]; then DEPENDENCY_STRING=$DEPENDENCY_STRING$',\n "com.unity.nuget.newtonsoft-json": "3.0.2"'; fi
DEPENDENCY_STRING=$DEPENDENCY_STRING$'\n },\n "testables": ["com.lootlocker.lootlockersdk"]\n}'
echo $DEPENDENCY_STRING >> TestProject/Packages/manifest.json
mkdir TestProject/Assets/
cp -r sdk/Samples~/LootLockerExamples TestProject/Assets/
- name: Setup Tailscale
if: ${{ ENV.USE_TAILSCALE == 'true' }}
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ SECRETS.CI_TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ SECRETS.CI_TS_OAUTH_SECRET }}
tags: tag:ci
- name: Can reach ${{ ENV.TARGET_ENVIRONMENT }} environment
run: |
curl -X POST "https://${{ ENV.LOOTLOCKER_URL }}/game/v2/session/guest" -H "Content-Type: application/json" -d "{\"game_key\": \"request_will_fail_but_will_tell_us_if_we_have_a_connection\", \"game_version\": \"0.10.0.0\" }"
- name: Set the project to use zerodep json
if: ${{ matrix.jsonLibrary == 'zerodep' }}
run: |
mkdir TestProject/ProjectSettings
echo $'%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!129 &1\nPlayerSettings:\n scriptingDefineSymbols:\n 1: LOOTLOCKER_COMMANDLINE_SETTINGS' >> TestProject/ProjectSettings/ProjectSettings.asset
- name: Set the project to use Newtonsoft json
if: ${{ matrix.jsonLibrary == 'newtonsoft' }}
run: |
mkdir TestProject/ProjectSettings
echo $'%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!129 &1\nPlayerSettings:\n scriptingDefineSymbols:\n 1: LOOTLOCKER_USE_NEWTONSOFTJSON;LOOTLOCKER_COMMANDLINE_SETTINGS' >> TestProject/ProjectSettings/ProjectSettings.asset
- name: Set user information command line arguments
if: ${{ ENV.USE_TAILSCALE != 'true' }}
run: |
echo "USER_COMMANDLINE_ARGUMENTS=-adminemail ${{ SECRETS.UNITY_CI_ADMIN_EMAIL }} -adminpassword ${{ SECRETS.UNITY_CI_ADMIN_PASSWORD }}" >> $GITHUB_ENV
- name: Cache Libraries
if: ${{ vars.ENABLE_INTEGRATION_TESTS == 'true' }}
uses: actions/cache@v4
with:
path: tests~/Library
key: Library-${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.jsonLibrary }}
restore-keys: Library-
- name: Run tests in ${{ matrix.unityVersion }} ${{ matrix.testMode }} towards ${{ ENV.TARGET_ENVIRONMENT }} with json library ${{ matrix.jsonLibrary }}
uses: game-ci/unity-test-runner@v4
if: ${{ vars.ENABLE_INTEGRATION_TESTS == 'true' }}
id: tests
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: TestProject/
testMode: ${{ matrix.testMode }}
unityVersion: ${{ matrix.unityVersion }}
checkName: ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.jsonLibrary }} Test Results
artifactsPath: ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.jsonLibrary }}-artifacts
githubToken: ${{ secrets.GITHUB_TOKEN }}
customParameters: -lootlockerurl ${{ ENV.LOOTLOCKER_URL }} ${{ ENV.USER_COMMANDLINE_ARGUMENTS }}
useHostNetwork: true
test-samples:
name: Test Samples
runs-on: [ubuntu-latest]
#runs-on: [k8s]
#container:
# image: ubuntu-latest
needs: [editor-smoke-test, linux-build-smoke-test]
timeout-minutes: 8
env:
LL_USE_STAGE: false
strategy:
fail-fast: false
matrix:
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
steps:
- name: Setup commandline dependencies (if on self-hosted runner)
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
apt update
apt-get install -y git
git config --global --add safe.directory unity-sdk
git config --global --add safe.directory unity-sdk-packager
apt-get install -y jq
apt-get install -y sed
apt-get install -y docker
apt-get install -y curl
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Checkout unity-sdk repository
uses: actions/checkout@v4
with:
path: unity-sdk
- name: Checkout unity-sdk-sample-tester repository
uses: actions/checkout@v4
with:
repository: lootlocker/unity-sdk-sample-tester
path: unity-sdk-sample-tester
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
- name: Add LootLockerSDK as asset folder
run: |
cp -r unity-sdk unity-sdk-sample-tester/Assets/LootLockerSDK
- uses: actions/cache@v4
with:
path: unity-sdk-sample-tester/Library
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-sample-tester
restore-keys: |
${{ matrix.targetPlatform }}-Library-unity-sdk-sample-tester
Library-
- name: Compile and run all sample scenes ${{ matrix.unityVersion }}
id: test-samples
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
with:
testMode: editmode
checkName: Sample Scene ${{ matrix.unityVersion }} Test Results
artifactsPath: test-samples-${{ matrix.unityVersion }}-artifacts
projectPath: unity-sdk-sample-tester
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
validate-sdk:
name: Validate SDK
runs-on: [ubuntu-latest]
#runs-on: [k8s]
#container:
# image: ubuntu-latest
needs: [editor-smoke-test, linux-build-smoke-test]
timeout-minutes: 8
env:
LL_USE_STAGE: false
strategy:
fail-fast: false
matrix:
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
steps:
- name: Setup commandline dependencies (if on self-hosted runner)
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
apt update
apt-get install -y git
git config --global --add safe.directory unity-sdk
git config --global --add safe.directory unity-sdk-packager
apt-get install -y jq
apt-get install -y sed
apt-get install -y docker
apt-get install -y curl
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Checkout unity-sdk repository
uses: actions/checkout@v4
with:
path: unity-sdk
- name: Checkout unity-sdk-package-validator repository
uses: actions/checkout@v4
with:
repository: lootlocker/unity-sdk-package-validator
path: unity-sdk-package-validator
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
- name: Add LootLockerSDK as asset folder
run: |
cp -r unity-sdk unity-sdk-package-validator/Assets/LootLockerSDK
- uses: actions/cache@v4
with:
path: unity-sdk-package-validator/Library
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-package-validator
restore-keys: |
${{ matrix.targetPlatform }}-Library-unity-sdk-package-validator
Library-
- name: Validate SDK using asset store tools
id: validate-sdk
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
with:
testMode: editmode
checkName: Validate SDK ${{ matrix.unityVersion }} Test Results
artifactsPath: validate-sdk-${{ matrix.unityVersion }}-artifacts
projectPath: unity-sdk-package-validator
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
package-sdk:
name: Package SDK
runs-on: [ubuntu-latest]
needs: [test-samples, validate-sdk, run-integration-tests]
timeout-minutes: 5
if: (startsWith(github.ref, 'refs/pull') && endsWith(github.base_ref, 'main')) || (startsWith(github.ref, 'refs/heads') && endsWith(github.ref, 'main')) || startsWith(github.ref, 'refs/tags/v')
env:
LL_USE_STAGE: false
strategy:
fail-fast: false
matrix:
unityVersion: ${{ fromJson(VARS.CI_UNITY_VERSIONS) }}
steps:
- name: Setup commandline dependencies (if on self-hosted runner)
if: ${{ env.LL_USE_STAGE == 'true' }}
run: |
apt update
apt-get install -y git
git config --global --add safe.directory unity-sdk
git config --global --add safe.directory unity-sdk-packager
apt-get install -y jq
apt-get install -y sed
apt-get install -y docker
apt-get install -y curl
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Checkout unity-sdk repository
uses: actions/checkout@v4
with:
path: unity-sdk
- name: Checkout unity-sdk-packager-project repository
uses: actions/checkout@v4
with:
repository: lootlocker/unity-sdk-packager
path: unity-sdk-packager
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
- name: Add LootLockerSDK as asset folder
run: |
cp -r unity-sdk unity-sdk-packager/Assets/LootLockerSDK
- uses: actions/cache@v4
with:
path: unity-sdk-packager/Library
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-packager
restore-keys: |
${{ matrix.targetPlatform }}-Library-unity-sdk-packager
Library-
- name: Package SDK for ${{ matrix.unityVersion }}
id: package-sdk-gameci
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
with:
testMode: editmode
checkName: SDK Packaging ${{ matrix.unityVersion }} Test Results
artifactsPath: package-sdk-${{ matrix.unityVersion }}-artifacts
projectPath: unity-sdk-packager
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
- name: Expose packaged SDK as artifact
uses: actions/upload-artifact@v4
with:
name: LootLockerSDK-${{ matrix.unityVersion }}.zip
path: unity-sdk-packager/LootLockerSDK*.unitypackage