Skip to content

Commit 8136ec3

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Split Fantom workflow into separate build and test jobs (facebook#54729)
Summary: - Created new build-fantom-runner action to compile the Fantom runner binary - Modified run-fantom-tests action to download and use pre-built binary - Updated test-all.yml workflow to run build and test as separate jobs - Removed build dependencies and ccache configuration from test job ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Reviewed By: cortinico Differential Revision: D88012198 Pulled By: andrewdacenko
1 parent 8cbc4dc commit 8136ec3

File tree

4 files changed

+112
-59
lines changed

4 files changed

+112
-59
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build Fantom Runner
2+
inputs:
3+
release-type:
4+
required: true
5+
description: The type of release we are building. It could be nightly, release or dry-run
6+
gradle-cache-encryption-key:
7+
description: "The encryption key needed to store the Gradle Configuration cache"
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Install dependencies
13+
shell: bash
14+
run: |
15+
sudo apt update
16+
sudo apt install -y git cmake openssl libssl-dev clang
17+
- name: Setup git safe folders
18+
shell: bash
19+
run: git config --global --add safe.directory '*'
20+
- name: Setup node.js
21+
uses: ./.github/actions/setup-node
22+
- name: Install node dependencies
23+
uses: ./.github/actions/yarn-install
24+
- name: Setup gradle
25+
uses: ./.github/actions/setup-gradle
26+
with:
27+
cache-read-only: "false"
28+
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
29+
- name: Restore Fantom ccache
30+
uses: actions/cache/restore@v5
31+
with:
32+
path: /github/home/.cache/ccache
33+
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(
34+
'packages/react-native/ReactAndroid/**/*.cpp',
35+
'packages/react-native/ReactAndroid/**/*.h',
36+
'packages/react-native/ReactAndroid/**/CMakeLists.txt',
37+
'packages/react-native/ReactCommon/**/*.cpp',
38+
'packages/react-native/ReactCommon/**/*.h',
39+
'packages/react-native/ReactCommon/**/CMakeLists.txt',
40+
'private/react-native-fantom/tester/**/*.cpp',
41+
'private/react-native-fantom/tester/**/*.h',
42+
'private/react-native-fantom/tester/**/CMakeLists.txt'
43+
) }}
44+
restore-keys: |
45+
v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-
46+
v2-ccache-fantom-${{ github.job }}-
47+
v2-ccache-fantom-
48+
- name: Show ccache stats (before)
49+
shell: bash
50+
run: ccache -s -v
51+
- name: Build Fantom Runner
52+
shell: bash
53+
run: yarn workspace @react-native/fantom build
54+
env:
55+
CC: clang
56+
CXX: clang++
57+
- name: Save Fantom ccache
58+
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
59+
uses: actions/cache/save@v5
60+
with:
61+
path: /github/home/.cache/ccache
62+
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(
63+
'packages/react-native/ReactAndroid/**/*.cpp',
64+
'packages/react-native/ReactAndroid/**/*.h',
65+
'packages/react-native/ReactAndroid/**/CMakeLists.txt',
66+
'packages/react-native/ReactCommon/**/*.cpp',
67+
'packages/react-native/ReactCommon/**/*.h',
68+
'packages/react-native/ReactCommon/**/CMakeLists.txt',
69+
'private/react-native-fantom/tester/**/*.cpp',
70+
'private/react-native-fantom/tester/**/*.h',
71+
'private/react-native-fantom/tester/**/CMakeLists.txt'
72+
) }}
73+
- name: Show ccache stats (after)
74+
shell: bash
75+
run: ccache -s -v
76+
- name: Copy shared libraries
77+
shell: bash
78+
run: cp packages/react-native/ReactAndroid/hermes-engine/build/hermes/lib/libhermesvm.so private/react-native-fantom/build/tester/
79+
- name: Upload Fantom Runner binary
80+
uses: actions/upload-artifact@v6
81+
with:
82+
name: fantom-runner-binary
83+
compression-level: 1
84+
path: private/react-native-fantom/build/tester/

.github/actions/run-fantom-tests/action.yml

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,32 @@
11
name: Run Fantom Tests
2-
inputs:
3-
release-type:
4-
required: true
5-
description: The type of release we are building. It could be nightly, release or dry-run
6-
gradle-cache-encryption-key:
7-
description: "The encryption key needed to store the Gradle Configuration cache"
8-
92
runs:
103
using: composite
114
steps:
12-
- name: Install dependencies
5+
- name: Install runtime dependencies
136
shell: bash
147
run: |
158
sudo apt update
16-
sudo apt install -y git cmake openssl libssl-dev clang
9+
sudo apt install -y openssl libssl-dev
1710
- name: Setup git safe folders
1811
shell: bash
1912
run: git config --global --add safe.directory '*'
2013
- name: Setup node.js
2114
uses: ./.github/actions/setup-node
2215
- name: Install node dependencies
2316
uses: ./.github/actions/yarn-install
24-
- name: Setup gradle
25-
uses: ./.github/actions/setup-gradle
17+
- name: Download Fantom Runner binary
18+
uses: actions/download-artifact@v7
2619
with:
27-
cache-read-only: "false"
28-
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
29-
- name: Restore Fantom ccache
30-
uses: actions/cache/restore@v5
31-
with:
32-
path: /github/home/.cache/ccache
33-
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(
34-
'packages/react-native/ReactAndroid/**/*.cpp',
35-
'packages/react-native/ReactAndroid/**/*.h',
36-
'packages/react-native/ReactAndroid/**/CMakeLists.txt',
37-
'packages/react-native/ReactCommon/**/*.cpp',
38-
'packages/react-native/ReactCommon/**/*.h',
39-
'packages/react-native/ReactCommon/**/CMakeLists.txt',
40-
'private/react-native-fantom/tester/**/*.cpp',
41-
'private/react-native-fantom/tester/**/*.h',
42-
'private/react-native-fantom/tester/**/CMakeLists.txt'
43-
) }}
44-
restore-keys: |
45-
v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-
46-
v2-ccache-fantom-${{ github.job }}-
47-
v2-ccache-fantom-
48-
- name: Show ccache stats
20+
name: fantom-runner-binary
21+
path: private/react-native-fantom/build/tester
22+
- name: Make binary executable
4923
shell: bash
50-
run: ccache -s -v
24+
run: chmod +x private/react-native-fantom/build/tester/fantom_tester
5125
- name: Run Fantom Tests
5226
shell: bash
5327
run: yarn fantom
5428
env:
55-
CC: clang
56-
CXX: clang++
57-
- name: Save Fantom ccache
58-
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
59-
uses: actions/cache/save@v5
60-
with:
61-
path: /github/home/.cache/ccache
62-
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(
63-
'packages/react-native/ReactAndroid/**/*.cpp',
64-
'packages/react-native/ReactAndroid/**/*.h',
65-
'packages/react-native/ReactAndroid/**/CMakeLists.txt',
66-
'packages/react-native/ReactCommon/**/*.cpp',
67-
'packages/react-native/ReactCommon/**/*.h',
68-
'packages/react-native/ReactCommon/**/CMakeLists.txt',
69-
'private/react-native-fantom/tester/**/*.cpp',
70-
'private/react-native-fantom/tester/**/*.h',
71-
'private/react-native-fantom/tester/**/CMakeLists.txt'
72-
) }}
73-
- name: Show ccache stats
74-
shell: bash
75-
run: ccache -s -v
29+
LD_LIBRARY_PATH: ${{ github.workspace }}/private/react-native-fantom/build/tester
7630
- name: Upload test results
7731
if: ${{ always() }}
7832
uses: actions/upload-artifact@v6

.github/workflows/test-all.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ jobs:
338338
flavor: ${{ matrix.flavor }}
339339
working-directory: /tmp/RNTestProject
340340

341-
run_fantom_tests:
341+
build_fantom_runner:
342342
runs-on: 8-core-ubuntu
343343
needs: [set_release_type, check_code_changes, lint]
344344
if: needs.check_code_changes.outputs.any_code_change == 'true'
@@ -356,12 +356,25 @@ jobs:
356356
steps:
357357
- name: Checkout
358358
uses: actions/checkout@v6
359-
- name: Build and Test Fantom
360-
uses: ./.github/actions/run-fantom-tests
359+
- name: Build Fantom Runner
360+
uses: ./.github/actions/build-fantom-runner
361361
with:
362362
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
363363
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
364364

365+
run_fantom_tests:
366+
runs-on: 8-core-ubuntu
367+
needs: [build_fantom_runner]
368+
container:
369+
image: reactnativecommunity/react-native-android:latest
370+
env:
371+
TERM: "dumb"
372+
steps:
373+
- name: Checkout
374+
uses: actions/checkout@v6
375+
- name: Run Fantom Tests
376+
uses: ./.github/actions/run-fantom-tests
377+
365378
build_android:
366379
runs-on: 8-core-ubuntu
367380
needs: [set_release_type, check_code_changes]

scripts/fantom.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ set -e
1010
if [[ -f "BUCK" && -z "$FANTOM_FORCE_OSS_BUILD" ]]; then
1111
export JS_DIR='..'
1212
else
13-
yarn workspace @react-native/fantom build
13+
if [[ ! -f "private/react-native-fantom/build/tester/fantom_tester" ]]; then
14+
yarn workspace @react-native/fantom build
15+
fi
1416
export FANTOM_FORCE_OSS_BUILD=1
1517
fi
1618

0 commit comments

Comments
 (0)