-
Notifications
You must be signed in to change notification settings - Fork 25.2k
530 lines (495 loc) · 18.9 KB
/
test-all.yml
File metadata and controls
530 lines (495 loc) · 18.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
name: Test All
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- "*-stable"
permissions:
contents: read
jobs:
set_release_type:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
outputs:
RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }}
env:
EVENT_NAME: ${{ github.event_name }}
REF: ${{ github.ref }}
steps:
- id: set_release_type
run: |
if [[ $EVENT_NAME == "schedule" ]]; then
echo "Setting release type to nightly"
echo "RELEASE_TYPE=nightly" >> $GITHUB_OUTPUT
elif [[ $EVENT_NAME == "push" && $REF == refs/tags/v* ]]; then
echo "Setting release type to release"
echo "RELEASE_TYPE=release" >> $GITHUB_OUTPUT
else
echo "Setting release type to dry-run"
echo "RELEASE_TYPE=dry-run" >> $GITHUB_OUTPUT
fi
echo "Should I run E2E tests? ${{ inputs.run-e2e-tests }}"
check_code_changes:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
outputs:
any_code_change: ${{ steps.filter_exclusions.outputs.any_code_change == 'true' || github.event_name != 'pull_request' }}
should_test_android: ${{ steps.filter_exclusions.outputs.should_test_android == 'true' || github.event_name != 'pull_request' }}
should_test_ios: ${{ steps.filter_exclusions.outputs.should_test_ios == 'true' || github.event_name != 'pull_request' }}
debugger_shell: ${{ steps.filter_inclusions.outputs.debugger_shell }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check for code changes (exclusion patterns)
uses: dorny/paths-filter@209e61402dbca8aa44f967535da6666b284025ed
id: filter_exclusions
with:
predicate-quantifier: every
filters: |
any_code_change:
- '**'
- '!**/__docs__/**'
- '!**/*.md'
should_test_android:
# Not an isolated iOS change
- '**'
- '!packages/react-native/React/**'
- '!packages/react-native/ReactApple/**'
- '!packages/react-native/**/*.m'
- '!packages/react-native/**/*.mm'
- '!packages/react-native/**/*.podspec'
- '!packages/rn-tester/RNTester/**'
- '!packages/rn-tester/RNTesterPods*/**'
- '!packages/rn-tester/Podfile*'
should_test_ios:
# Not an isolated Android change
- '**'
- '!gradle/**'
- '!gradle*'
- '!packages/gradle-plugin/**'
- '!packages/react-native/ReactAndroid/**'
- '!packages/react-native/**/*.java'
- '!packages/react-native/**/*.kt'
- '!packages/react-native/**/*.gradle*'
- '!packages/react-native-popup-menu-android/**'
- '!packages/rn-tester/android/**'
- name: Check for code changes (inclusion patterns)
uses: dorny/paths-filter@209e61402dbca8aa44f967535da6666b284025ed
id: filter_inclusions
with:
filters: |
debugger_shell:
- 'packages/debugger-shell/**'
- 'scripts/debugger-shell/**'
prebuild_apple_dependencies:
needs: check_code_changes
if: |
needs.check_code_changes.outputs.any_code_change == 'true' &&
needs.check_code_changes.outputs.should_test_ios == 'true'
uses: ./.github/workflows/prebuild-ios-dependencies.yml
secrets: inherit
prebuild_react_native_core:
uses: ./.github/workflows/prebuild-ios-core.yml
if: ${{ needs.prebuild_apple_dependencies.result == 'success' }}
with:
use-hermes-prebuilt: ${{ !endsWith(github.ref_name, '-stable') }}
secrets: inherit
needs: [prebuild_apple_dependencies]
test_ios_rntester_ruby_3_2_0:
runs-on: macos-15
needs:
[prebuild_apple_dependencies, prebuild_react_native_core]
if: ${{ needs.prebuild_react_native_core.result == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run it
uses: ./.github/actions/test-ios-rntester
with:
ruby-version: "3.2.0"
flavor: Debug
test_ios_rntester_dynamic_frameworks:
runs-on: macos-15-large
needs: check_code_changes
if: |
needs.check_code_changes.outputs.any_code_change == 'true' &&
needs.check_code_changes.outputs.should_test_ios == 'true'
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run it
uses: ./.github/actions/test-ios-rntester
with:
flavor: ${{ matrix.flavor }}
use-frameworks: true
run-unit-tests: false # tests for dynamic frameworks are already run in the test_ios_rntester job; this is to just a test build from source (no prebuilds)
test_ios_rntester:
runs-on: macos-15-large
needs:
[prebuild_apple_dependencies, prebuild_react_native_core]
if: ${{ needs.prebuild_react_native_core.result == 'success' }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
frameworks: [false, true]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run it
uses: ./.github/actions/test-ios-rntester
with:
use-frameworks: ${{ matrix.frameworks }}
flavor: ${{ matrix.flavor }}
test_e2e_ios_rntester:
needs: test_ios_rntester
if: ${{ needs.test_ios_rntester.result == 'success' }}
uses: ./.github/workflows/e2e-ios-rntester.yml
secrets: inherit
test_e2e_ios_rntester_retry_1:
needs: test_e2e_ios_rntester
if: ${{ always() && needs.test_e2e_ios_rntester.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-ios-rntester.yml
secrets: inherit
test_e2e_ios_rntester_retry_2:
needs: test_e2e_ios_rntester_retry_1
if: ${{ always() && needs.test_e2e_ios_rntester_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-ios-rntester.yml
with:
fail-on-error: true
secrets: inherit
test_e2e_ios_templateapp:
needs: [build_npm_package, prebuild_apple_dependencies, check_code_changes]
if: needs.check_code_changes.outputs.should_test_ios == 'true'
uses: ./.github/workflows/e2e-ios-templateapp.yml
secrets: inherit
test_e2e_ios_templateapp_retry_1:
needs: test_e2e_ios_templateapp
if: ${{ always() && needs.test_e2e_ios_templateapp.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-ios-templateapp.yml
secrets: inherit
test_e2e_ios_templateapp_retry_2:
needs: test_e2e_ios_templateapp_retry_1
if: ${{ always() && needs.test_e2e_ios_templateapp_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-ios-templateapp.yml
with:
fail-on-error: true
secrets: inherit
test_e2e_android_templateapp:
needs: [build_npm_package, build_android]
if: ${{ always() && needs.build_android.result == 'success' && needs.build_npm_package.result == 'success' }}
uses: ./.github/workflows/e2e-android-templateapp.yml
secrets: inherit
test_e2e_android_templateapp_retry_1:
needs: test_e2e_android_templateapp
if: ${{ always() && needs.test_e2e_android_templateapp.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-templateapp.yml
secrets: inherit
test_e2e_android_templateapp_retry_2:
needs: test_e2e_android_templateapp_retry_1
if: ${{ always() && needs.test_e2e_android_templateapp_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-templateapp.yml
with:
fail-on-error: true
secrets: inherit
build_fantom_runner:
runs-on: 8-core-ubuntu
needs: [set_release_type, check_code_changes, lint]
if: needs.check_code_changes.outputs.any_code_change == 'true'
container:
image: reactnativecommunity/react-native-android:latest
env:
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
LC_ALL: C.UTF8
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build Fantom Runner
uses: ./.github/actions/build-fantom-runner
with:
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
run_fantom_tests:
needs: build_fantom_runner
uses: ./.github/workflows/fantom-tests.yml
secrets: inherit
run_fantom_tests_retry_1:
needs: run_fantom_tests
if: ${{ always() && needs.run_fantom_tests.outputs.status == 'failure' }}
uses: ./.github/workflows/fantom-tests.yml
secrets: inherit
run_fantom_tests_retry_2:
needs: run_fantom_tests_retry_1
if: ${{ always() && needs.run_fantom_tests_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/fantom-tests.yml
with:
fail-on-error: true
secrets: inherit
build_android:
runs-on: 8-core-ubuntu
needs: [set_release_type, check_code_changes]
if: |
needs.check_code_changes.outputs.any_code_change == 'true' &&
needs.check_code_changes.outputs.should_test_android == 'true'
container:
image: reactnativecommunity/react-native-android:latest
env:
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
LC_ALL: C.UTF8
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build Android
uses: ./.github/actions/build-android
with:
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
test_e2e_android_rntester:
needs: build_android
if: ${{ needs.build_android.result == 'success' }}
uses: ./.github/workflows/e2e-android-rntester.yml
secrets: inherit
test_e2e_android_rntester_retry_1:
needs: test_e2e_android_rntester
if: ${{ always() && needs.test_e2e_android_rntester.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-rntester.yml
secrets: inherit
test_e2e_android_rntester_retry_2:
needs: test_e2e_android_rntester_retry_1
if: ${{ always() && needs.test_e2e_android_rntester_retry_1.outputs.status == 'failure' }}
uses: ./.github/workflows/e2e-android-rntester.yml
with:
fail-on-error: true
secrets: inherit
build_npm_package:
runs-on: 8-core-ubuntu
needs:
[
set_release_type,
check_code_changes,
build_android,
prebuild_apple_dependencies,
prebuild_react_native_core,
]
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
container:
image: reactnativecommunity/react-native-android:latest
env:
TERM: "dumb"
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
LC_ALL: C.UTF8
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build NPM Package
uses: ./.github/actions/build-npm-package
with:
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
skip-apple-prebuilts: ${{ needs.check_code_changes.outputs.should_test_ios == 'false' }}
test_android_helloworld:
runs-on: 4-core-ubuntu
needs: [build_npm_package, build_android]
if: ${{ always() && needs.build_android.result == 'success' && needs.build_npm_package.result == 'success' }}
container:
image: reactnativecommunity/react-native-android:latest
env:
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in conatiners
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
LC_ALL: C.UTF8
YARN_ENABLE_IMMUTABLE_INSTALLS: false
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
TARGET_ARCHITECTURE: "arm64-v8a"
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
continue-on-error: true
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup git safe folders
run: git config --global --add safe.directory '*'
- name: Download npm package artifact
uses: actions/download-artifact@v7
with:
name: react-native-package
path: build
- name: Download maven-local artifact
uses: actions/download-artifact@v7
with:
name: maven-local
path: /tmp/maven-local
- name: Setup gradle
uses: ./.github/actions/setup-gradle
with:
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
- name: Run yarn install
uses: ./.github/actions/yarn-install
- name: Set Hermes prebuilt version
shell: bash
run: |
node ./scripts/releases/use-hermes-prebuilt.js
- name: Run yarn install again, with the correct hermes version
uses: ./.github/actions/yarn-install
- name: Prepare the Helloworld application
shell: bash
run: node ./scripts/e2e/init-project-e2e.js --useHelloWorld --pathToLocalReactNative "$GITHUB_WORKSPACE/build/$(cat build/react-native-package-version)"
- name: Build the Helloworld application for ${{ matrix.flavor }} with Architecture set to New Architecture.
shell: bash
run: |
cd private/helloworld/android
args=()
if [[ ${{ matrix.flavor }} == "Release" ]]; then
args+=(--prod)
fi
yarn build android "${args[@]}" -P reactNativeArchitectures="$TARGET_ARCHITECTURE" -P react.internal.mavenLocalRepo="/tmp/maven-local"
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: helloworld-apk-${{ matrix.flavor }}-NewArch-hermes
path: ./private/helloworld/android/app/build/outputs/apk/
compression-level: 0
test_ios_helloworld_with_ruby_3_2_0:
runs-on: macos-15
needs: [prebuild_apple_dependencies, prebuild_react_native_core]
if: ${{ needs.prebuild_react_native_core.result == 'success' }}
env:
PROJECT_NAME: iOSTemplateProject
YARN_ENABLE_IMMUTABLE_INSTALLS: false
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: ./.github/actions/test-ios-helloworld
with:
ruby-version: 3.2.0
flavor: Debug
test_ios_helloworld:
runs-on: macos-15
needs: [prebuild_apple_dependencies, prebuild_react_native_core]
if: ${{ needs.prebuild_react_native_core.result == 'success' }}
strategy:
matrix:
flavor: [Debug, Release]
use_frameworks: [false, true]
exclude:
# This config is tested with Ruby 3.2.0. Let's not double test it.
- flavor: Debug
use_frameworks: StaticLibraries
env:
PROJECT_NAME: iOSTemplateProject
YARN_ENABLE_IMMUTABLE_INSTALLS: false
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: ./.github/actions/test-ios-helloworld
with:
flavor: ${{ matrix.flavor }}
use-frameworks: ${{ matrix.use_frameworks }}
lint:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Lint file structure
shell: bash
run: ./.github/workflow-scripts/lint_files.sh
- name: Run shellcheck
shell: bash
run: ./.github/workflow-scripts/analyze_scripts.sh
- name: Prettier
shell: bash
run: yarn run format-check
- name: markdownlint
shell: bash
run: yarn run lint-markdown
- name: ESLint
shell: bash
run: ./.github/workflow-scripts/exec_swallow_error.sh yarn lint --format junit -o ./reports/junit/eslint/results.xml
- name: Flow
shell: bash
run: yarn flow-check
- name: TypeScript
shell: bash
run: yarn test-typescript
test_js:
runs-on: ubuntu-latest
needs: [check_code_changes, lint]
if: needs.check_code_changes.outputs.any_code_change == 'true'
strategy:
fail-fast: false
matrix:
node-version: ["24", "22.13.0"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Test JS
uses: ./.github/actions/test-js
with:
node-version: ${{ matrix.node-version }}
build_js_types:
runs-on: ubuntu-latest
needs: [check_code_changes, lint]
if: needs.check_code_changes.outputs.any_code_change == 'true'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Build react-native package types
shell: bash
run: yarn build-types --skip-snapshot
- name: Validate generated types
shell: bash
run: yarn test-generated-typescript
build_debugger_shell:
runs-on: ubuntu-latest
needs: check_code_changes
if: needs.check_code_changes.outputs.debugger_shell == 'true'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Install dependencies
uses: ./.github/actions/yarn-install
- name: Build packages
shell: bash
run: yarn build --prepack
- name: Verify debugger-shell build
shell: bash
run: node scripts/debugger-shell/build-binary.js