Skip to content

[ci] Combine visual regression reports across per-platform runs #49307

[ci] Combine visual regression reports across per-platform runs

[ci] Combine visual regression reports across per-platform runs #49307

Workflow file for this run

name: Test All
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- '*-stable'
permissions:
contents: read
actions: read
concurrency:
# A new push to a pull request makes the previous run obsolete, so cancel it
# instead of spending (macOS) runner time on it. Runs on branches are never
# cancelled: each one gets its own group.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check_code_changes:
runs-on: ubuntu-latest
if: github.repository == 'react/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'
- '!**/LICENSE'
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/**'
test_android:
name: Android
needs: check_code_changes
if: |
needs.check_code_changes.outputs.any_code_change == 'true' &&
needs.check_code_changes.outputs.should_test_android == 'true'
uses: ./.github/workflows/test-android.yml
secrets: inherit
test_ios:
name: iOS
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/test-ios.yml
secrets: inherit
build_fantom_runner:
runs-on: 8-core-ubuntu
needs: [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: dry-run
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
test_react_common_cxx:
runs-on: 8-core-ubuntu
needs: [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'
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
# The tests use C++20 features newer than the image's clang 14, such as
# std::source_location and parenthesised aggregate initialisation.
- name: Install dependencies
shell: bash
run: |
sudo apt update
sudo apt install -y git cmake openssl libssl-dev curl gnupg
codename=$(. /etc/os-release && echo "$VERSION_CODENAME")
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null
echo "deb http://apt.llvm.org/$codename/ llvm-toolchain-$codename-18 main" | sudo tee /etc/apt/sources.list.d/llvm-18.list
sudo apt update
sudo apt install -y clang-18
- name: Setup git safe folders
shell: bash
run: git config --global --add safe.directory '*'
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install node dependencies
uses: ./.github/actions/yarn-install
- name: Setup gradle
uses: ./.github/actions/setup-gradle
with:
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
- name: Run ReactCommon C++ tests
shell: bash
run: ./gradlew :private:react-native-fantom:testReactCommon
env:
CC: clang-18
CXX: clang++-18
- name: Upload test results
if: ${{ always() }}
uses: ./.github/actions/upload-artifact
with:
name: test-react-common-cxx-results
compression-level: 1
if-no-files-found: ignore
path: private/react-native-fantom/build/reports
lint:
runs-on: ubuntu-latest
if: github.repository == 'react/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: Run shellcheck
shell: bash
run: ./.github/workflow-scripts/analyze_scripts.sh
- 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 (legacy deep imports / manual types)
shell: bash
run: yarn test-typescript-legacy
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: macos-26
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