Skip to content

Commit 19714fb

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Add basic steps in CI (facebook#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 19714fb

File tree

4 files changed

+101
-4
lines changed

4 files changed

+101
-4
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
env:
9+
FANTOM_CCACHE_FILES: |
10+
packages/react-native/ReactAndroid/**/*.cpp
11+
packages/react-native/ReactAndroid/**/*.h
12+
packages/react-native/ReactAndroid/**/CMakeLists.txt
13+
packages/react-native/ReactCommon/**/*.cpp
14+
packages/react-native/ReactCommon/**/*.h
15+
packages/react-native/ReactCommon/**/CMakeLists.txt
16+
private/react-native-fantom/tester/**/*.cpp
17+
private/react-native-fantom/tester/**/*.h
18+
private/react-native-fantom/tester/**/CMakeLists.txt
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Install dependencies
23+
shell: bash
24+
run: |
25+
sudo apt update
26+
sudo apt install -y git cmake openssl libssl-dev clang
27+
- name: Setup git safe folders
28+
shell: bash
29+
run: git config --global --add safe.directory '*'
30+
- name: Setup node.js
31+
uses: ./.github/actions/setup-node
32+
- name: Install node dependencies
33+
uses: ./.github/actions/yarn-install
34+
- name: Setup gradle
35+
uses: ./.github/actions/setup-gradle
36+
with:
37+
cache-read-only: "false"
38+
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
39+
- name: Restore Fantom ccache
40+
uses: actions/cache/restore@v4
41+
with:
42+
path: /github/home/.cache/ccache
43+
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(${{ env.FANTOM_CCACHE_FILES }}) }}
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(${{ env.FANTOM_CCACHE_FILES }}) }}
63+
- name: Show ccache stats
64+
shell: bash
65+
run: ccache -s -v
66+
- name: Upload test results
67+
if: ${{ always() }}
68+
uses: actions/[email protected]
69+
with:
70+
name: run-fantom-tests-results
71+
compression-level: 1
72+
path: |
73+
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)