55 - main
66
77 pull_request :
8- paths :
9- - " Sources/**"
10- - " Tests/**"
11- - " .github/workflows/ui-tests.yml"
12- - " .github/workflows/ui-tests-common.yml"
13- - " fastlane/**"
14- - " .sauce/config.yml"
15- - " scripts/ci-select-xcode.sh"
16- - " **/*.xctestplan"
17- - " Samples/iOS-SwiftUI/**"
18- - " Samples/iOS-Swift/**"
19- - " Samples/iOS-Swift6/**"
20- - " Samples/SentrySampleShared/**"
21- - " Samples/Shared/**"
22- - " scripts/build-xcframework-slice.sh"
23- - " scripts/assemble-xcframework.sh"
24- - " .github/workflows/build-xcframework-variant-slices.yml"
25- - " .github/workflows/assemble-xcframework-variant.yml"
26- - " Makefile" # Make commands used for UI test environment setup
27- - " Brewfile*" # Dependency installation affects UI test environment
288
299# Concurrency configuration:
3010# - We use workflow-specific concurrency groups to prevent multiple UI test runs on the same code,
@@ -38,7 +18,23 @@ concurrency:
3818 cancel-in-progress : ${{ github.event_name == 'pull_request' }}
3919
4020jobs :
21+ files-changed :
22+ name : Detect File Changes
23+ runs-on : ubuntu-latest
24+ outputs :
25+ run_ui_tests_for_prs : ${{ steps.changes.outputs.run_ui_tests_for_prs }}
26+ steps :
27+ - uses : actions/checkout@v5
28+ - name : Get changed files
29+ id : changes
30+ uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
31+ with :
32+ token : ${{ github.token }}
33+ filters : .github/file-filters.yml
34+
4135 ui-tests :
36+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
37+ needs : files-changed
4238 name : Test ${{matrix.name}} V3 # Up the version with every change to keep track of flaky tests
4339 uses : ./.github/workflows/ui-tests-common.yml
4440 strategy :
5955
6056 # SwiftUI only supports iOS 14+ so we run it in a separate matrix here
6157 ui-tests-swift-ui :
58+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
59+ needs : files-changed
6260 name : Test SwiftUI V4 # Up the version with every change to keep track of flaky tests
6361 uses : ./.github/workflows/ui-tests-common.yml
6462 with :
7270 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
7371
7472 ui-tests-swift :
73+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
74+ needs : files-changed
7575 name : Test Swift ${{matrix.name}} V5 # Up the version with every change to keep track of flaky tests
7676 uses : ./.github/workflows/ui-tests-common.yml
7777 strategy :
@@ -102,6 +102,8 @@ jobs:
102102 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
103103
104104 ui-tests-swift6 :
105+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_ui_tests_for_prs == 'true'
106+ needs : files-changed
105107 name : Test iOS Swift6 V3 # Up the version with every change to keep track of flaky tests
106108 uses : ./.github/workflows/ui-tests-common.yml
107109 with :
@@ -113,3 +115,27 @@ jobs:
113115 codecov_test_analytics : true
114116 secrets :
115117 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
118+
119+ # This check validates that either UI tests passed or were skipped, which allows us
120+ # to make UI tests a required check with only running the UI tests when required.
121+ # So, we don't have to run UI tests, for example, for unrelated changes.
122+ ui_tests-required-check :
123+ needs :
124+ [
125+ files-changed,
126+ ui-tests,
127+ ui-tests-swift-ui,
128+ ui-tests-swift,
129+ ui-tests-swift6,
130+ ]
131+ name : UI Tests
132+ # This is necessary since a failed/skipped dependent job would cause this job to be skipped
133+ if : always()
134+ runs-on : ubuntu-latest
135+ steps :
136+ # If any jobs we depend on fails gets cancelled or times out, this job will fail.
137+ # Skipped jobs are not considered failures.
138+ - name : Check for failures
139+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
140+ run : |
141+ echo "One of the UI test jobs has failed." && exit 1
0 commit comments