Skip to content

Commit 9972c54

Browse files
committed
Detect changes to sample apps
1 parent aa5d8a7 commit 9972c54

File tree

4 files changed

+88
-39
lines changed

4 files changed

+88
-39
lines changed

.github/file-filters.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,19 @@ high_risk_code: &high_risk_code
2020
# --- Platform-specific filters for CI optimization ---
2121
# Used by detect-changes.yml to skip platform-irrelevant CI jobs.
2222

23-
# Changes that affect iOS native code
23+
# Changes to the SDK's iOS native code only (packages/core).
24+
# Does NOT include sample apps — sample changes have their own filters below.
2425
ios_native:
2526
- 'packages/core/ios/**'
2627
- 'packages/core/RNSentryCocoaTester/**'
2728
- 'packages/core/RNSentry.podspec'
28-
- 'samples/react-native/ios/**'
29-
- 'samples/react-native/scripts/*ios*'
30-
- 'samples/react-native/scripts/pod-install.sh'
31-
- 'samples/react-native/Gemfile'
32-
- 'samples/react-native-macos/**'
33-
- 'samples/expo/ios/**'
3429

35-
# Changes that affect Android native code
30+
# Changes to the SDK's Android native code only (packages/core).
31+
# Does NOT include sample apps — sample changes have their own filters below.
3632
android_native:
3733
- 'packages/core/android/**'
3834
- 'packages/core/RNSentryAndroidTester/**'
3935
- 'packages/core/sentry.gradle'
40-
- 'samples/react-native/android/**'
41-
- 'samples/react-native/scripts/*android*'
42-
- 'samples/expo/android/**'
4336

4437
# Changes to JS/TS source code (affects ALL platforms)
4538
js_source:
@@ -53,6 +46,19 @@ js_source:
5346
js_test:
5447
- 'packages/core/test/**'
5548

49+
# Changes to the React Native sample app.
50+
# Triggers: sample-application.yml, buildandtest.yml (job_bundle).
51+
# Does NOT trigger: native-tests.yml, e2e-v2.yml, sample-application-expo.yml.
52+
sample_react_native:
53+
- 'samples/react-native/**'
54+
- 'samples/react-native-macos/**'
55+
56+
# Changes to the Expo sample app.
57+
# Triggers: sample-application-expo.yml only.
58+
# Does NOT trigger: native-tests.yml, e2e-v2.yml, sample-application.yml.
59+
sample_expo:
60+
- 'samples/expo/**'
61+
5662
# Changes to E2E test infrastructure
5763
e2e_tests:
5864
- 'dev-packages/e2e-tests/**'

.github/workflows/detect-changes.yml

Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,47 @@ on:
1414
required: true
1515
type: string
1616
outputs:
17-
# Raw filter outputs
17+
# Raw filter outputs — exposed for fine-grained use by callers
1818
ios_native:
19-
description: 'Whether iOS native files changed'
19+
description: 'Whether SDK iOS native files changed'
2020
value: ${{ jobs.changes.outputs.ios_native }}
2121
android_native:
22-
description: 'Whether Android native files changed'
22+
description: 'Whether SDK Android native files changed'
2323
value: ${{ jobs.changes.outputs.android_native }}
2424
js_source:
2525
description: 'Whether JS/TS source files changed'
2626
value: ${{ jobs.changes.outputs.js_source }}
2727
js_test:
2828
description: 'Whether JS/TS test files changed'
2929
value: ${{ jobs.changes.outputs.js_test }}
30+
sample_react_native:
31+
description: 'Whether the React Native sample app changed'
32+
value: ${{ jobs.changes.outputs.sample_react_native }}
33+
sample_expo:
34+
description: 'Whether the Expo sample app changed'
35+
value: ${{ jobs.changes.outputs.sample_expo }}
3036
e2e_tests:
31-
description: 'Whether E2E test files changed'
37+
description: 'Whether E2E test infrastructure changed'
3238
value: ${{ jobs.changes.outputs.e2e_tests }}
3339
perf_tests:
34-
description: 'Whether performance test files changed'
40+
description: 'Whether performance test infrastructure changed'
3541
value: ${{ jobs.changes.outputs.perf_tests }}
3642
ci:
37-
description: 'Whether CI workflow files changed'
43+
description: 'Whether CI workflow/action files changed'
3844
value: ${{ jobs.changes.outputs.ci }}
39-
# Convenience: should iOS-related jobs run?
45+
# Convenience outputs consumed by individual workflows
4046
needs_ios:
41-
description: 'Whether iOS jobs should run'
47+
description: 'Whether iOS jobs should run (native tests, E2E, sample builds)'
4248
value: ${{ jobs.changes.outputs.needs_ios }}
43-
# Convenience: should Android-related jobs run?
4449
needs_android:
45-
description: 'Whether Android jobs should run'
50+
description: 'Whether Android jobs should run (native tests, E2E, sample builds)'
4651
value: ${{ jobs.changes.outputs.needs_android }}
52+
needs_sample_react_native:
53+
description: 'Whether the React Native sample app workflow should run'
54+
value: ${{ jobs.changes.outputs.needs_sample_react_native }}
55+
needs_sample_expo:
56+
description: 'Whether the Expo sample app workflow should run'
57+
value: ${{ jobs.changes.outputs.needs_sample_expo }}
4758

4859
jobs:
4960
changes:
@@ -54,11 +65,15 @@ jobs:
5465
android_native: ${{ steps.filter.outputs.android_native }}
5566
js_source: ${{ steps.filter.outputs.js_source }}
5667
js_test: ${{ steps.filter.outputs.js_test }}
68+
sample_react_native: ${{ steps.filter.outputs.sample_react_native }}
69+
sample_expo: ${{ steps.filter.outputs.sample_expo }}
5770
e2e_tests: ${{ steps.filter.outputs.e2e_tests }}
5871
perf_tests: ${{ steps.filter.outputs.perf_tests }}
5972
ci: ${{ steps.filter.outputs.ci }}
6073
needs_ios: ${{ steps.evaluate.outputs.needs_ios }}
6174
needs_android: ${{ steps.evaluate.outputs.needs_android }}
75+
needs_sample_react_native: ${{ steps.evaluate.outputs.needs_sample_react_native }}
76+
needs_sample_expo: ${{ steps.evaluate.outputs.needs_sample_expo }}
6277
steps:
6378
- uses: actions/checkout@v4
6479

@@ -68,12 +83,14 @@ jobs:
6883
with:
6984
filters: .github/file-filters.yml
7085

71-
- name: Evaluate platform needs
86+
- name: Evaluate what needs to run
7287
id: evaluate
7388
env:
7489
IOS_NATIVE: ${{ steps.filter.outputs.ios_native }}
7590
ANDROID_NATIVE: ${{ steps.filter.outputs.android_native }}
7691
JS_SOURCE: ${{ steps.filter.outputs.js_source }}
92+
SAMPLE_RN: ${{ steps.filter.outputs.sample_react_native }}
93+
SAMPLE_EXPO: ${{ steps.filter.outputs.sample_expo }}
7794
CI_CHANGED: ${{ steps.filter.outputs.ci }}
7895
E2E_TESTS: ${{ steps.filter.outputs.e2e_tests }}
7996
IS_MAIN_OR_RELEASE: ${{ inputs.caller_event_name == 'push' && (inputs.caller_ref == 'refs/heads/main' || startsWith(inputs.caller_ref, 'refs/heads/release/')) }}
@@ -82,18 +99,22 @@ jobs:
8299
echo "ios_native=$IOS_NATIVE"
83100
echo "android_native=$ANDROID_NATIVE"
84101
echo "js_source=$JS_SOURCE"
102+
echo "sample_react_native=$SAMPLE_RN"
103+
echo "sample_expo=$SAMPLE_EXPO"
85104
echo "ci=$CI_CHANGED"
86105
echo "e2e_tests=$E2E_TESTS"
87106
echo "is_main_or_release=$IS_MAIN_OR_RELEASE"
88107
89-
# iOS is needed if:
90-
# - iOS native code changed
108+
# iOS/Android native test suites and E2E builds run when:
109+
# - The SDK's own native code changed (packages/core/ios or android)
91110
# - JS source changed (may affect native bridges)
92-
# - CI config changed (need to validate workflows)
93-
# - E2E tests changed (they test both platforms end-to-end)
111+
# - CI config changed (need to validate workflows themselves)
112+
# - E2E test infra changed (they test both platforms end-to-end)
94113
# - Push to main or release branch (always run everything)
95-
# Note: perf_tests changes only affect the `metrics` job in e2e-v2.yml,
96-
# not the native test suites or sample app builds.
114+
# Sample app changes do NOT trigger the full native test suite —
115+
# they only trigger their own sample-application workflows.
116+
# Performance test changes do NOT trigger native tests either —
117+
# they only trigger the metrics job in e2e-v2.yml.
97118
if [[ "$IOS_NATIVE" == "true" \
98119
|| "$JS_SOURCE" == "true" \
99120
|| "$CI_CHANGED" == "true" \
@@ -106,14 +127,6 @@ jobs:
106127
echo "=> needs_ios=false"
107128
fi
108129
109-
# Android is needed if:
110-
# - Android native code changed
111-
# - JS source changed (may affect native bridges)
112-
# - CI config changed (need to validate workflows)
113-
# - E2E tests changed (they test both platforms end-to-end)
114-
# - Push to main or release branch (always run everything)
115-
# Note: perf_tests changes only affect the `metrics` job in e2e-v2.yml,
116-
# not the native test suites or sample app builds.
117130
if [[ "$ANDROID_NATIVE" == "true" \
118131
|| "$JS_SOURCE" == "true" \
119132
|| "$CI_CHANGED" == "true" \
@@ -125,3 +138,33 @@ jobs:
125138
echo "needs_android=false" >> "$GITHUB_OUTPUT"
126139
echo "=> needs_android=false"
127140
fi
141+
142+
# React Native sample workflow runs when the RN sample itself changed,
143+
# or when anything that the sample depends on changed (SDK source, CI).
144+
if [[ "$SAMPLE_RN" == "true" \
145+
|| "$JS_SOURCE" == "true" \
146+
|| "$IOS_NATIVE" == "true" \
147+
|| "$ANDROID_NATIVE" == "true" \
148+
|| "$CI_CHANGED" == "true" \
149+
|| "$IS_MAIN_OR_RELEASE" == "true" ]]; then
150+
echo "needs_sample_react_native=true" >> "$GITHUB_OUTPUT"
151+
echo "=> needs_sample_react_native=true"
152+
else
153+
echo "needs_sample_react_native=false" >> "$GITHUB_OUTPUT"
154+
echo "=> needs_sample_react_native=false"
155+
fi
156+
157+
# Expo sample workflow runs when the Expo sample itself changed,
158+
# or when anything that the sample depends on changed (SDK source, CI).
159+
if [[ "$SAMPLE_EXPO" == "true" \
160+
|| "$JS_SOURCE" == "true" \
161+
|| "$IOS_NATIVE" == "true" \
162+
|| "$ANDROID_NATIVE" == "true" \
163+
|| "$CI_CHANGED" == "true" \
164+
|| "$IS_MAIN_OR_RELEASE" == "true" ]]; then
165+
echo "needs_sample_expo=true" >> "$GITHUB_OUTPUT"
166+
echo "=> needs_sample_expo=true"
167+
else
168+
echo "needs_sample_expo=false" >> "$GITHUB_OUTPUT"
169+
echo "=> needs_sample_expo=false"
170+
fi

.github/workflows/sample-application-expo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
name: Build ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}}
3939
runs-on: ${{ matrix.runs-on }}
4040
needs: [diff_check, detect-changes]
41-
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
41+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && needs.detect-changes.outputs.needs_sample_expo == 'true' }}
4242
env:
4343
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
4444
strategy:

.github/workflows/sample-application.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}}
4747
runs-on: ${{ matrix.runs-on }}
4848
needs: [diff_check, detect-changes]
49-
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
49+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && needs.detect-changes.outputs.needs_sample_react_native == 'true' }}
5050
env:
5151
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
5252
strategy:
@@ -238,7 +238,7 @@ jobs:
238238
name: Test ${{ matrix.platform }} ${{ matrix.build-type }} REV2
239239
runs-on: ${{ matrix.runs-on }}
240240
needs: [diff_check, detect-changes, build]
241-
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
241+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && needs.detect-changes.outputs.needs_sample_react_native == 'true' }}
242242
strategy:
243243
# we want that the matrix keeps running, default is to cancel them if it fails.
244244
fail-fast: false

0 commit comments

Comments
 (0)