Skip to content

Commit fb9a6ad

Browse files
committed
merge
2 parents 6ec578e + 20550c4 commit fb9a6ad

File tree

229 files changed

+4051
-2193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+4051
-2193
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ munge_underscores=true
6969
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/packages/react-native/index.js'
7070
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-native/\1'
7171
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
72-
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
72+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\|heic\|heif\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
7373

7474
module.system.haste.module_ref_prefix=m#
7575

.github/actions/maestro-android/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ inputs:
2222
required: false
2323
default: "."
2424
description: The directory from which metro should be started
25+
emulator-arch:
26+
required: false
27+
default: x86
28+
description: The architecture of the emulator to run
2529

2630
runs:
2731
using: composite
@@ -53,7 +57,7 @@ runs:
5357
uses: reactivecircus/android-emulator-runner@v2
5458
with:
5559
api-level: 24
56-
arch: x86
60+
arch: ${{ inputs.emulator-arch }}
5761
ram-size: '8192M'
5862
heap-size: '4096M'
5963
disk-size: '10G'
@@ -72,13 +76,13 @@ runs:
7276
uses: actions/[email protected]
7377
if: always()
7478
with:
75-
name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.flavor }}_NewArch
79+
name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.flavor }}_${{ inputs.emulator-arch }}_NewArch
7680
path: |
7781
report.xml
7882
screen.mp4
7983
- name: Store Logs
8084
if: steps.run-tests.outcome == 'failure'
8185
uses: actions/[email protected]
8286
with:
83-
name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.flavor }}-NewArch
87+
name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.flavor }}-${{ inputs.emulator-arch }}-NewArch
8488
path: /tmp/MaestroLogs
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: prepare-hermes-v1-app
2+
description: Prepares a React Native app with Hermes V1 enabled
3+
inputs:
4+
retry-count:
5+
description: 'Number of times to retry the yarn install on failure'
6+
runs:
7+
using: composite
8+
steps:
9+
- name: Create new app
10+
shell: bash
11+
run: |
12+
cd /tmp
13+
npx @react-native-community/cli init RNApp --skip-install --version nightly
14+
15+
- name: Select latest Hermes V1 version
16+
shell: bash
17+
run: |
18+
node "$GITHUB_WORKSPACE/.github/workflow-scripts/selectLatestHermesV1Version.js"
19+
20+
- name: Apply patch to enable Hermes V1
21+
shell: bash
22+
run: |
23+
cd /tmp/RNApp
24+
git apply --binary --3way --whitespace=nowarn "$GITHUB_WORKSPACE/.github/workflow-scripts/hermes-v1.patch"
25+
echo "✅ Patch applied successfully"
26+
27+
- name: Install app dependencies with retry
28+
uses: nick-fields/retry@v3
29+
with:
30+
timeout_minutes: 10
31+
max_attempts: ${{ inputs.retry-count }}
32+
retry_wait_seconds: 15
33+
shell: bash
34+
command: |
35+
cd /tmp/RNApp
36+
yarn install
37+
on_retry_command: |
38+
echo "Cleaning up for yarn retry..."
39+
cd /tmp/RNApp
40+
rm -rf node_modules yarn.lock || true
41+
yarn cache clean || true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/android/settings.gradle b/android/settings.gradle
2+
index 63b5d4e..6359ec3 100644
3+
--- a/android/settings.gradle
4+
+++ b/android/settings.gradle
5+
@@ -4,3 +4,11 @@ extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autoli
6+
rootProject.name = 'RNApp'
7+
include ':app'
8+
includeBuild('../node_modules/@react-native/gradle-plugin')
9+
+
10+
+includeBuild('../node_modules/react-native') {
11+
+ dependencySubstitution {
12+
+ substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid"))
13+
+ substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid"))
14+
+ substitute(project(":packages:react-native:ReactAndroid:hermes-engine")).using(module("com.facebook.hermes:hermes-android:$HERMES_V1_VERSION"))
15+
+ }
16+
+}
17+
diff --git a/package.json b/package.json
18+
index f05d51b..69938af 100644
19+
--- a/package.json
20+
+++ b/package.json
21+
@@ -35,6 +35,9 @@
22+
"react-test-renderer": "19.2.0",
23+
"typescript": "^5.8.3"
24+
},
25+
+ "resolutions": {
26+
+ "hermes-compiler": "$HERMES_V1_VERSION"
27+
+ },
28+
"engines": {
29+
"node": ">=20"
30+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
const { execSync } = require('child_process');
9+
const fs = require('fs');
10+
const path = require('path');
11+
12+
const PATCH_FILE_PATH = path.join(__dirname, 'hermes-v1.patch');
13+
14+
function getLatestHermesV1Version() {
15+
const npmString = "npm view hermes-compiler@latest-v1 version";
16+
17+
try {
18+
const result = execSync(npmString, { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
19+
return result;
20+
} catch (error) {
21+
throw new Error(`Failed to get package version for hermes-compiler@latest-v1`);
22+
}
23+
}
24+
25+
function setHermesV1VersionInPatch(version) {
26+
if (!fs.existsSync(PATCH_FILE_PATH)) {
27+
throw new Error(`Patch file not found at path: ${PATCH_FILE_PATH}`);
28+
}
29+
30+
let patchContent = fs.readFileSync(PATCH_FILE_PATH, 'utf8');
31+
const updatedContent = patchContent.replaceAll(
32+
"$HERMES_V1_VERSION",
33+
version
34+
);
35+
fs.writeFileSync(PATCH_FILE_PATH, updatedContent, 'utf8');
36+
}
37+
38+
setHermesV1VersionInPatch(getLatestHermesV1Version());

.github/workflows/bump-podfile-lock.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
- name: Checkout
1111
uses: actions/checkout@v4
1212
with:
13+
token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
1314
fetch-depth: 0
1415
fetch-tags: true
1516
- name: Install dependencies

.github/workflows/create-draft-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- name: Checkout repository
2020
uses: actions/checkout@v4
2121
with:
22+
token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
2223
fetch-depth: 0
2324
fetch-tags: true
2425
- name: Install dependencies
@@ -36,7 +37,7 @@ jobs:
3637
const {createDraftRelease} = require('./.github/workflow-scripts/createDraftRelease.js');
3738
const version = '${{ github.ref_name }}';
3839
const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js');
39-
return (await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}', ${{ inputs.hermesVersion }}, ${{ inputs.hermesV1Version }})).id;
40+
return (await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}', '${{ inputs.hermesVersion }}', '${{ inputs.hermesV1Version }}')).id;
4041
result-encoding: string
4142
- name: Upload release assets for DotSlash
4243
uses: actions/github-script@v6

.github/workflows/generate-changelog.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
- name: Checkout repository
1111
uses: actions/checkout@v4
1212
with:
13+
token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
1314
fetch-depth: 0
1415
fetch-tags: true
1516
- name: Install dependencies

.github/workflows/test-all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ jobs:
479479
strategy:
480480
fail-fast: false
481481
matrix:
482-
node-version: ["24.4.1", "22", "20.19.4"]
482+
node-version: ["24", "22", "20.19.4"]
483483
steps:
484484
- name: Checkout
485485
uses: actions/checkout@v4
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Test Hermes V1 with nightly on Android
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
retry-count:
7+
description: 'Number of times to retry the build on failure'
8+
required: false
9+
type: number
10+
default: 3
11+
12+
jobs:
13+
test-hermes-v1-android:
14+
name: Test Hermes V1 on Android
15+
runs-on: 4-core-ubuntu
16+
strategy:
17+
matrix:
18+
flavor: [debug, release]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '22.14.0'
27+
cache: yarn
28+
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v2
31+
with:
32+
java-version: '17'
33+
distribution: 'zulu'
34+
35+
- name: Prepare the app with Hermes V1
36+
uses: ./.github/actions/prepare-hermes-v1-app
37+
with:
38+
retry-count: ${{ inputs.retry-count }}
39+
40+
- name: Build Android with retry
41+
uses: nick-fields/retry@v3
42+
env:
43+
CMAKE_VERSION: 3.31.5
44+
ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64
45+
with:
46+
timeout_minutes: 45
47+
max_attempts: ${{ inputs.retry-count }}
48+
retry_wait_seconds: 30
49+
shell: bash
50+
command: |
51+
cd /tmp/RNApp/android
52+
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
53+
./gradlew assemble${CAPITALIZED_FLAVOR} -PhermesV1Enabled=true
54+
on_retry_command: |
55+
echo "Cleaning up for Android retry..."
56+
cd /tmp/RNApp/android
57+
./gradlew clean || true
58+
rm -rf build app/build .gradle || true
59+
60+
- name: Run E2E Tests
61+
uses: ./.github/actions/maestro-android
62+
timeout-minutes: 60
63+
with:
64+
app-path: /tmp/RNApp/android/app/build/outputs/apk/${{ matrix.flavor }}/app-${{ matrix.flavor }}.apk
65+
app-id: com.rnapp
66+
maestro-flow: ./scripts/e2e/.maestro/
67+
install-java: 'false'
68+
flavor: ${{ matrix.flavor }}
69+
working-directory: /tmp/RNApp
70+
emulator-arch: x86_64

0 commit comments

Comments
 (0)