Setup basic Hermes V1 E2E tests (#54576)

Summary:
Adds a new action that will run every day after the nightly build is published. This action will set up a blank app from the template, enable Hermes V1, and run a simple E2E test on Android and iOS in both Debug and Release configurations.

## Changelog:

[INTERNAL] [ADDED] - Added basic E2E tests for Hermes V1

Pull Request resolved: https://github.com/facebook/react-native/pull/54576

Test Plan: I haven't tested the changes since they require larger action runners, but the changes are additive and don't impact existing infra (besides adding an optional parameter).

Reviewed By: cortinico

Differential Revision: D87331639

Pulled By: j-piasecki

fbshipit-source-id: 8d26cb7df66f2588b49f86f01ff0b623501e7f2b
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2025-11-18 11:43:11 -08:00
1 parent 66f628519e
commit 630f80c143
7 files changed
+303 -3

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
diff --git a/android/settings.gradle b/android/settings.gradle
index 63b5d4e..6359ec3 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -4,3 +4,11 @@ extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autoli
rootProject.name = 'RNApp'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
+
+includeBuild('../node_modules/react-native') {
+ dependencySubstitution {
+ substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid"))
+ substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid"))
+ substitute(project(":packages:react-native:ReactAndroid:hermes-engine")).using(module("com.facebook.hermes:hermes-android:$HERMES_V1_VERSION"))
+ }
+}
diff --git a/package.json b/package.json
index f05d51b..69938af 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,9 @@
"react-test-renderer": "19.2.0",
"typescript": "^5.8.3"
},
+ "resolutions": {
+ "hermes-compiler": "$HERMES_V1_VERSION"
+ },
"engines": {
"node": ">=20"
}
@@ -0,0 +1,38 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const PATCH_FILE_PATH = path.join(__dirname, 'hermes-v1.patch');
function getLatestHermesV1Version() {
const npmString = "npm view hermes-compiler@latest-v1 version";
try {
const result = execSync(npmString, { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
return result;
} catch (error) {
throw new Error(`Failed to get package version for hermes-compiler@latest-v1`);
}
}
function setHermesV1VersionInPatch(version) {
if (!fs.existsSync(PATCH_FILE_PATH)) {
throw new Error(`Patch file not found at path: ${PATCH_FILE_PATH}`);
}
let patchContent = fs.readFileSync(PATCH_FILE_PATH, 'utf8');
const updatedContent = patchContent.replaceAll(
"$HERMES_V1_VERSION",
version
);
fs.writeFileSync(PATCH_FILE_PATH, updatedContent, 'utf8');
}
setHermesV1VersionInPatch(getLatestHermesV1Version());