Skip to content

Commit 56b052e

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Split Fantom workflow into separate build and test jobs (#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 Differential Revision: D88012198 Pulled By: andrewdacenko
1 parent 41eace0 commit 56b052e

File tree

3 files changed

+108
-59
lines changed

3 files changed

+108
-59
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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@v4
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@v4
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: Upload Fantom Runner binary
77+
uses: actions/[email protected]
78+
with:
79+
name: fantom-runner-binary
80+
compression-level: 1
81+
path: private/react-native-fantom/build/tester/fantom_tester

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

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,30 @@
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@v4
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@v4
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
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@v4
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
7628
- name: Upload test results
7729
if: ${{ always() }}
7830
uses: actions/[email protected]

.github/workflows/test-all.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ jobs:
282282
flavor: ${{ matrix.flavor }}
283283
working-directory: /tmp/RNTestProject
284284

285-
run_fantom_tests:
285+
build_fantom_runner:
286286
runs-on: 8-core-ubuntu
287287
needs: [set_release_type]
288288
container:
@@ -295,12 +295,28 @@ jobs:
295295
steps:
296296
- name: Checkout
297297
uses: actions/checkout@v4
298-
- name: Build and Test Fantom
299-
uses: ./.github/actions/run-fantom-tests
298+
- name: Build Fantom Runner
299+
uses: ./.github/actions/build-fantom-runner
300300
with:
301301
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
302302
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
303303

304+
run_fantom_tests:
305+
runs-on: 8-core-ubuntu
306+
needs: [set_release_type, build_fantom_runner]
307+
container:
308+
image: reactnativecommunity/react-native-android:latest
309+
env:
310+
TERM: "dumb"
311+
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
312+
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
313+
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
314+
steps:
315+
- name: Checkout
316+
uses: actions/checkout@v4
317+
- name: Run Fantom Tests
318+
uses: ./.github/actions/run-fantom-tests
319+
304320
build_android:
305321
runs-on: 8-core-ubuntu
306322
needs: [set_release_type]

0 commit comments

Comments
 (0)