This repository was archived by the owner on May 28, 2026. It is now read-only.
forked from getsentry/sentry-cocoa
-
Notifications
You must be signed in to change notification settings - Fork 1
382 lines (337 loc) · 13.5 KB
/
Copy pathbuild.yml
File metadata and controls
382 lines (337 loc) · 13.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
name: Build
on:
push:
branches:
- main
- release/**
pull_request:
# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple build runs of the same code,
# which would waste CI resources without providing additional value.
# - For pull requests, we cancel in-progress builds when new commits are pushed since only the
# latest commit's build results matter for merge decisions.
# - For main branch pushes, we never cancel builds to ensure all release and sample builds complete,
# as broken builds on main could block releases and affect downstream consumers.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
files-changed:
name: Detect File Changes
runs-on: ubuntu-latest
outputs:
run_build_for_prs: ${{ steps.changes.outputs.run_build_for_prs }}
steps:
- uses: actions/checkout@v5
- name: Get changed files
id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
# We had issues that the release build was broken on main.
# With this we catch potential issues already in the PR.
ios-swift-release:
name: Release Build of iOS Swift
# Run the job only for PRs with related changes or non-PR events.
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: make init-ci-build
- run: make xcode-ci
- name: Run Fastlane
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
run: bundle exec fastlane build_ios_swift
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
build-sample:
name: Sample ${{ matrix.scheme }} ${{ matrix.config }}
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
strategy:
fail-fast: false
matrix:
# other sample projects are built in ui-tests
include:
- scheme: macOS-Swift
config: Debug
- scheme: watchOS-Swift WatchKit App
config: Debug
- scheme: macOS-SwiftUI
config: Debug
- scheme: SessionReplay-CameraTest
config: Debug
- scheme: visionOS-Swift
config: Debug
- scheme: iOS-Swift
config: DebugV9
- scheme: macOS-Swift
config: DebugV9
- scheme: tvOS-Swift
config: DebugV9
- scheme: visionOS-Swift
config: DebugV9
- scheme: iOS-SwiftUI
config: DebugV9
- scheme: iOS-ObjectiveC
config: DebugV9
- scheme: DistributionSample
config: Debug
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- run: make init-ci-build
- run: make xcode-ci
# Note: Due to complexity in implementing the CODE_SIGNING_ALLOWED flag in the sentry-xcodebuild.sh script,
# we did not yet migrate this step to use the script yet.
- run: >-
set -o pipefail && NSUnbufferedIO=YES xcodebuild
-workspace Sentry.xcworkspace
-scheme '${{matrix.scheme}}'
-configuration '${{matrix.config}}'
CODE_SIGNING_ALLOWED="NO"
build 2>&1
| tee raw-build-output.log
| xcbeautify --preserve-unbeautified
- name: Archiving Raw Build Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-build-output-scheme-${{matrix.scheme}}
path: |
raw-build-output.log
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
build-distribution:
name: Build the distribution framework
runs-on: macos-15
needs: files-changed
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
shell: sh
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
- run: set -o pipefail && NSUnbufferedIO=YES xcodebuild build -scheme SentryDistribution -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-build-output-spm.log | xcbeautify
shell: sh
- name: Upload SPM Build Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-build-output-spm
path: |
raw-build-output-spm.log
build-spm:
name: Build with SPM
runs-on: macos-15
# Don't run this on release branches, cause the SPM Package.swift points to the unreleased versions.
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true')
needs: files-changed
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
shell: sh
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
- run: set -o pipefail && NSUnbufferedIO=YES EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk watchos -destination 'generic/platform=watchOS' | tee raw-build-output-spm-watchos.log | xcbeautify
shell: sh
- run: set -o pipefail && NSUnbufferedIO=YES EXPERIMENTAL_SPM_BUILDS=1 xcodebuild build -scheme SentrySPM -sdk iphoneos -destination 'generic/platform=iphoneos' | tee raw-build-output-spm-iphoneos.log | xcbeautify
shell: sh
- name: Upload SPM Build Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-build-output-spm
path: |
raw-build-output-spm-watchos.log
raw-build-output-spm-iphoneos.log
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
build-v9:
name: Build SDK v9
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- run: |
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--command build \
--device "iPhone 16 Pro" \
--configuration DebugV9
- name: Archiving Raw Build Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-build-output-v9
path: |
raw-build-output.log
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
check-debug-without-UIKit:
name: Check no UIKit linkage (DebugWithoutUIKit)
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- name: Build for Debug
run: |
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--ref ${{ github.ref }} \
--command build \
--device "iPhone 16 Pro" \
--configuration DebugWithoutUIKit \
--derived-data uikit-check-build
- name: Ensure UIKit is not linked
run: ./scripts/check-uikit-linkage.sh DebugWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
check-release-without-UIKit:
name: Check no UIKit linkage (ReleaseWithoutUIKit)
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- name: Build for Release
run: |
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--ref ${{ github.ref }} \
--command build \
--device "iPhone 16 Pro" \
--configuration ReleaseWithoutUIKit \
--derived-data uikit-check-build
- name: Ensure UIKit is not linked
run: ./scripts/check-uikit-linkage.sh ReleaseWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
check-debug-with-UIKit:
name: Check UIKit linkage (Debug)
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- name: Build for Debug
run: |
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--ref ${{ github.ref }} \
--command build \
--device "iPhone 16 Pro" \
--configuration Debug \
--derived-data uikit-check-build
- name: Ensure UIKit is linked
run: ./scripts/check-uikit-linkage.sh Debug uikit-check-build linked Sentry
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
check-release-with-UIKit:
name: Check UIKit linkage (Release)
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci-select-xcode.sh 16.4
- name: Build for Release
run: |
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--ref ${{ github.ref }} \
--command build \
--device "iPhone 16 Pro" \
--configuration Release \
--derived-data uikit-check-build
- name: Ensure UIKit is linked
run: ./scripts/check-uikit-linkage.sh Release uikit-check-build linked Sentry
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
# The compiler only evaluates SentryAsyncSafeLogs that get printed based on the SENTRY_ASYNC_SAFE_LOG_LEVEL.
# So if the level is set to error, which is the default, and a SENTRY_ASYNC_SAFE_LOG_DEBUG has a compiler error,
# you only get the compiler error when setting the SENTRY_ASYNC_SAFE_LOG_LEVEL to SENTRY_ASYNC_SAFE_LOG_LEVEL_DEBUG or lower.
check-compiling-async-safe-logs:
name: Check compiling Async Safe Logs
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
needs: files-changed
runs-on: macos-15
steps:
- uses: actions/checkout@v5
# If the SentryAsyncSafeLog doesn't contain the SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR this fails.
- name: Async Safe Log Level is Error
run: grep -c "SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR" Sources/Sentry/SentryAsyncSafeLog.h
- name: Set Async Safe Log Level to Debug
run: |
sed -i '' 's/#define SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR/#define SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_TRACE/' Sources/Sentry/SentryAsyncSafeLog.h
shell: bash
- run: ./scripts/ci-select-xcode.sh 16.4
- name: Build for Debug
run: |
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--ref ${{ github.ref }} \
--command build \
--device "iPhone 16 Pro" \
--configuration Debug
- name: Debug Xcode environment
if: ${{ failure() || cancelled() }}
run: ./scripts/ci-diagnostics.sh
build-required-check:
needs:
[
files-changed,
ios-swift-release,
build-sample,
build-distribution,
build-spm,
build-v9,
check-debug-without-UIKit,
check-release-without-UIKit,
check-debug-with-UIKit,
check-release-with-UIKit,
check-compiling-async-safe-logs,
]
name: Build
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
if: always()
runs-on: ubuntu-latest
steps:
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
# Skipped jobs are not considered failures.
- name: Check for failures
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One of the build jobs has failed." && exit 1