Files
Jakub Piasecki 630f80c143 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
2025-11-18 11:43:11 -08:00

39 lines
1.1 KiB
JavaScript

/**
* 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());