77 - main
88
99 pull_request :
10- paths :
11- - " Sources/**"
12- - " scripts/ci-select-xcode.sh"
13- - " scripts/ci-diagnostics.sh"
14- - Sentry.xcworkspace/**
15- - Sentry.xcodeproj/**
16- - " Package*.swift"
17- - " .github/workflows/build-xcframework.yml"
18- - " scripts/build-xcframework-slice.sh"
19- - " scripts/assemble-xcframework.sh"
20- - " .github/workflows/release.yml"
21- - " .github/workflows/build-xcframework-variant-slices.yml"
22- - " .github/workflows/assemble-xcframework-variant.yml"
23- - " .github/workflows/ui-tests-common.yml"
24- - Samples/macOS-SPM-CommandLine/**
25- - Samples/SPM-Dynamic/**
2610
2711 workflow_dispatch :
2812 inputs :
@@ -48,8 +32,25 @@ concurrency:
4832 cancel-in-progress : ${{ github.event_name == 'pull_request' }}
4933
5034jobs :
35+ files-changed :
36+ name : Detect File Changes
37+ runs-on : ubuntu-latest
38+ outputs :
39+ run_release_for_prs : ${{ steps.changes.outputs.run_release_for_prs }}
40+ steps :
41+ - uses : actions/checkout@v5
42+ - name : Get changed files
43+ id : changes
44+ uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
45+ with :
46+ token : ${{ github.token }}
47+ filters : .github/file-filters.yml
48+
5149 build-xcframework-variant-slices :
5250 name : Build XCFramework Slices
51+ # Run the job only for PRs with related changes or non-PR events.
52+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
53+ needs : files-changed
5354 uses : ./.github/workflows/build-xcframework-variant-slices.yml
5455 with :
5556 name : ${{matrix.variant.name}}
7879 id : sentry-withoutuikit-dynamic
7980
8081 assemble-xcframework-variant :
81- needs : build-xcframework-variant-slices
82+ needs : [files-changed, build-xcframework-variant-slices]
83+ # Run the job only for PRs with related changes or non-PR events.
84+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
8285 name : Assemble XCFramework Variant
8386 uses : ./.github/workflows/assemble-xcframework-variant.yml
8487 secrets : inherit
@@ -126,7 +129,9 @@ jobs:
126129 validate-xcframework :
127130 name : Validate XCFramework
128131 runs-on : macos-14
129- needs : assemble-xcframework-variant
132+ needs : [files-changed, assemble-xcframework-variant]
133+ # Run the job only for PRs with related changes or non-PR events.
134+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
130135 steps :
131136 - uses : actions/checkout@v5
132137 - uses : actions/download-artifact@v5
@@ -149,7 +154,9 @@ jobs:
149154 validate-spm :
150155 name : Validate SPM Static ${{matrix.package-file.name}}
151156 runs-on : macos-14
152- needs : assemble-xcframework-variant
157+ needs : [files-changed, assemble-xcframework-variant]
158+ # Run the job only for PRs with related changes or non-PR events.
159+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
153160 steps :
154161 - uses : actions/checkout@v5
155162 - uses : actions/download-artifact@v5
@@ -180,7 +187,9 @@ jobs:
180187 validate-spm-dynamic :
181188 name : Validate SPM Dynamic ${{matrix.package-file.name}}
182189 runs-on : macos-14
183- needs : assemble-xcframework-variant
190+ needs : [files-changed, assemble-xcframework-variant]
191+ # Run the job only for PRs with related changes or non-PR events.
192+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
184193 steps :
185194 - uses : actions/checkout@v5
186195 - uses : actions/download-artifact@v5
@@ -211,7 +220,9 @@ jobs:
211220 swift-build :
212221 name : Build Swift Static ${{matrix.package-file.name}}
213222 runs-on : macos-14
214- needs : assemble-xcframework-variant
223+ needs : [files-changed, assemble-xcframework-variant]
224+ # Run the job only for PRs with related changes or non-PR events.
225+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
215226 steps :
216227 - uses : actions/checkout@v5
217228 - uses : actions/download-artifact@v5
@@ -241,7 +252,9 @@ jobs:
241252 duplication-tests :
242253 name : Test Sentry Duplication V4 # Up the version with every change to keep track of flaky tests
243254 uses : ./.github/workflows/ui-tests-common.yml
244- needs : assemble-xcframework-variant
255+ needs : [files-changed, assemble-xcframework-variant]
256+ # Run the job only for PRs with related changes or non-PR events.
257+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
245258 secrets :
246259 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
247260 with :
@@ -253,7 +266,9 @@ jobs:
253266 app-metrics :
254267 name : Collect App Metrics
255268 runs-on : macos-15
256- needs : assemble-xcframework-variant
269+ needs : [files-changed, assemble-xcframework-variant]
270+ # Run the job only for PRs with related changes or non-PR events.
271+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_release_for_prs == 'true'
257272 timeout-minutes : 20
258273 steps :
259274 - name : Git checkout
@@ -307,6 +322,7 @@ jobs:
307322 runs-on : ubuntu-latest
308323 name : " Release New Version"
309324 needs : [
325+ files-changed,
310326 validate-xcframework,
311327 validate-spm,
312328 validate-spm-dynamic,
@@ -361,3 +377,28 @@ jobs:
361377 - name : Run CI Diagnostics
362378 if : failure()
363379 run : ./scripts/ci-diagnostics.sh
380+
381+ release-required-check :
382+ needs :
383+ [
384+ files-changed,
385+ build-xcframework-variant-slices,
386+ assemble-xcframework-variant,
387+ validate-xcframework,
388+ validate-spm,
389+ validate-spm-dynamic,
390+ swift-build,
391+ duplication-tests,
392+ app-metrics,
393+ ]
394+ name : Release
395+ # This is necessary since a failed/skipped dependent job would cause this job to be skipped
396+ if : always()
397+ runs-on : ubuntu-latest
398+ steps :
399+ # If any jobs we depend on fails gets cancelled or times out, this job will fail.
400+ # Skipped jobs are not considered failures.
401+ - name : Check for failures
402+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
403+ run : |
404+ echo "One of the release check jobs has failed." && exit 1
0 commit comments