-
-
Notifications
You must be signed in to change notification settings - Fork 233
431 lines (366 loc) · 15.5 KB
/
build.yml
File metadata and controls
431 lines (366 loc) · 15.5 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
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
name: build
on:
push:
branches:
- main
- release/*
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:
jobs:
# This job won't actually run, it just defines reusable anchors
_common:
if: false # prevents execution
runs-on: ubuntu-latest
steps:
- &checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- &cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
- &cache-restore
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
- &upload-artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
- &download-artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- &sentry-github-workflow
uses: getsentry/github-workflows/sentry-cli/integration-test/@a5e409bd5bad4c295201cdcfe862b17c50b29ab7 # v2.14.1
build-sentry-native:
name: sentry-native (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
rid: linux-x64
- os: ubuntu-22.04-arm
rid: linux-arm64
- os: ubuntu-latest
rid: linux-musl-x64
container:
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
- os: ubuntu-24.04-arm
rid: linux-musl-arm64
container:
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
volumes:
- /tmp/node20:/__e/node20
- /tmp/node24:/__e/node24
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
rid: macos # universal (osx-arm64 + osx-x64)
- os: windows-latest
rid: win-x64
- os: windows-11-arm
rid: win-arm64
steps:
- name: Initialize Alpine Linux
if: ${{ contains(matrix.container.image, 'alpine') }}
run: |
curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.github/alpine/setup-node.sh | sudo bash /dev/stdin
- name: Checkout
<<: *checkout
- run: git submodule update --init modules/sentry-native
# zstd is needed for cross OS actions/cache but missing from windows-11-arm
# https://github.com/actions/partner-runner-images/issues/99
- name: Install zstd on Windows ARM64
uses: ./.github/actions/install-zstd
- id: cache
<<: *cache
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-${{ matrix.rid }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
enableCrossOsArchive: true
- name: Remove unused applications
if: ${{ !matrix.container }}
uses: ./.github/actions/freediskspace
- run: scripts/build-sentry-native.ps1
if: steps.cache.outputs.cache-hit != 'true'
shell: pwsh
build:
needs: build-sentry-native
name: .NET (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
rid: linux-x64
slnf: Sentry-CI-Build-Linux.slnf
- os: ubuntu-22.04-arm
rid: linux-arm64
slnf: Sentry-CI-Build-Linux-NoMobile.slnf
- os: ubuntu-latest
rid: linux-musl-x64
slnf: Sentry-CI-Build-Linux-NoMobile.slnf
container:
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- os: ubuntu-24.04-arm
rid: linux-musl-arm64
slnf: Sentry-CI-Build-Linux-NoMobile.slnf
container:
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
volumes:
- /tmp/node20:/__e/node20
- /tmp/node24:/__e/node24
- /var/run/docker.sock:/var/run/docker.sock
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
rid: macos # universal (osx-arm64 + osx-x64)
slnf: Sentry-CI-Build-macOS.slnf
- os: windows-latest
rid: win-x64
slnf: Sentry-CI-Build-Windows.slnf
- os: windows-11-arm
rid: win-arm64
slnf: Sentry-CI-Build-Windows-arm64.slnf
steps:
- name: Initialize Alpine Linux
if: ${{ contains(matrix.container.image, 'alpine') }}
run: |
curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.github/alpine/setup-node.sh | sudo bash /dev/stdin
- name: Cancel Previous Runs
if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1
- <<: *checkout
name: Checkout
with:
submodules: recursive
fetch-depth: 2 # default is 1 and codecov needs > 1
- name: Remove unused applications
if: ${{ !matrix.container }}
uses: ./.github/actions/freediskspace
- name: Setup Environment
uses: ./.github/actions/environment
# We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
- name: Set Environment Variables
if: runner.os == 'macOS'
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
- name: Download sentry-native (linux-x64)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-x64') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-linux-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (linux-arm64)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-arm64') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-linux-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (linux-musl-x64)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-musl-x64') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-linux-musl-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (linux-musl-arm64)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-musl-arm64') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-linux-musl-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (macos)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'macos') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-macos-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (win-x64)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'win-x64') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-win-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Download sentry-native (win-arm64)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'win-arm64') }}
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-win-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Build Native Dependencies
if: ${{ !matrix.container }}
uses: ./.github/actions/buildnative
- name: Restore .NET Dependencies
run: dotnet restore ${{ matrix.slnf }} --nologo
- name: Build
id: build
run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
- name: Upload build logs
if: ${{ always() }}
<<: *upload-artifact
with:
name: ${{ matrix.rid }}-build-logs
path: |
build.log
build.binlog
if-no-files-found: ignore
- name: Test
run: dotnet test ${{ matrix.slnf }} -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
- name: Upload code coverage
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload build and test outputs
if: failure()
<<: *upload-artifact
with:
name: ${{ matrix.rid }}-verify-test-results
path: "**/*.received.*"
- name: Create NuGet Packages
run: dotnet pack ${{ matrix.slnf }} -c Release --no-build --nologo
- name: Archive NuGet Packages
if: env.CI_PUBLISHING_BUILD == 'true'
<<: *upload-artifact
with:
name: ${{ github.sha }}
if-no-files-found: error
path: |
src/**/Release/*.nupkg
src/**/Release/*.snupkg
- name: Sparse checkout
if: env.CI_PUBLISHING_BUILD == 'true'
<<: *checkout
with:
# We only check out what is absolutely necessary to reduce a chance of local files impacting
# integration tests, e.g. Directory.Build.props, nuget.config, ...
sparse-checkout: |
integration-test
.github
- name: Fetch NuGet Packages
if: env.CI_PUBLISHING_BUILD == 'true'
<<: *download-artifact
with:
name: ${{ github.sha }}
path: src
- name: Integration test
<<: *sentry-github-workflow
with:
path: integration-test
msbuild:
needs: build-sentry-native
name: MSBuild
runs-on: windows-latest
steps:
- name: Checkout
<<: *checkout
with:
submodules: recursive
- name: Download sentry-native (win-x64)
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-win-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Setup Environment
uses: ./.github/actions/environment
- name: Build Native Dependencies
uses: ./.github/actions/buildnative
- name: Setup MSBuild
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
- name: Run MSBuild
id: msbuild
run: msbuild Sentry-CI-Build-Windows.slnf -t:Restore,Build -p:Configuration=Release --nologo -v:minimal -flp:logfile=msbuild.log -p:CopyLocalLockFileAssemblies=true -bl:msbuild.binlog
- name: Upload logs
if: ${{ always() }}
<<: *upload-artifact
with:
name: ${{ runner.os }}-msbuild-logs
path: |
msbuild.log
msbuild.binlog
if-no-files-found: ignore
# Unsupported Native AOT runtimes should have SentryNative auto-disabled
# to avoid native library loading errors on startup.
unsupported-aot:
needs: build
name: Unsupported AOT (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04-arm
rid: linux-arm
- os: windows-latest
rid: win-x86
steps:
- name: Checkout
<<: *checkout
with:
submodules: recursive
- name: Setup Environment
uses: ./.github/actions/environment
- name: Build Native Dependencies
uses: ./.github/actions/buildnative
- name: Fetch NuGet Packages
<<: *download-artifact
with:
name: ${{ github.sha }}
path: src
- name: Test AOT
<<: *sentry-github-workflow
env:
RuntimeIdentifier: ${{ matrix.rid }}
with:
path: integration-test/aot.Tests.ps1
trim-analysis:
needs: build-sentry-native
name: Trim analysis
runs-on: macos-15
steps:
- name: Checkout
<<: *checkout
with:
submodules: recursive
fetch-depth: 2 # default is 1 and codecov needs > 1
# We use macOS for the final publishing build so we get all the iOS/Mac Catalyst targets in the packages
- name: Set Environment Variables
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
- name: Download sentry-native (macos)
<<: *cache-restore
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-macos-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Setup Environment
uses: ./.github/actions/environment
- name: Build Native Dependencies
uses: ./.github/actions/buildnative
- name: Publish Test app (macOS)
run: dotnet publish test/Sentry.TrimTest/Sentry.TrimTest.csproj -c Release -r osx-arm64
- name: Publish Test app (Android)
run: dotnet publish test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj -c Release -f net9.0-android35.0 -r android-arm64
# We can't publish iOS applications on CI yet. We'd need a valid bundle identifier and to install the relevant
# certificates/profiles on CI (presumably certs associated with the Sentry org).
# See https://youtrack.jetbrains.com/issue/RIDER-17115/Could-not-find-any-available-provisioning-profiles-for-iOS
# - name: Publish Test app (iOS)
# run: dotnet publish test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj -c Release -f net9.0-ios18.0 -r ios-arm64
test-solution-filters:
runs-on: ubuntu-22.04
if: ${{ !startsWith(github.ref_name, 'release/') }}
steps:
- <<: *checkout
with:
submodules: recursive
- name: Rebuild Solution Filters
shell: pwsh
run: pwsh scripts/generate-solution-filters.ps1
- name: Ensure Solution Filters are up to date
shell: pwsh
run: scripts/dirty-check.ps1 -PathToCheck ./*.sln* -GuidanceOnFailure "Uncommitted changes to the solution filters detected. Run `scripts/generate-solution-filters.ps1` locally and commit changes."