-
-
Notifications
You must be signed in to change notification settings - Fork 62
207 lines (175 loc) · 8.8 KB
/
Copy pathtest-build-windows.yml
File metadata and controls
207 lines (175 loc) · 8.8 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
name: "Test: Build Windows"
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: Windows ${{ inputs.unity-version }}
runs-on: windows-latest
env:
UNITY_VERSION: ${{ inputs.unity-version }}
BUILD_PLATFORM: Windows
# Empty unless a capture run was dispatched; see docs/envelope-capture.md.
SENTRY_CAPTURE_PATH: ${{ inputs.capture && format('test/IntegrationTest/capture/windows-{0}', inputs.unity-version) || '' }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Load env
id: env
run: |
$u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}'
"unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT
"unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT
- name: Setup Unity
uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3
with:
unity-version: ${{ steps.env.outputs.unityVersion }}
unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}
unity-modules: windows-il2cpp
- name: Create Unity license config
run: |
New-Item -Path "C:/ProgramData/Unity/config/" -ItemType Directory -Force
Set-Content -Path "C:/ProgramData/Unity/config/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG"
env:
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}
- 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-windows-${{ env.UNITY_VERSION }}-${{ github.run_id }}
restore-keys: |
it-library-windows-${{ 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-Windows-${{ 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 Windows -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-Windows-${{ 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 Windows
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Build with Sentry SDK (Crashpad backend)
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -UnityVersion "$env:UNITY_VERSION"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Assert symbols and sources were uploaded (Crashpad 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 Windows -UnityVersion "$env:UNITY_VERSION"
- name: Upload build size measurement
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-size-Windows-${{ 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 (Crashpad 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 (Crashpad backend)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-windows-crashpad
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 'WindowsBackend = WindowsBackend.Crashpad', 'WindowsBackend = WindowsBackend.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 Windows -UnityVersion "$env:UNITY_VERSION"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- 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 }}-windows-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-windows-${{ env.UNITY_VERSION }}-${{ github.run_id }}
- name: Upload IntegrationTest project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: failed-project-desktop-windows-${{ 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-windows-${{ inputs.unity-version }}
path: test/IntegrationTest/capture/
if-no-files-found: warn
retention-days: 14