Skip to content

Commit 8292ded

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Add basic steps in CI (react#52225)
Summary: ## Changelog: [Internal] - Fantom in RN CLI This diff prepares the RN CI to build and run Fantom Tests Reviewed By: cortinico Differential Revision: D70097944
1 parent f47da61 commit 8292ded

4 files changed

Lines changed: 111 additions & 4 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
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+
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
49+
shell: bash
50+
run: ccache -s -v
51+
- name: Run Fantom Tests
52+
shell: bash
53+
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
76+
- name: Upload test results
77+
if: ${{ always() }}
78+
uses: actions/upload-artifact@v4.3.4
79+
with:
80+
name: run-fantom-tests-results
81+
compression-level: 1
82+
path: |
83+
private/react-native-fantom/build/reports

.github/workflows/test-all.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,25 @@ jobs:
370370
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
371371
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
372372

373+
run_fantom_tests:
374+
runs-on: 8-core-ubuntu
375+
needs: [set_release_type]
376+
container:
377+
image: reactnativecommunity/react-native-android:latest
378+
env:
379+
TERM: "dumb"
380+
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
381+
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
382+
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
383+
steps:
384+
- name: Checkout
385+
uses: actions/checkout@v4
386+
- name: Build and Test Fantom
387+
uses: ./.github/actions/run-fantom-tests
388+
with:
389+
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
390+
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
391+
373392
build_hermesc_windows:
374393
runs-on: windows-2025
375394
needs: prepare_hermes_workspace

packages/react-native/ReactCommon/cxxreact/TraceSection.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ struct TraceSection {
5454
public:
5555
template <typename... ConvertsToStringPiece>
5656
explicit TraceSection(
57-
const __unused char* name,
58-
__unused ConvertsToStringPiece&&... args) {
57+
[[maybe_unused]] const char* name,
58+
[[maybe_unused]] ConvertsToStringPiece&&... args) {
5959
TRACE_EVENT_BEGIN("react-native", perfetto::DynamicString{name}, args...);
6060
}
6161

@@ -82,8 +82,8 @@ struct DummyTraceSection {
8282
public:
8383
template <typename... ConvertsToStringPiece>
8484
explicit DummyTraceSection(
85-
const __unused char* name,
86-
__unused ConvertsToStringPiece&&... args) {}
85+
[[maybe_unused]] const char* name,
86+
[[maybe_unused]] ConvertsToStringPiece&&... args) {}
8787
};
8888
using TraceSectionUnwrapped = DummyTraceSection;
8989
#endif

private/react-native-fantom/tester/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
cmake_minimum_required(VERSION 3.13)
77
set(CMAKE_VERBOSE_MAKEFILE on)
8+
if(UNIX AND NOT APPLE)
9+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
10+
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -latomic")
11+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")
12+
endif()
813

914
project(fantom_tester)
1015

0 commit comments

Comments
 (0)