-
-
Notifications
You must be signed in to change notification settings - Fork 52
672 lines (573 loc) · 25.8 KB
/
ci.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
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
name: CI
on:
push:
paths-ignore:
- "**.md"
- "**.txt"
workflow_dispatch: # e.g. to manually trigger on foreign PRs
env:
LOWEST_SUPPORTED_UNITY_VERSION: 2019
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
defaults:
run:
shell: pwsh
jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
with:
access_token: ${{ github.token }}
sdk:
strategy:
matrix:
include:
- target: Android
host: ubuntu-latest
- target: Linux
# Build using older Linux version to preserve sdk compatibility with old GLIBC
# See discussion in https://github.com/getsentry/sentry-unity/issues/1730 for more details
host: ubuntu-20.04
- target: Windows
host: windows-latest
uses: ./.github/workflows/sdk.yml
with:
target: ${{ matrix.target }}
runsOn: ${{ matrix.host }}
build:
name: Build - ${{ matrix.unity-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Building the SDK with Unity 2022 and newer requires ns2.1 - skipping for now
unity-version: ["2019", "2020", "2021"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive src/sentry-dotnet
- name: Load env
id: env
run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity${{ matrix.unity-version }}")" >> $env:GITHUB_OUTPUT
- run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}"
- name: Restore Unity Packages
uses: actions/cache@v3
with:
path: |
samples/unity-of-bugs/Library/Packages
temp/unity-packages/Library/ScriptAssemblies/*.TestRunner.*
key: samples/unity-of-bugs|${{ steps.env.outputs.unityVersion }}-${{ hashFiles('samples/unity-of-bugs/Packages/packages-lock.json') }}
- name: Docker Login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start the Unity docker container
# We must use the iOS version of the image instead of 'base' - Sentry.Unity.Editor.iOS.csproj requires some libraries.
# Maybe we could just cache the needed file instead of pulling the 1 GB larger image on every build...
run: ./scripts/ci-docker.sh '${{ matrix.unity-version }}' 'ios' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}'
shell: bash
# Required by sentry-dotnet since 3.19.0
- name: Install Android dotnet workflow
run: dotnet workload install android --temp-dir "${{ runner.temp }}"
- name: Download CLI
run: ./scripts/download-sentry-cli.ps1
- name: Download Android SDK
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
name: Android-sdk
path: package-dev/Plugins/Android
wait-timeout: 3600
- name: Download Android Libraries
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
name: Android-libraries
path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib
wait-timeout: 3600
- name: Download Linux SDK
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
name: Linux-sdk
path: package-dev/Plugins/Linux
wait-timeout: 3600
- name: Download Windows SDK
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
name: Windows-sdk
path: package-dev/Plugins/Windows
wait-timeout: 3600
- name: Build Sentry.Unity Solution
run: docker exec unity dotnet build -c Release
- name: Install assemblyalias
run: docker exec unity dotnet tool install --global Alias --version 0.4.3
- name: Alias editor assemblies
run: docker exec unity /home/gh/.dotnet/tools/assemblyalias --target-directory "package-dev/Editor" --internalize --prefix "Sentry." --assemblies-to-alias "Microsoft*;Mono.Cecil*"
- name: Alias runtime assemblies
run: docker exec unity /home/gh/.dotnet/tools/assemblyalias --target-directory "package-dev/Runtime" --internalize --prefix "Sentry." --assemblies-to-alias "Microsoft*;System*"
- name: Package for release
if: ${{ matrix.unity-version == env.LOWEST_SUPPORTED_UNITY_VERSION }}
run: |
# Before packaging, we need to open & close Unity on the sample project to update .meta files in package-dev.
# We could add a new custom target but reusing UnityConfigureSentryOptions is good enough.
docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity
./scripts/pack.ps1
- name: Upload release artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.unity-version == env.LOWEST_SUPPORTED_UNITY_VERSION }}
with:
name: ${{ github.sha }}
if-no-files-found: error
# Adding the native libraries so the symbol collector craft target can find/upload them
path: |
package-release.zip
modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*
- name: Run Unity tests (playmode)
run: |
docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:TestDsn= /p:Configuration=Release /p:OutDir=other src/Sentry.Unity
docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests
- name: Upload test artifacts (playmode)
uses: actions/upload-artifact@v4
with:
name: Test results (playmode) - ${{matrix.unity-version}}
path: artifacts/test/playmode
- name: Run Unity tests (editmode)
run: docker exec unity dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests
- name: Upload test artifacts (editmode)
uses: actions/upload-artifact@v4
with:
name: Test results (editmode) - ${{matrix.unity-version}}
path: artifacts/test/editmode
package-validation:
name: UPM Package validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download UPM package
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
name: ${{ github.sha }}
wait-timeout: 3600
- name: Verify package content against snapshot
# If this step fails, you can accept the new file content by
# running the following script locally with 'accept' as an argument
# and committing the new snapshot file to your branch. i.e:
# ./test/Scripts.Tests/test-pack-contents.ps1 accept
run: ./test/Scripts.Tests/test-pack-contents.ps1
# This produces the `samples/IntegrationTest` as `smoke-test-${{ matrix.unity-version }}`.
smoke-test-create:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
name: ${{ matrix.unity-version }} Prepare Smoke Test
runs-on: ubuntu-latest
needs: [package-validation]
strategy:
fail-fast: false
matrix:
unity-version: ["2019", "2022", "6000"]
env:
UNITY_PATH: docker exec unity unity-editor
steps:
- name: Checkout
uses: actions/checkout@v3
- run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}"
- name: Docker Login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start the Unity docker container
run: ./scripts/ci-docker.sh '${{ matrix.unity-version }}' 'base' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}'
shell: bash
- name: Create new Project
run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "${{ env.UNITY_PATH }}"
# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive
run: tar -cvzf test-project.tar.gz samples/IntegrationTest
- name: Upload project
uses: actions/upload-artifact@v4
with:
name: smoke-test-${{ matrix.unity-version }}
if-no-files-found: error
path: test-project.tar.gz
# Lower retention period - we only need this to retry CI.
retention-days: 14
# A Linux, docker-based build to prepare a game ("player") for some platforms. The tests run in `smoke-test-run`.
smoke-test-build:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
name: ${{ matrix.unity-version }} ${{ matrix.platform }} Build Smoke Test
needs: [smoke-test-create]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unity-version: ["2019", "2022", "6000"]
platform: ["Android", "WebGL", "Linux", "iOS"]
include:
- platform: Linux
image-suffix: "-il2cpp"
env:
UNITY_PATH: docker exec unity unity-editor
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8
with:
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}"
- name: Docker Login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start the Unity docker container
run: ./scripts/ci-docker.sh '${{ matrix.unity-version }}' '${{ matrix.platform }}${{ matrix.image-suffix }}' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}'
shell: bash
# Workaround for missing libMonoPosixHelper.so
# See https://github.com/getsentry/sentry-unity/pull/1295
- name: Install mono-devel
if: ${{ matrix.unity-version == '2019' }}
run: |
docker exec --user root unity apt-get update
docker exec --user root unity apt-get -y -q install mono-devel
- name: Download IntegrationTest project
uses: actions/download-artifact@v4
with:
name: smoke-test-${{ matrix.unity-version }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
- name: Build without Sentry SDK
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}"
- name: Download UPM package
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- name: Extract UPM package
run: ./test/Scripts.Integration.Test/extract-package.ps1
- name: Add Sentry to the project
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}"
- name: Configure Sentry
run: |
$isAndroid = ('${{ matrix.platform }}' -eq 'Android')
$isNotMainBranch = ('${{ github.ref_name }}' -ne 'main')
$platform = if ($isAndroid -and $isNotMainBranch) { 'Android-Export' } else { '${{ matrix.platform }}' }
./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols
# Dear lord, I don't know why we have to do this: If we do not "pre-build" the project then `exportAsGoogleAndroidProject` will stay `false` in `IPostGenerateGradleAndroidProject`
# and breaking all further steps in CI
# Things I tried:
# 1. Setting the flag and restarting the editor prior to build
# 2. Setting the flag and reloading the domain in a step prior to building
# 3. Reloading the domain prior to building (does not work - build fails with a domain reload pending)
- name: Pre-Build Project for Unity 6 and Android
continue-on-error: true
if: ${{ matrix.unity-version == '6000' && matrix.platform == 'Android' }}
run: |
$platform = '${{ matrix.platform }}'
if ('${{ github.ref_name }}' -ne 'main')
{
$checkSymbols = $false
$platform = 'Android-Export'
}
else
{
$checkSymbols = $false
}
./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols:$checkSymbols -UnityVersion "${{ matrix.unity-version }}"
Remove-Item -Path samples/IntegrationTest/Build -Recurse -Force -Confirm:$false
- name: Build Project
run: |
$platform = '${{ matrix.platform }}'
if ($platform -eq 'iOS')
{
$checkSymbols = $false
}
elseif (($platform -eq 'Android') -and ('${{ github.ref_name }}' -ne 'main'))
{
$checkSymbols = $false
$platform = 'Android-Export'
}
else
{
$checkSymbols = $true
}
./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols:$checkSymbols -UnityVersion "${{ matrix.unity-version }}"
# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive
shell: bash
run: |
# Note: remove local.properties file that contains Android SDK & NDK paths in the Unity installation.
rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
tar -cvzf test-app.tar.gz samples/IntegrationTest/Build
- name: Upload test app
uses: actions/upload-artifact@v4
with:
name: testapp-${{ matrix.platform }}-${{ matrix.unity-version }}
if-no-files-found: error
path: test-app.tar.gz
# Lower retention period - we only need this to retry CI.
retention-days: 14
- name: Upload IntegrationTest project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: failed-project-${{ matrix.platform }}-${{ matrix.unity-version }}
path: |
samples/IntegrationTest
!samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
# Lower retention period - we only need this to retry CI.
retention-days: 14
desktop-smoke-test:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
name: ${{ matrix.unity-version }} ${{ matrix.os }} Run Smoke Test
needs: [smoke-test-create]
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
unity-version: ["2019", "2022", "6000"]
# os: ["windows", "macos"]
os: ["windows"]
include:
- os: windows
unity-modules: windows-il2cpp
unity-config-path: C:/ProgramData/Unity/config/
# - os: macos
# unity-modules: mac-il2cpp
# unity-config-path: /Library/Application Support/Unity/config/
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load env
id: env
run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity${{ matrix.unity-version }}")" >> $env:GITHUB_OUTPUT
- name: Setup Unity
uses: getsentry/setup-unity@d84ad1d1fb3020e48883c3ac8e87d64baf1135c7
with:
unity-version: ${{ steps.env.outputs.unityVersion }}
unity-modules: ${{ matrix.unity-modules }}
- run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}"
- name: Create Unity license config
run: |
New-Item -Path '${{ matrix.unity-config-path }}' -ItemType Directory
Set-Content -Path '${{ matrix.unity-config-path }}services-config.json' -Value '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}'
- name: Download IntegrationTest project
uses: actions/download-artifact@v4
with:
name: smoke-test-${{ matrix.unity-version }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
- name: Build without Sentry SDK
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}"
- name: Download UPM package
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- name: Extract UPM package
run: ./test/Scripts.Integration.Test/extract-package.ps1
- name: Add Sentry to the project
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}"
- name: Configure Sentry
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -CheckSymbols
- name: Build with Sentry SDK
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -CheckSymbols -UnityVersion "${{ matrix.unity-version }}"
- name: Run Smoke Test
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke
- name: Run Crash Test
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash
android-smoke-test-run:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [mobile-smoke-test-compile]
name: ${{ matrix.unity-version }} Android ${{ matrix.api-level }} Run Smoke Test
uses: ./.github/workflows/android-smoke-test-wrapper.yml
with:
unity-version: ${{ matrix.unity-version }}
api-level: ${{ matrix.api-level }}
strategy:
fail-fast: false
matrix:
api-level: [27, 28, 29, 30, 31] # last updated October 2022
unity-version: ["2019", "2022", "6000"]
include:
# API 21 is barely used but let's check it as the minimum supported version for now.
- api-level: 21
unity-version: "2019"
exclude:
# Seems like there's an error in Unity with Android API 30 - disabling.
# https://github.com/getsentry/sentry-unity/issues/719#issuecomment-1129129952
- api-level: 30
unity-version: "2021"
- api-level: 30
unity-version: "2022"
mobile-smoke-test-compile:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [smoke-test-build]
name: ${{ matrix.unity-version }} ${{ matrix.platform }} Compile Smoke Test
runs-on: ${{ matrix.platform == 'iOS' && 'macos' || 'ubuntu' }}-latest
strategy:
fail-fast: false
matrix:
unity-version: ["2019", "2022", "6000"]
platform: ["Android", "iOS"]
include:
# See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html
- unity-version: "2019"
ndk: "r19"
- unity-version: "2022"
ndk: "r21d"
- unity-version: "6000"
ndk: "r23b"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download app project
uses: actions/download-artifact@v4
with:
name: testapp-${{ matrix.platform }}-${{ matrix.unity-version }}
- name: Extract app project
run: tar -xvzf test-app.tar.gz
- name: Setup Android
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # pin@v2
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
- name: Setup NDK
uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
id: setup-ndk
with:
ndk-version: ${{ matrix.ndk }}
add-to-path: false
# We modify the exported gradle project to deal with the different build-environment
# I.e. we're fixing the paths for SDK & NDK that have been hardcoded to point at the Unity installation
- name: Modify gradle project
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
run: |
./test/Scripts.Integration.Test/modify-gradle-project.ps1 `
-AndroidSdkRoot $env:ANDROID_SDK_ROOT `
-NdkPath ${{ steps.setup-ndk.outputs.ndk-path }} `
-UnityVersion ${{ matrix.unity-version }}
- name: Setup JDK 17 for Unity 6
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' && matrix.unity-version == '6000' }}
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Android smoke test
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}"
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
- name: iOS smoke test
if: ${{ matrix.platform == 'iOS' }}
run: ./scripts/smoke-test-ios.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}"
- name: Upload Project project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: failed-project-${{ matrix.platform }}-${{ matrix.unity-version }}-but-compiled
path: |
samples/IntegrationTest
!samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
# Lower retention period - we only need this to retry CI.
retention-days: 14
- name: Upload app
uses: actions/upload-artifact@v4
with:
name: testapp-${{ matrix.platform }}-compiled-${{ matrix.unity-version }}
# Collect app but ignore the files that are not required for the test.
path: |
samples/IntegrationTest/Build/*.apk
samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/
!**/Release-iphonesimulator/*.dSYM
!**/Release-iphonesimulator/UnityFramework.framework/*
# Lower retention period - we only need this to retry CI.
retention-days: 14
ios-smoke-test-run:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [mobile-smoke-test-compile]
name: ${{ matrix.unity-version }} iOS ${{ matrix.ios }} Run Smoke Test
runs-on: macos-12
strategy:
fail-fast: false
matrix:
unity-version: ["2019", "2022", "6000"]
# Check https://support.apple.com/en-us/HT201222 for the latest minor version for a given major one.
# https://developer.apple.com/support/app-store/ shows that of all iOS devices
# - `iOS 16`: 71%
# - `iOS 15`: 20 %
# - the rest: 8 %
# as of May 2, 2023. Therefore, let's stick to testing iOS 15 and `latest` for now.
# Numbers as string otherwise GH will reformat the runtime numbers removing the fractions.
# Also make sure to match the versions available here:
# - https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
ios: ["15.4", latest] # last updated May 2023
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download app artifact
uses: actions/download-artifact@v4
with:
name: testapp-iOS-compiled-${{ matrix.unity-version }}
path: samples/IntegrationTest/Build
- name: Setup xcode-install
# Github Virtual machine already sets the runtime and simulator for the latest release.
if: ${{ matrix.ios != 'latest'}}
run: gem install xcode-install
- name: Setup ${{matrix.ios}} runtime
if: ${{ matrix.ios != 'latest'}}
run: xcversion simulators --install='iOS ${{matrix.ios}}'
- name: Setup ${{matrix.ios}} Simulator
if: ${{ matrix.ios != 'latest' }}
# We need to setup an simulator in order to xCode to populate the simulators for the given runtime.
run: xcrun simctl create InitialSimulator "iPhone 8" "iOS${{ matrix.ios }}"
- name: Smoke test
id: smoke-test-ios
timeout-minutes: 10
run: |
$runtime = "${{ matrix.ios }}"
If ($runtime -ne "latest")
{
$runtime = "iOS " + $runtime
}
./Scripts/smoke-test-ios.ps1 Test "$runtime" -IsIntegrationTest
smoke-test-run:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [smoke-test-build]
name: ${{ matrix.unity-version }} ${{ matrix.platform }} Run Smoke Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unity-version: ["2019", "2022", "6000"]
platform: ["WebGL", "Linux"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download test app artifact
uses: actions/download-artifact@v4
id: download
with:
name: testapp-${{ matrix.platform }}-${{ matrix.unity-version }}
- name: Extract test app
run: tar -xvzf test-app.tar.gz
- name: Run (WebGL)
if: ${{ matrix.platform == 'WebGL' }}
timeout-minutes: 10
run: |
pip3 install --upgrade --user selenium urllib3 requests
python3 scripts/smoke-test-webgl.py "samples/IntegrationTest/Build"
- name: Run Smoke Test (Linux)
if: ${{ matrix.platform == 'Linux' }}
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke
- name: Run Crash Test (Linux)
if: ${{ matrix.platform == 'Linux' }}
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash