Skip to content

Commit d157d83

Browse files
authored
chore(ci): Add required checks for benchmarking (#5996)
1 parent d66f082 commit d157d83

File tree

2 files changed

+69
-20
lines changed

2 files changed

+69
-20
lines changed

.github/file-filters.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,32 @@ run_api_stability_for_prs: &run_api_stability_for_prs # API-related code
6565
- "sdk_api.json"
6666
- "sdk_api_v9.json"
6767

68+
run_benchmarking_for_prs: &run_benchmarking_for_prs
69+
- "Sources/**"
70+
71+
# Benchmarking implementation
72+
- "Samples/iOS-Swift/**"
73+
- ".sauce/benchmarking-config.yml"
74+
- "fastlane/**"
75+
76+
# GH Actions
77+
- ".github/workflows/benchmarking.yml"
78+
- ".github/workflows/build-xcframework-variant-slices.yml"
79+
- ".github/workflows/assemble-xcframework-variant.yml"
80+
- ".github/file-filters.yml"
81+
82+
# Scripts
83+
- "scripts/ci-select-xcode.sh"
84+
- "scripts/ci-diagnostics.sh"
85+
- "scripts/build-xcframework-slice.sh"
86+
- "scripts/assemble-xcframework.sh"
87+
88+
# Project files
89+
- "Samples/iOS-Swift/iOS-Swift.yml"
90+
- "Samples/iOS-Swift/iOS-Swift.xcconfig"
91+
- "Samples/iOS-Swift/iOS-SwiftClip.xcconfig"
92+
- "Samples/iOS-Swift/iOS-Benchmarking.xcconfig"
93+
6894
run_test_cross_platform_for_prs: &run_test_cross_platform_for_prs
6995
- "Sources/**"
7096

.github/workflows/benchmarking.yml

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,6 @@ on:
55
- main
66

77
pull_request:
8-
paths:
9-
# test changes to Sentry SDK sources
10-
- "Sources/**"
11-
12-
# test changes to benchmarking implementation
13-
- "Samples/iOS-Swift/**"
14-
- ".github/workflows/benchmarking.yml"
15-
- ".sauce/benchmarking-config.yml"
16-
- "fastlane/**"
17-
- "scripts/ci-select-xcode.sh"
18-
- "scripts/ci-diagnostics.sh"
19-
- "Samples/iOS-Swift/iOS-Swift.yml"
20-
- "Samples/iOS-Swift/iOS-Swift.xcconfig"
21-
- "Samples/iOS-Swift/iOS-SwiftClip.xcconfig"
22-
- "Samples/iOS-Swift/iOS-Benchmarking.xcconfig"
23-
- "scripts/build-xcframework-slice.sh"
24-
- "scripts/assemble-xcframework.sh"
25-
- ".github/workflows/build-xcframework-variant-slices.yml"
26-
- ".github/workflows/assemble-xcframework-variant.yml"
278

289
# Concurrency configuration:
2910
# - We use workflow-specific concurrency groups to prevent multiple benchmark runs on the same code,
@@ -37,8 +18,25 @@ concurrency:
3718
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3819

3920
jobs:
21+
files-changed:
22+
name: Detect File Changes
23+
runs-on: ubuntu-latest
24+
outputs:
25+
run_benchmarking_for_prs: ${{ steps.changes.outputs.run_benchmarking_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+
4035
build-benchmark-test-target:
4136
name: Build App and Test Runner
37+
# Run the job only for PRs with related changes or non-PR events.
38+
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_benchmarking_for_prs == 'true'
39+
needs: files-changed
4240
runs-on: macos-14
4341
steps:
4442
- uses: actions/checkout@v5
@@ -104,8 +102,14 @@ jobs:
104102

105103
run-ui-tests-with-sauce:
106104
name: Run Benchmarks ${{matrix.suite}}
105+
# Run the job only for PRs with related changes or non-PR events.
106+
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_benchmarking_for_prs == 'true'
107107
runs-on: ubuntu-latest
108-
needs: build-benchmark-test-target
108+
needs:
109+
[
110+
files-changed,
111+
build-benchmark-test-target,
112+
]
109113
strategy:
110114
fail-fast: false
111115
matrix:
@@ -195,3 +199,22 @@ jobs:
195199
- name: Run CI Diagnostics
196200
if: failure()
197201
run: ./scripts/ci-diagnostics.sh
202+
203+
benchmarking-required-check:
204+
needs:
205+
[
206+
files-changed,
207+
build-benchmark-test-target,
208+
run-ui-tests-with-sauce,
209+
]
210+
name: Benchmarking
211+
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
212+
if: always()
213+
runs-on: ubuntu-latest
214+
steps:
215+
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
216+
# Skipped jobs are not considered failures.
217+
- name: Check for failures
218+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
219+
run: |
220+
echo "One of the benchmark jobs has failed." && exit 1

0 commit comments

Comments
 (0)