Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,59 @@ high_risk_code: &high_risk_code
- 'scripts/sentry-xcode.sh'
- 'scripts/sentry-xcode-debug-files.sh'
- 'sentry.gradle'


# --- Platform-specific filters for CI optimization ---
# Used by detect-changes.yml to skip platform-irrelevant CI jobs.

# Changes to the SDK's iOS native code only (packages/core).
# Does NOT include sample apps β€” sample changes have their own filters below.
ios_native:
- 'packages/core/ios/**'
- 'packages/core/RNSentryCocoaTester/**'
- 'packages/core/RNSentry.podspec'

# Changes to the SDK's Android native code only (packages/core).
# Does NOT include sample apps β€” sample changes have their own filters below.
android_native:
- 'packages/core/android/**'
- 'packages/core/RNSentryAndroidTester/**'
- 'packages/core/sentry.gradle'

# Changes to JS/TS source code (affects ALL platforms)
js_source:
- 'packages/core/src/**'
- 'packages/core/plugin/**'
- 'packages/core/scripts/**'
- 'packages/core/package.json'
- 'packages/core/tsconfig.json'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No filter matches yarn.lock, root package.json, or .yarnrc.yml. A lockfile-only PR would have all detect-changes outputs as false, skipping all jobs.

Suggested change
- 'packages/core/tsconfig.json'
- 'packages/core/tsconfig.json'
- 'yarn.lock'
- 'package.json'
- '.yarnrc.yml'


# Changes to JS/TS test files only
js_test:
- 'packages/core/test/**'

# Changes to the React Native sample app.
# Triggers: sample-application.yml, buildandtest.yml (job_bundle).
# Does NOT trigger: native-tests.yml, e2e-v2.yml, sample-application-expo.yml.
sample_react_native:
- 'samples/react-native/**'
- 'samples/react-native-macos/**'

# Changes to the Expo sample app.
# Triggers: sample-application-expo.yml only.
# Does NOT trigger: native-tests.yml, e2e-v2.yml, sample-application.yml.
sample_expo:
- 'samples/expo/**'

# Changes to E2E test infrastructure
e2e_tests:
- 'dev-packages/e2e-tests/**'

# Changes to performance test infrastructure
perf_tests:
- 'performance-tests/**'

# CI workflow or infrastructure changes (should trigger everything)
ci:
- '.github/workflows/**'
- '.github/actions/**'
- '.github/file-filters.yml'
170 changes: 170 additions & 0 deletions .github/workflows/detect-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Detect Changes
on:
workflow_call:
inputs:
# Pass the caller's event name and ref so we can detect push-to-main/release.
# Inside a reusable workflow github.event_name is always 'workflow_call',
# so the caller must forward the real values explicitly.
caller_event_name:
description: 'The triggering event name from the caller (github.event_name)'
required: true
type: string
caller_ref:
description: 'The triggering ref from the caller (github.ref)'
required: true
type: string
outputs:
# Raw filter outputs β€” exposed for fine-grained use by callers
ios_native:
description: 'Whether SDK iOS native files changed'
value: ${{ jobs.changes.outputs.ios_native }}
android_native:
description: 'Whether SDK Android native files changed'
value: ${{ jobs.changes.outputs.android_native }}
js_source:
description: 'Whether JS/TS source files changed'
value: ${{ jobs.changes.outputs.js_source }}
js_test:
description: 'Whether JS/TS test files changed'
value: ${{ jobs.changes.outputs.js_test }}
sample_react_native:
description: 'Whether the React Native sample app changed'
value: ${{ jobs.changes.outputs.sample_react_native }}
sample_expo:
description: 'Whether the Expo sample app changed'
value: ${{ jobs.changes.outputs.sample_expo }}
e2e_tests:
description: 'Whether E2E test infrastructure changed'
value: ${{ jobs.changes.outputs.e2e_tests }}
perf_tests:
description: 'Whether performance test infrastructure changed'
value: ${{ jobs.changes.outputs.perf_tests }}
ci:
description: 'Whether CI workflow/action files changed'
value: ${{ jobs.changes.outputs.ci }}
# Convenience outputs consumed by individual workflows
needs_ios:
description: 'Whether iOS jobs should run (native tests, E2E, sample builds)'
value: ${{ jobs.changes.outputs.needs_ios }}
needs_android:
description: 'Whether Android jobs should run (native tests, E2E, sample builds)'
value: ${{ jobs.changes.outputs.needs_android }}
needs_sample_react_native:
description: 'Whether the React Native sample app workflow should run'
value: ${{ jobs.changes.outputs.needs_sample_react_native }}
needs_sample_expo:
description: 'Whether the Expo sample app workflow should run'
value: ${{ jobs.changes.outputs.needs_sample_expo }}

jobs:
changes:
name: Detect file changes
runs-on: ubuntu-latest
outputs:
ios_native: ${{ steps.filter.outputs.ios_native }}
android_native: ${{ steps.filter.outputs.android_native }}
js_source: ${{ steps.filter.outputs.js_source }}
js_test: ${{ steps.filter.outputs.js_test }}
sample_react_native: ${{ steps.filter.outputs.sample_react_native }}
sample_expo: ${{ steps.filter.outputs.sample_expo }}
e2e_tests: ${{ steps.filter.outputs.e2e_tests }}
perf_tests: ${{ steps.filter.outputs.perf_tests }}
ci: ${{ steps.filter.outputs.ci }}
needs_ios: ${{ steps.evaluate.outputs.needs_ios }}
needs_android: ${{ steps.evaluate.outputs.needs_android }}
needs_sample_react_native: ${{ steps.evaluate.outputs.needs_sample_react_native }}
needs_sample_expo: ${{ steps.evaluate.outputs.needs_sample_expo }}
steps:
- uses: actions/checkout@v4

- name: Detect changed paths
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: .github/file-filters.yml

- name: Evaluate what needs to run
id: evaluate
env:
IOS_NATIVE: ${{ steps.filter.outputs.ios_native }}
ANDROID_NATIVE: ${{ steps.filter.outputs.android_native }}
JS_SOURCE: ${{ steps.filter.outputs.js_source }}
SAMPLE_RN: ${{ steps.filter.outputs.sample_react_native }}
SAMPLE_EXPO: ${{ steps.filter.outputs.sample_expo }}
CI_CHANGED: ${{ steps.filter.outputs.ci }}
E2E_TESTS: ${{ steps.filter.outputs.e2e_tests }}
IS_MAIN_OR_RELEASE: ${{ inputs.caller_event_name == 'push' && (inputs.caller_ref == 'refs/heads/main' || startsWith(inputs.caller_ref, 'refs/heads/release/')) }}
run: |
echo "--- Change Detection Summary ---"
echo "ios_native=$IOS_NATIVE"
echo "android_native=$ANDROID_NATIVE"
echo "js_source=$JS_SOURCE"
echo "sample_react_native=$SAMPLE_RN"
echo "sample_expo=$SAMPLE_EXPO"
echo "ci=$CI_CHANGED"
echo "e2e_tests=$E2E_TESTS"
echo "is_main_or_release=$IS_MAIN_OR_RELEASE"

# iOS/Android native test suites and E2E builds run when:
# - The SDK's own native code changed (packages/core/ios or android)
# - JS source changed (may affect native bridges)
# - CI config changed (need to validate workflows themselves)
# - E2E test infra changed (they test both platforms end-to-end)
# - Push to main or release branch (always run everything)
# Sample app changes do NOT trigger the full native test suite β€”
# they only trigger their own sample-application workflows.
# Performance test changes do NOT trigger native tests either β€”
# they only trigger the metrics job in e2e-v2.yml.
if [[ "$IOS_NATIVE" == "true" \
|| "$JS_SOURCE" == "true" \
|| "$CI_CHANGED" == "true" \
|| "$E2E_TESTS" == "true" \
|| "$IS_MAIN_OR_RELEASE" == "true" ]]; then
echo "needs_ios=true" >> "$GITHUB_OUTPUT"
echo "=> needs_ios=true"
else
echo "needs_ios=false" >> "$GITHUB_OUTPUT"
echo "=> needs_ios=false"
fi

if [[ "$ANDROID_NATIVE" == "true" \
|| "$JS_SOURCE" == "true" \
|| "$CI_CHANGED" == "true" \
|| "$E2E_TESTS" == "true" \
|| "$IS_MAIN_OR_RELEASE" == "true" ]]; then
echo "needs_android=true" >> "$GITHUB_OUTPUT"
echo "=> needs_android=true"
else
echo "needs_android=false" >> "$GITHUB_OUTPUT"
echo "=> needs_android=false"
fi

# React Native sample workflow runs when the RN sample itself changed,
# or when anything that the sample depends on changed (SDK source, CI).
if [[ "$SAMPLE_RN" == "true" \
|| "$JS_SOURCE" == "true" \
|| "$IOS_NATIVE" == "true" \
|| "$ANDROID_NATIVE" == "true" \
|| "$CI_CHANGED" == "true" \
|| "$IS_MAIN_OR_RELEASE" == "true" ]]; then
echo "needs_sample_react_native=true" >> "$GITHUB_OUTPUT"
echo "=> needs_sample_react_native=true"
else
echo "needs_sample_react_native=false" >> "$GITHUB_OUTPUT"
echo "=> needs_sample_react_native=false"
fi

# Expo sample workflow runs when the Expo sample itself changed,
# or when anything that the sample depends on changed (SDK source, CI).
if [[ "$SAMPLE_EXPO" == "true" \
|| "$JS_SOURCE" == "true" \
|| "$IOS_NATIVE" == "true" \
|| "$ANDROID_NATIVE" == "true" \
|| "$CI_CHANGED" == "true" \
|| "$IS_MAIN_OR_RELEASE" == "true" ]]; then
echo "needs_sample_expo=true" >> "$GITHUB_OUTPUT"
echo "=> needs_sample_expo=true"
else
echo "needs_sample_expo=false" >> "$GITHUB_OUTPUT"
echo "=> needs_sample_expo=false"
fi
Loading
Loading