Skip to content

[ci] Split Test All into Test JS and Test C++ #1

[ci] Split Test All into Test JS and Test C++

[ci] Split Test All into Test JS and Test C++ #1

Workflow file for this run

name: Test C++
on:
workflow_dispatch:
pull_request:
paths-ignore:
- '**/*.md'
- '**/__docs__/**'
- '**/LICENSE'
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:
build_fantom_runner:
runs-on: 8-core-ubuntu
if: github.repository == 'react/react-native'
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
if: github.repository == 'react/react-native'
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