Skip to content

Commit 3e580e9

Browse files
authored
chore: Utilize app-runner for Desktop (#2569)
1 parent 670a018 commit 3e580e9

File tree

10 files changed

+618
-124
lines changed

10 files changed

+618
-124
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ jobs:
9898
with:
9999
unity-version: ${{ matrix.unity-version }}
100100

101-
# A Linux, docker-based build to prepare a game ("player") for some platforms. The tests run in `smoke-test-run`.
102-
smoke-test-build:
101+
# A Linux, docker-based build to prepare a WebGL player. The tests run in `smoke-test-run`.
102+
smoke-test-build-webgl:
103103
name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Smoke Test
104104
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
105105
needs: [smoke-test-create, create-unity-matrix]
@@ -108,15 +108,11 @@ jobs:
108108
fail-fast: false
109109
matrix:
110110
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
111-
platform: ["WebGL", "Linux"]
111+
platform: ["WebGL"]
112112
include:
113113
- platform: WebGL
114114
check_symbols: true
115115
build_platform: WebGL
116-
- platform: Linux
117-
image-suffix: "-il2cpp"
118-
check_symbols: true
119-
build_platform: Linux
120116
env:
121117
UNITY_PATH: docker exec unity unity-editor
122118
steps:
@@ -328,16 +324,16 @@ jobs:
328324
# Also make sure to match the versions available here:
329325
# - https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
330326

331-
smoke-test-run:
327+
smoke-test-run-webgl:
332328
name: Run ${{ matrix.platform }} ${{ matrix.unity-version }} Smoke Test
333329
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
334-
needs: [smoke-test-build, create-unity-matrix]
330+
needs: [smoke-test-build-webgl, create-unity-matrix]
335331
runs-on: ubuntu-latest
336332
strategy:
337333
fail-fast: false
338334
matrix:
339335
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
340-
platform: ["WebGL", "Linux"]
336+
platform: ["WebGL"]
341337
steps:
342338
- name: Checkout
343339
uses: actions/checkout@v3
@@ -352,133 +348,70 @@ jobs:
352348
run: tar -xvzf test-app-runtime.tar.gz
353349

354350
- name: Run (WebGL)
355-
if: ${{ matrix.platform == 'WebGL' }}
356351
timeout-minutes: 10
357352
run: |
358353
pip3 install --upgrade --user selenium urllib3 requests
359354
python3 scripts/smoke-test-webgl.py "samples/IntegrationTest/Build"
360355
361-
- name: Run Smoke Test (Linux)
362-
if: ${{ matrix.platform == 'Linux' }}
363-
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke
364-
365-
- name: Run Crash Test (Linux)
366-
if: ${{ matrix.platform == 'Linux' }}
367-
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash
368-
369-
desktop-smoke-test:
370-
name: Run ${{ matrix.os }} ${{ matrix.unity-version }} Smoke Test
356+
smoke-test-build-linux:
357+
name: Build Linux ${{ matrix.unity-version }} Integration Test
371358
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
372-
needs: [smoke-test-create, create-unity-matrix, build-unity-sdk]
373-
runs-on: ${{ matrix.os }}-latest
359+
needs: [smoke-test-create, create-unity-matrix]
360+
secrets: inherit
374361
strategy:
375362
fail-fast: false
376363
matrix:
377364
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
378-
os: ["windows"]
379-
include:
380-
- os: windows
381-
unity-modules: "windows-il2cpp"
382-
unity-config-path: "C:/ProgramData/Unity/config/"
383-
# os: ["windows", "macos"]
384-
# include:
385-
# - os: macos
386-
# unity-modules: mac-il2cpp
387-
# unity-config-path: /Library/Application Support/Unity/config/
388-
steps:
389-
- name: Checkout
390-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
391-
392-
- name: Load env
393-
id: env
394-
run: echo "unityVersion=$(./scripts/ci-env.ps1 "$env:UNITY_SCRIPT_ARG")" >> $env:GITHUB_OUTPUT
395-
env:
396-
UNITY_SCRIPT_ARG: unity${{ matrix.unity-version }}
397-
398-
- name: Setup Unity
399-
uses: getsentry/setup-unity@3bdc8c022b6d30ecf2d21d12a564bfa55a54fa2e
400-
with:
401-
unity-version: ${{ steps.env.outputs.unityVersion }}
402-
unity-modules: ${{ matrix.unity-modules }}
403-
404-
- name: Create Unity license config
405-
run: |
406-
New-Item -Path "$env:UNITY_CONFIG_PATH" -ItemType Directory
407-
Set-Content -Path "$env:UNITY_CONFIG_PATH/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG"
408-
env:
409-
UNITY_CONFIG_PATH: ${{ matrix.unity-config-path }}
410-
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
411-
412-
- name: Download IntegrationTest project
413-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
414-
with:
415-
name: smoke-test-${{ matrix.unity-version }}
416-
417-
- name: Extract project archive
418-
run: tar -xvzf test-project.tar.gz
419-
420-
- name: Cache Unity Library
421-
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
422-
with:
423-
path: samples/IntegrationTest/Library
424-
key: Library-IntegrationTest-${{ matrix.os }}-${{ matrix.unity-version }}-v1
425-
restore-keys: |
426-
Library-IntegrationTest-${{ matrix.os }}-${{ matrix.unity-version }}-
427-
Library-IntegrationTest-${{ matrix.os }}-
428-
429-
- name: Restore cached build without Sentry
430-
id: cache-build-nosentry
431-
uses: actions/cache@v4
432-
with:
433-
path: samples/IntegrationTest/Build-NoSentry
434-
key: build-nosentry-Windows-${{ matrix.unity-version }}
435-
436-
- name: Build without Sentry SDK
437-
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
438-
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -CheckSymbols:$false -BuildDirName "Build-NoSentry"
439-
440-
- name: Download UPM package
441-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
442-
with:
443-
name: package-release
444-
445-
- name: Extract UPM package
446-
run: ./test/Scripts.Integration.Test/extract-package.ps1
447-
448-
- name: Add Sentry to the project
449-
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
450-
451-
- name: Configure Sentry
452-
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -CheckSymbols
453-
454-
- name: Build with Sentry SDK
455-
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -CheckSymbols -UnityVersion "$env:UNITY_VERSION"
456-
env:
457-
UNITY_VERSION: ${{ matrix.unity-version }}
458-
459-
- name: Compare build sizes
460-
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform "Windows" -UnityVersion "$env:UNITY_VERSION"
461-
env:
462-
UNITY_VERSION: ${{ matrix.unity-version }}
365+
uses: ./.github/workflows/smoke-test-build-linux.yml
366+
with:
367+
unity-version: ${{ matrix.unity-version }}
463368

464-
- name: Upload build size measurement
465-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
466-
with:
467-
name: build-size-Windows-${{ matrix.unity-version }}
468-
path: build-size-measurements/*.json
469-
retention-days: 1
369+
smoke-test-build-windows:
370+
name: Build Windows ${{ matrix.unity-version }} Integration Test
371+
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
372+
needs: [smoke-test-create, create-unity-matrix]
373+
secrets: inherit
374+
strategy:
375+
fail-fast: false
376+
matrix:
377+
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
378+
uses: ./.github/workflows/smoke-test-build-windows.yml
379+
with:
380+
unity-version: ${{ matrix.unity-version }}
470381

471-
- name: Run Smoke Test
472-
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke
382+
smoke-test-run-linux:
383+
name: Run Linux ${{ matrix.unity-version }} Integration Test
384+
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
385+
needs: [smoke-test-build-linux, create-unity-matrix]
386+
secrets: inherit
387+
strategy:
388+
fail-fast: false
389+
matrix:
390+
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
391+
uses: ./.github/workflows/smoke-test-run-desktop.yml
392+
with:
393+
unity-version: ${{ matrix.unity-version }}
394+
platform: linux
473395

474-
- name: Run Crash Test
475-
run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash
396+
smoke-test-run-windows:
397+
name: Run Windows ${{ matrix.unity-version }} Integration Test
398+
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
399+
needs: [smoke-test-build-windows, create-unity-matrix]
400+
secrets: inherit
401+
strategy:
402+
fail-fast: false
403+
matrix:
404+
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
405+
uses: ./.github/workflows/smoke-test-run-desktop.yml
406+
with:
407+
unity-version: ${{ matrix.unity-version }}
408+
platform: windows
476409

477410
build-size-summary:
478411
name: Build Size
479412
runs-on: ubuntu-latest
480413
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
481-
needs: [smoke-test-build, smoke-test-build-android, smoke-test-compile-ios, desktop-smoke-test]
414+
needs: [smoke-test-build-webgl, smoke-test-build-android, smoke-test-compile-ios, smoke-test-build-linux, smoke-test-build-windows]
482415
steps:
483416
- name: Checkout
484417
uses: actions/checkout@v3

.github/workflows/smoke-test-build-android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
shell: bash
3636
env:
3737
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
38+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
3839

3940
- name: Download IntegrationTest project
4041
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4

.github/workflows/smoke-test-build-ios.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
shell: bash
4242
env:
4343
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
44+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
4445

4546
- name: Download IntegrationTest project
4647
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: "IntegrationTest: Build Linux"
2+
on:
3+
workflow_call:
4+
inputs:
5+
unity-version:
6+
required: true
7+
type: string
8+
9+
defaults:
10+
run:
11+
shell: pwsh
12+
13+
jobs:
14+
build:
15+
name: Linux ${{ inputs.unity-version }}
16+
runs-on: ubuntu-latest
17+
env:
18+
GITHUB_ACTOR: ${{ github.actor }}
19+
UNITY_PATH: docker exec unity unity-editor
20+
UNITY_VERSION: ${{ inputs.unity-version }}
21+
BUILD_PLATFORM: Linux
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
26+
27+
- name: Free Disk Space
28+
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0
29+
with:
30+
android: true
31+
dotnet: false
32+
haskell: true
33+
large-packages: false
34+
docker-images: false
35+
swap-storage: true
36+
37+
- name: Log into Docker
38+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ env.GITHUB_ACTOR }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Start the Unity docker container
45+
run: ./scripts/ci-docker.sh "$UNITY_VERSION" "Linux-il2cpp" "$UNITY_LICENSE_SERVER_CONFIG"
46+
shell: bash
47+
env:
48+
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
49+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
50+
51+
- name: Download IntegrationTest project
52+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
53+
with:
54+
name: smoke-test-${{ env.UNITY_VERSION }}
55+
56+
- name: Extract project archive
57+
run: tar -xvzf test-project.tar.gz
58+
59+
- name: Cache Unity Library
60+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
61+
with:
62+
path: samples/IntegrationTest/Library
63+
key: Library-IntegrationTest-linux-${{ env.UNITY_VERSION }}-v1
64+
restore-keys: |
65+
Library-IntegrationTest-linux-${{ env.UNITY_VERSION }}-
66+
Library-IntegrationTest-linux-
67+
68+
- name: Restore cached build without Sentry
69+
id: cache-build-nosentry
70+
uses: actions/cache@v4
71+
with:
72+
path: samples/IntegrationTest/Build-NoSentry
73+
key: build-nosentry-Linux-${{ inputs.unity-version }}
74+
75+
- name: Build without Sentry SDK
76+
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
77+
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -CheckSymbols:$false -BuildDirName "Build-NoSentry"
78+
79+
- name: Download UPM package
80+
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 # v4-with-wait-timeout
81+
with:
82+
name: package-release
83+
wait-timeout: 3600
84+
85+
- name: Extract UPM package
86+
run: ./test/Scripts.Integration.Test/extract-package.ps1
87+
88+
- name: Add Sentry to the project
89+
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
90+
91+
- name: Configure Sentry
92+
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -TestMode "integration"
93+
env:
94+
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
95+
96+
- name: Build with Sentry SDK
97+
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
98+
99+
- name: Compare build sizes
100+
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform Linux -UnityVersion "$env:UNITY_VERSION"
101+
102+
- name: Upload build size measurement
103+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
104+
with:
105+
name: build-size-Linux-${{ env.UNITY_VERSION }}
106+
path: build-size-measurements/*.json
107+
retention-days: 1
108+
109+
# We create tar explicitly because upload-artifact is slow for many files.
110+
- name: Create archive
111+
run: |
112+
Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue
113+
tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build
114+
115+
- name: Upload test app
116+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
117+
with:
118+
name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-linux
119+
if-no-files-found: error
120+
path: test-app-desktop.tar.gz
121+
retention-days: 14
122+
123+
- name: Docker diagnostics on failure
124+
if: ${{ failure() }}
125+
run: |
126+
Write-Host "=== Docker container status ==="
127+
docker ps -a --filter "name=^/unity$"
128+
129+
Write-Host "`n=== Working directory ==="
130+
docker exec unity pwd
131+
132+
Write-Host "`n=== Unity log from container ==="
133+
docker exec unity cat /sentry-unity/unity.log 2>&1 || echo "unity.log not found"
134+
continue-on-error: true
135+
136+
- name: Upload IntegrationTest project on failure
137+
if: ${{ failure() }}
138+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
139+
with:
140+
name: failed-project-desktop-linux-${{ env.UNITY_VERSION }}
141+
path: |
142+
samples/IntegrationTest
143+
unity.log
144+
!samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
145+
retention-days: 14

0 commit comments

Comments
 (0)