-
-
Notifications
You must be signed in to change notification settings - Fork 62
221 lines (186 loc) · 9.08 KB
/
Copy pathtest-build-linux.yml
File metadata and controls
221 lines (186 loc) · 9.08 KB
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
name: "Test: Build Linux"
on:
workflow_call:
inputs:
unity-version:
required: true
type: string
capture:
required: false
type: boolean
default: false
description: "Capture the envelopes and debug files this job produces - see docs/envelope-capture.md"
secrets:
UNITY_LICENSE_SERVER_CONFIG:
required: true
SENTRY_AUTH_TOKEN:
required: true
SENTRY_TEST_DSN:
required: true
defaults:
run:
shell: pwsh
jobs:
build:
name: Linux ${{ inputs.unity-version }}
runs-on: ubuntu-latest
env:
GITHUB_ACTOR: ${{ github.actor }}
UNITY_PATH: docker exec unity unity-editor
UNITY_VERSION: ${{ inputs.unity-version }}
BUILD_PLATFORM: Linux
# Empty unless a capture run was dispatched; see docs/envelope-capture.md.
SENTRY_CAPTURE_PATH: ${{ inputs.capture && format('test/IntegrationTest/capture/linux-{0}', inputs.unity-version) || '' }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Free Disk Space
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0
with:
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: Log into Docker
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ env.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start the Unity docker container
run: ./scripts/ci-docker.sh "$UNITY_VERSION" "Linux-il2cpp" "$UNITY_LICENSE_SERVER_CONFIG"
shell: bash
env:
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Download IntegrationTest project
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: test-${{ env.UNITY_VERSION }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
- name: Restore Unity Library cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Library
key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }}
restore-keys: |
it-library-ubuntu-${{ env.UNITY_VERSION }}-
- name: Restore cached build without Sentry
id: cache-build-nosentry
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Build-NoSentry
key: build-nosentry-Linux-${{ inputs.unity-version }}
- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -BuildDirName "Build-NoSentry"
- name: Save cached build without Sentry
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Build-NoSentry
key: build-nosentry-Linux-${{ inputs.unity-version }}
- name: Download UPM package
uses: ./.github/actions/wait-for-artifact
with:
name: package-release
- 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" -PackagePath "test-package-release"
- name: Download DependencyConflict package
uses: ./.github/actions/wait-for-artifact
with:
name: dependency-conflict-package
path: dependency-conflict-package
- name: Add DependencyConflict to the project
run: ./test/Scripts.Integration.Test/add-dependency-conflict.ps1 -PackagePath "dependency-conflict-package"
- name: Configure Sentry
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Build with Sentry SDK (Breakpad backend)
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION"
- name: Assert symbols and sources were uploaded (Breakpad backend)
run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log
- name: Compare build sizes
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform Linux -UnityVersion "$env:UNITY_VERSION"
- name: Upload build size measurement
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-size-Linux-${{ env.UNITY_VERSION }}
path: build-size-measurements/*.json
retention-days: 1
# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive (Breakpad backend)
run: |
Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue
Copy-Item unity.log samples/IntegrationTest/Build/ -ErrorAction SilentlyContinue
tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build
- name: Upload test app (Breakpad backend)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-linux-breakpad
if-no-files-found: error
path: test-app-desktop.tar.gz
retention-days: 14
- name: Overwrite IntegrationOptionsConfiguration for Native backend
run: |
$optionsPath = "samples/IntegrationTest/Assets/Scripts/IntegrationOptionsConfiguration.cs"
$content = Get-Content $optionsPath -Raw
$content = $content -replace 'LinuxBackend = LinuxBackend.Breakpad', 'LinuxBackend = LinuxBackend.Native'
Set-Content $optionsPath $content
- name: Build with Sentry SDK (Native backend)
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION"
- name: Assert symbols and sources were uploaded (Native backend)
run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log
- name: Create archive (Native backend)
run: |
Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue
Remove-Item -Force test-app-desktop.tar.gz -ErrorAction SilentlyContinue
Copy-Item unity.log samples/IntegrationTest/Build/ -ErrorAction SilentlyContinue
tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build
- name: Upload test app (Native backend)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-linux-native
if-no-files-found: error
path: test-app-desktop.tar.gz
retention-days: 14
- name: Save Unity Library cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Library
key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }}
- name: Docker diagnostics on failure
if: ${{ failure() }}
run: |
Write-Host "=== Docker container status ==="
docker ps -a --filter "name=^/unity$"
Write-Host "`n=== Working directory ==="
docker exec unity pwd
Write-Host "`n=== Unity log from container ==="
docker exec unity cat /sentry-unity/unity.log 2>&1 || echo "unity.log not found"
continue-on-error: true
- name: Upload IntegrationTest project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: failed-project-desktop-linux-${{ env.UNITY_VERSION }}
path: |
samples/IntegrationTest
unity.log
!samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
retention-days: 14
- name: Upload captured corpus
if: ${{ always() && inputs.capture }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: corpus-linux-${{ inputs.unity-version }}
path: test/IntegrationTest/capture/
if-no-files-found: warn
retention-days: 14