Skip to content

CI: detect-changes workflow to only check the affected components on the CI side#5843

Merged
alwx merged 10 commits intomainfrom
alwx/improvement/ci-detect-changes
Mar 23, 2026
Merged

CI: detect-changes workflow to only check the affected components on the CI side#5843
alwx merged 10 commits intomainfrom
alwx/improvement/ci-detect-changes

Conversation

@alwx
Copy link
Contributor

@alwx alwx commented Mar 19, 2026

Fixes #5786
Fixes #5785

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

.github/workflows/detect-changes.yml — New reusable workflow that uses dorny/paths-filterv3 with the file filters to produce needs_ios and needs_android boolean outputs.
That makes it all skip certain checks — for example, if the changes are in sample apps then there is no need to re-run tests for the whole SDK.

During the review I would love you to carefully look at detect-changes.yml, as well as the conditions specified in platform-check steps.

💡 Motivation and Context

We want our CI to be fast and don't do redundant jobs.

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • CI: detect-changes workflow to only check the affected components on the CI side by alwx in #5843
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.24.1 to 2.25.0 by dependabot in #5861
  • chore(deps): bump getsentry/craft from 2.24.1 to 2.25.0 by dependabot in #5862
  • chore(deps): bump github/codeql-action from 4.32.6 to 4.34.1 by dependabot in #5860
  • chore(deps): update JavaScript SDK to v10.45.0 by github-actions in #5848
  • chore(deps): bump flatted from 3.4.1 to 3.4.2 by dependabot in #5853
  • chore(deps): update Cocoa SDK to v9.8.0 by github-actions in #5847
  • fix(tracing): Guard getNewScreenTimeToDisplay behind enableTimeToInitialDisplay by antonis in #5849
  • chore(deps): bump json from 2.16.0 to 2.17.1.2 in /performance-tests by dependabot in #5844
  • chore(docs): Add changelog entry for duplicated breadcrumbs fix by antonis in #5851
  • fix(tracing): Unsubscribe spanEnd listeners after they fire to prevent accumulation by antonis in #5840
  • fix(android): Properly remove duplicated breadcrumbs by vovkasm in #5841
  • fix(tracing): Skip native frames and stall tracking for unsampled spans by antonis in #5842

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against 1f7b5dc

alwx added 4 commits March 19, 2026 16:13
…orm gates

The step-level platform-check in sample-application, sample-application-expo,
and e2e-v2 workflows gated on needs_ios/needs_android, which only track SDK
source and native code changes. When only sample app or performance test files
changed, the job-level condition correctly triggered (via needs_sample_react_native,
needs_sample_expo), but every platform step was skipped — runners allocated,
zero meaningful work done, false green reported.

Fix by checking sample_react_native/sample_expo/perf_tests as the first
condition in each platform-check step. If the relevant files changed, all
platforms proceed without skipping.

Affected workflows:
- sample-application.yml: build and test jobs (sample_react_native)
- sample-application-expo.yml: build job (sample_expo)
- e2e-v2.yml: metrics job (perf_tests)
@alwx alwx marked this pull request as ready for review March 20, 2026 09:12
…r Expo sample

The working-directory value had a leading space (' samples/expo') due to
an unnecessary ternary expression. Since the step is already guarded by
an if condition checking matrix.platform == 'ios', the ternary was
redundant. Simplified to the plain path 'samples/expo'.
platform: 'macos'
steps:
- name: Check if platform is needed
id: platform-check
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Wdyt of extracting the platform-check in a separate workflow and reuse it? (this can be part of a separate improvement PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, let's better handle that separately

Copy link
Contributor Author

Choose a reason for hiding this comment

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

needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
needs: [diff_check, detect-changes]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && needs.detect-changes.outputs.needs_android == 'true' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion/idea for a future improvement:

It's nice that no runner is allocated here when the if is false here since each job is a single platform.

The other workflows use platform as a matrix dimension alongside others. We could apply the native-tests pattern on the other workflows too by splitting into separate build-ios / build-android / build-macos jobs, each with their own job-level if and a reduced matrix (without platform). That would avoid runner allocation entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would also rather do it in another PR but that's a great suggestion. Will create an issue out of it!

Copy link
Contributor Author

@alwx alwx Mar 23, 2026

Choose a reason for hiding this comment

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

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Awesome work @alwx 🎸

I think it would be nice to fix https://github.com/getsentry/sentry-react-native/pull/5843/changes#r2965213616 and the cursor comment for the web before merging but none is blocking imo.

I've also added a couple of suggestions which I think we could handle in separate PRs later.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

echo "Skipping Android — no relevant changes detected."
elif [[ "${{ matrix.platform }}" == "web" && "${{ needs.detect-changes.outputs.js_source }}" != "true" ]]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "Skipping Web — no relevant JS changes detected."
Copy link

Choose a reason for hiding this comment

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

Expo web build skipped during CI-only or main/release changes

Medium Severity

The web platform-check in sample-application-expo.yml only considers js_source to decide whether to skip, while the needs_ios/needs_android convenience outputs also account for ci changes and IS_MAIN_OR_RELEASE. When only CI files change (or on a push to main), needs_sample_expo is true at the job level, and iOS/Android correctly run via their needs_* flags, but the web build is incorrectly skipped because js_source is false. This violates the stated intent that CI changes "should trigger everything" and that main/release pushes always run all jobs.

Additional Locations (1)
Fix in Cursor Fix in Web

@alwx alwx merged commit 2745f26 into main Mar 23, 2026
38 of 49 checks passed
@alwx alwx deleted the alwx/improvement/ci-detect-changes branch March 23, 2026 10:19
@alwx alwx mentioned this pull request Mar 23, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split tests into iOS and Android Changes to sample apps shouldn’t need to test the SDK

2 participants