Skip to content

Commit 3f200a2

Browse files
huntiemeta-codesync[bot]
authored andcommitted
Add conditional Android/iOS job runs in test-all workflow (#55449)
Summary: Pull Request resolved: #55449 Further workflow optimisation after D92417918. Aims to improve speed of CI signals and reduce costs by excluding Android and iOS specific jobs when a PR contains changes exclusively within native code to one platform. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D92512983 fbshipit-source-id: feb67ce140014352219ae2b5720fc819ec5e1c11
1 parent 149a4b8 commit 3f200a2

1 file changed

Lines changed: 46 additions & 8 deletions

File tree

.github/workflows/test-all.yml

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,60 @@ jobs:
3737
runs-on: ubuntu-latest
3838
if: github.repository == 'facebook/react-native'
3939
outputs:
40-
debugger_shell: ${{ steps.filter.outputs.debugger_shell }}
41-
any_code_change: ${{ steps.filter.outputs.any_code_change || github.event_name != 'pull_request' }}
40+
any_code_change: ${{ steps.filter_exclusions.outputs.any_code_change || github.event_name != 'pull_request' }}
41+
should_test_android: ${{ steps.filter_exclusions.outputs.should_test_android || github.event_name != 'pull_request' }}
42+
should_test_ios: ${{ steps.filter_exclusions.outputs.should_test_ios || github.event_name != 'pull_request' }}
43+
debugger_shell: ${{ steps.filter_inclusions.outputs.debugger_shell }}
4244
steps:
4345
- name: Checkout
4446
uses: actions/checkout@v6
45-
- name: Check for code changes
46-
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
47-
id: filter
47+
- name: Check for code changes (exclusion patterns)
48+
uses: dorny/paths-filter@209e61402dbca8aa44f967535da6666b284025ed
49+
id: filter_exclusions
4850
with:
51+
predicate-quantifier: every
4952
filters: |
5053
any_code_change:
54+
- '**'
5155
- '!**/__docs__/**'
5256
- '!**/*.md'
57+
should_test_android:
58+
# Not an isolated iOS change
59+
- '**'
60+
- '!packages/react-native/React/**'
61+
- '!packages/react-native/ReactApple/**'
62+
- '!packages/react-native/**/*.m'
63+
- '!packages/react-native/**/*.mm'
64+
- '!packages/react-native/**/*.podspec'
65+
- '!packages/rn-tester/RNTester/**'
66+
- '!packages/rn-tester/RNTesterPods*/**'
67+
- '!packages/rn-tester/Podfile*'
68+
should_test_ios:
69+
# Not an isolated Android change
70+
- '**'
71+
- '!gradle/**'
72+
- '!gradle*'
73+
- '!packages/gradle-plugin/**'
74+
- '!packages/react-native/ReactAndroid/**'
75+
- '!packages/react-native/**/*.java'
76+
- '!packages/react-native/**/*.kt'
77+
- '!packages/react-native/**/*.gradle*'
78+
- '!packages/react-native-popup-menu-android/**'
79+
- '!packages/rn-tester/android/**'
80+
- name: Check for code changes (inclusion patterns)
81+
uses: dorny/paths-filter@209e61402dbca8aa44f967535da6666b284025ed
82+
id: filter_inclusions
83+
with:
84+
filters: |
5385
debugger_shell:
5486
- 'packages/debugger-shell/**'
5587
- 'scripts/debugger-shell/**'
5688
5789
prebuild_apple_dependencies:
5890
needs: check_code_changes
59-
if: needs.check_code_changes.outputs.any_code_change == 'true'
91+
if: |
92+
needs.check_code_changes.outputs.any_code_change == 'true' &&
93+
needs.check_code_changes.outputs.should_test_ios == 'true'
6094
uses: ./.github/workflows/prebuild-ios-dependencies.yml
6195
secrets: inherit
6296

@@ -83,7 +117,9 @@ jobs:
83117
test_ios_rntester_dynamic_frameworks:
84118
runs-on: macos-15-large
85119
needs: check_code_changes
86-
if: needs.check_code_changes.outputs.any_code_change == 'true'
120+
if: |
121+
needs.check_code_changes.outputs.any_code_change == 'true' &&
122+
needs.check_code_changes.outputs.should_test_ios == 'true'
87123
strategy:
88124
fail-fast: false
89125
matrix:
@@ -328,7 +364,9 @@ jobs:
328364
build_android:
329365
runs-on: 8-core-ubuntu
330366
needs: [set_release_type, check_code_changes]
331-
if: needs.check_code_changes.outputs.any_code_change == 'true'
367+
if: |
368+
needs.check_code_changes.outputs.any_code_change == 'true' &&
369+
needs.check_code_changes.outputs.should_test_android == 'true'
332370
container:
333371
image: reactnativecommunity/react-native-android:latest
334372
env:

0 commit comments

Comments
 (0)