6
6
- release/**
7
7
8
8
pull_request :
9
- paths :
10
- - " Sources/**"
11
- - " test-server/**"
12
- - " Samples/**"
13
- - " .github/workflows/build.yml"
14
- - " fastlane/**"
15
- - " scripts/ci-select-xcode.sh"
16
- - " scripts/ci-diagnostics.sh"
17
- - Sentry.xcworkspace/**
18
- - Sentry.xcodeproj/**
19
- - Gemfile.lock
20
- - " Package*.swift"
21
- - " Makefile" # Make commands used for CI build setup
22
- - " Brewfile*" # Dependency installation affects build environment
23
9
24
10
# Concurrency configuration:
25
11
# - We use workflow-specific concurrency groups to prevent multiple build runs of the same code,
@@ -33,10 +19,27 @@ concurrency:
33
19
cancel-in-progress : ${{ github.event_name == 'pull_request' }}
34
20
35
21
jobs :
22
+ files-changed :
23
+ name : Detect File Changes
24
+ runs-on : ubuntu-latest
25
+ outputs :
26
+ run_build_for_prs : ${{ steps.changes.outputs.run_build_for_prs }}
27
+ steps :
28
+ - uses : actions/checkout@v5
29
+ - name : Get changed files
30
+ id : changes
31
+ uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32
+ with :
33
+ token : ${{ github.token }}
34
+ filters : .github/file-filters.yml
35
+
36
36
# We had issues that the release build was broken on main.
37
37
# With this we catch potential issues already in the PR.
38
38
ios-swift-release :
39
39
name : Release Build of iOS Swift
40
+ # Run the job only for PRs with related changes or non-PR events.
41
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
42
+ needs : files-changed
40
43
runs-on : macos-15
41
44
steps :
42
45
- uses : actions/checkout@v5
63
66
64
67
build-sample :
65
68
name : Sample ${{ matrix.scheme }} ${{ matrix.config }}
69
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
70
+ needs : files-changed
66
71
runs-on : macos-15
67
72
strategy :
68
73
fail-fast : false
@@ -127,7 +132,8 @@ jobs:
127
132
name : Build with SPM
128
133
runs-on : macos-15
129
134
# Don't run this on release branches, cause the SPM Package.swift points to the unreleased versions.
130
- if : startsWith(github.ref, 'refs/heads/release/') == false
135
+ if : startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true')
136
+ needs : files-changed
131
137
steps :
132
138
- uses : actions/checkout@v5
133
139
@@ -154,6 +160,8 @@ jobs:
154
160
155
161
build-v9 :
156
162
name : Build SDK v9
163
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
164
+ needs : files-changed
157
165
runs-on : macos-15
158
166
steps :
159
167
- uses : actions/checkout@v5
@@ -178,6 +186,8 @@ jobs:
178
186
179
187
check-debug-without-UIKit :
180
188
name : Check no UIKit linkage (DebugWithoutUIKit)
189
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
190
+ needs : files-changed
181
191
runs-on : macos-14
182
192
steps :
183
193
- uses : actions/checkout@v5
@@ -201,6 +211,8 @@ jobs:
201
211
202
212
check-release-without-UIKit :
203
213
name : Check no UIKit linkage (ReleaseWithoutUIKit)
214
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
215
+ needs : files-changed
204
216
runs-on : macos-14
205
217
steps :
206
218
- uses : actions/checkout@v5
@@ -224,6 +236,8 @@ jobs:
224
236
225
237
check-debug-with-UIKit :
226
238
name : Check UIKit linkage (Debug)
239
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
240
+ needs : files-changed
227
241
runs-on : macos-14
228
242
steps :
229
243
- uses : actions/checkout@v5
@@ -247,6 +261,8 @@ jobs:
247
261
248
262
check-release-with-UIKit :
249
263
name : Check UIKit linkage (Release)
264
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
265
+ needs : files-changed
250
266
runs-on : macos-14
251
267
steps :
252
268
- uses : actions/checkout@v5
@@ -274,6 +290,8 @@ jobs:
274
290
275
291
check-compiling-async-safe-logs :
276
292
name : Check compiling Async Safe Logs
293
+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_build_for_prs == 'true'
294
+ needs : files-changed
277
295
runs-on : macos-15
278
296
steps :
279
297
- uses : actions/checkout@v5
@@ -302,3 +320,29 @@ jobs:
302
320
- name : Debug Xcode environment
303
321
if : ${{ failure() || cancelled() }}
304
322
run : ./scripts/ci-diagnostics.sh
323
+
324
+ build-required-check :
325
+ needs :
326
+ [
327
+ files-changed,
328
+ ios-swift-release,
329
+ build-sample,
330
+ build-spm,
331
+ build-v9,
332
+ check-debug-without-UIKit,
333
+ check-release-without-UIKit,
334
+ check-debug-with-UIKit,
335
+ check-release-with-UIKit,
336
+ check-compiling-async-safe-logs,
337
+ ]
338
+ name : Build
339
+ # This is necessary since a failed/skipped dependent job would cause this job to be skipped
340
+ if : always()
341
+ runs-on : ubuntu-latest
342
+ steps :
343
+ # If any jobs we depend on fails gets cancelled or times out, this job will fail.
344
+ # Skipped jobs are not considered failures.
345
+ - name : Check for failures
346
+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
347
+ run : |
348
+ echo "One of the build jobs has failed." && exit 1
0 commit comments