Skip to content

Commit 8fd8bfc

Browse files
Jakub Piaseckimeta-codesync[bot]
authored andcommitted
Use the Hermes artifacts in actions
Summary: Changelog: [Internal] Differential Revision: D82721725
1 parent 03a4b7f commit 8fd8bfc

File tree

8 files changed

+46
-122
lines changed

8 files changed

+46
-122
lines changed

.github/actions/test-ios-helloworld/action.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,16 @@ runs:
2525
uses: ./.github/actions/setup-node
2626
- name: Run yarn install
2727
uses: ./.github/actions/yarn-install
28-
- name: Create Hermes folder
29-
shell: bash
30-
run: mkdir -p "$HERMES_WS_DIR"
31-
- name: Download Hermes
32-
uses: actions/download-artifact@v4
33-
with:
34-
name: hermes-darwin-bin-${{ inputs.flavor }}
35-
path: /tmp/hermes/hermes-runtime-darwin/
36-
- name: Print Downloaded hermes
37-
shell: bash
38-
run: ls -lR "$HERMES_WS_DIR"
3928
- name: Setup ruby
4029
uses: ruby/setup-ruby@v1
4130
with:
4231
ruby-version: ${{ inputs.ruby-version }}
32+
- name: Set nightly Hermes versions
33+
shell: bash
34+
run: |
35+
node ./scripts/releases/set-hermes-versions.js --nightly
36+
- name: Run yarn install again, with the correct hermes version
37+
uses: ./.github/actions/yarn-install
4338
- name: Download ReactNativeDependencies
4439
uses: actions/download-artifact@v4
4540
with:
@@ -66,20 +61,6 @@ runs:
6661
args+=(--frameworks dynamic)
6762
fi
6863
69-
# Tarball is restored with capital flavors suffix, but somehow the tarball name from JS at line 96 returns as lowercased.
70-
# Let's ensure that the tarballs have the right names
71-
72-
if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz" ]]; then
73-
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-debug.tar.gz"
74-
fi
75-
76-
if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz" ]]; then
77-
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-release.tar.gz"
78-
fi
79-
80-
BUILD_TYPE="${{ inputs.flavor }}"
81-
TARBALL_FILENAME=$(node ../../packages/react-native/scripts/hermes/get-tarball-name.js --buildType "$BUILD_TYPE")
82-
export HERMES_ENGINE_TARBALL_PATH="$HERMES_WS_DIR/hermes-runtime-darwin/$TARBALL_FILENAME"
8364
export RCT_USE_LOCAL_RN_DEP="/tmp/third-party/ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz"
8465
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ inputs.flavor }}.xcframework.tar.gz"
8566

.github/actions/test-ios-rntester/action.yml

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ inputs:
1010
run-unit-tests:
1111
description: whether unit tests should run or not.
1212
default: "false"
13-
hermes-tarball-artifacts-dir:
14-
description: The directory where the hermes tarball artifacts are stored
15-
default: /tmp/hermes/hermes-runtime-darwin
1613
flavor:
1714
description: The flavor of the build. Must be one of "Debug", "Release".
1815
default: Debug
@@ -36,56 +33,19 @@ runs:
3633
uses: ./.github/actions/setup-node
3734
- name: Run yarn
3835
uses: ./.github/actions/yarn-install
39-
- name: Download Hermes
40-
uses: actions/download-artifact@v4
41-
with:
42-
name: hermes-darwin-bin-${{ inputs.flavor }}
43-
path: ${{ inputs.hermes-tarball-artifacts-dir }}
4436
- name: Setup ruby
4537
uses: ruby/setup-ruby@v1
4638
with:
4739
ruby-version: ${{ inputs.ruby-version }}
40+
- name: Set nightly Hermes versions
41+
shell: bash
42+
run: |
43+
node ./scripts/releases/set-hermes-versions.js --nightly
44+
- name: Run yarn install again, with the correct hermes version
45+
uses: ./.github/actions/yarn-install
4846
- name: Prepare IOS Tests
4947
if: ${{ inputs.run-unit-tests == 'true' }}
5048
uses: ./.github/actions/prepare-ios-tests
51-
- name: Set HERMES_ENGINE_TARBALL_PATH envvar if Hermes tarball is present
52-
shell: bash
53-
run: |
54-
HERMES_TARBALL_ARTIFACTS_DIR=${{ inputs.hermes-tarball-artifacts-dir }}
55-
if [ ! -d $HERMES_TARBALL_ARTIFACTS_DIR ]; then
56-
echo "Hermes tarball artifacts dir not present ($HERMES_TARBALL_ARTIFACTS_DIR). Build Hermes from source."
57-
exit 0
58-
fi
59-
60-
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ inputs.flavor }}")
61-
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
62-
63-
echo "Looking for $TARBALL_FILENAME in $HERMES_TARBALL_ARTIFACTS_DIR"
64-
echo "$TARBALL_PATH"
65-
66-
if [ ! -f $TARBALL_PATH ]; then
67-
echo "Hermes tarball not present ($TARBALL_PATH). Build Hermes from source."
68-
exit 0
69-
fi
70-
71-
echo "Found Hermes tarball at $TARBALL_PATH"
72-
echo "HERMES_ENGINE_TARBALL_PATH=$TARBALL_PATH" >> $GITHUB_ENV
73-
- name: Print Hermes version
74-
shell: bash
75-
run: |
76-
HERMES_TARBALL_ARTIFACTS_DIR=${{ inputs.hermes-tarball-artifacts-dir }}
77-
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ inputs.flavor }}")
78-
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
79-
if [[ -e $TARBALL_PATH ]]; then
80-
tar -xf $TARBALL_PATH
81-
echo 'print(HermesInternal?.getRuntimeProperties?.()["OSS Release Version"])' > test.js
82-
chmod +x ./destroot/bin/hermes
83-
./destroot/bin/hermes test.js
84-
rm test.js
85-
rm -rf destroot
86-
else
87-
echo 'No Hermes tarball found.'
88-
fi
8949
- name: Download ReactNativeDependencies
9050
uses: actions/download-artifact@v4
9151
with:
@@ -105,7 +65,6 @@ runs:
10565
- name: Install CocoaPods dependencies
10666
shell: bash
10767
run: |
108-
export HERMES_ENGINE_TARBALL_PATH=$HERMES_ENGINE_TARBALL_PATH
10968
export RCT_USE_LOCAL_RN_DEP="/tmp/third-party/ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz"
11069
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ inputs.flavor }}.xcframework.tar.gz"
11170
@@ -116,7 +75,7 @@ runs:
11675
cd packages/rn-tester
11776
11877
bundle install
119-
bundle exec pod install
78+
bundle exec pod update hermes-engine --no-repo-update
12079
- name: Build RNTester
12180
shell: bash
12281
run: |

.github/workflows/nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ jobs:
108108

109109
prebuild_react_native_core:
110110
uses: ./.github/workflows/prebuild-ios-core.yml
111+
with:
112+
use-hermes-nightly: true
111113
secrets: inherit
112114
needs: [prebuild_apple_dependencies, build_hermes_macos]
113115

.github/workflows/prebuild-ios-core.yml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ name: Prebuild iOS Dependencies
22

33
on:
44
workflow_call: # this directive allow us to call this workflow from other workflows
5-
5+
inputs:
6+
use-hermes-nightly:
7+
description: 'Whether to use the hermes nightly build or read the version from the versions.properties file'
8+
type: boolean
9+
required: false
10+
default: false
611

712
jobs:
813
build-rn-slice:
@@ -36,35 +41,16 @@ jobs:
3641
- name: Yarn Install
3742
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
3843
uses: ./.github/actions/yarn-install
39-
- name: Download Hermes
40-
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
41-
uses: actions/download-artifact@v4
42-
with:
43-
name: hermes-darwin-bin-${{ matrix.flavor }}
44-
path: /tmp/hermes/hermes-runtime-darwin
45-
- name: Extract Hermes
46-
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
44+
- name: Set Hermes version
4745
shell: bash
4846
run: |
49-
HERMES_TARBALL_ARTIFACTS_DIR=/tmp/hermes/hermes-runtime-darwin
50-
if [ ! -d $HERMES_TARBALL_ARTIFACTS_DIR ]; then
51-
echo "Hermes tarball artifacts dir not present ($HERMES_TARBALL_ARTIFACTS_DIR)."
52-
exit 0
47+
if [ "${{ inputs.use-hermes-nightly }}" == "true" ]; then
48+
HERMES_VERSION="nightly"
49+
else
50+
HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
5351
fi
54-
55-
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "${{ matrix.flavor }}")
56-
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
57-
58-
echo "Looking for $TARBALL_FILENAME in $HERMES_TARBALL_ARTIFACTS_DIR"
59-
echo "$TARBALL_PATH"
60-
61-
if [ ! -f $TARBALL_PATH ]; then
62-
echo "Hermes tarball not present ($TARBALL_PATH). Build Hermes from source."
63-
exit 0
64-
fi
65-
66-
echo "Found Hermes tarball at $TARBALL_PATH"
67-
echo "HERMES_ENGINE_TARBALL_PATH=$TARBALL_PATH" >> $GITHUB_ENV
52+
echo "Using Hermes version: $HERMES_VERSION"
53+
echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV
6854
- name: Download ReactNativeDependencies
6955
uses: actions/download-artifact@v4
7056
with:

.github/workflows/test-all.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,15 @@ jobs:
120120

121121
prebuild_react_native_core:
122122
uses: ./.github/workflows/prebuild-ios-core.yml
123+
with:
124+
use-hermes-nightly: ${{ github.branch.endsWith('-stable') ? false : true }}
123125
secrets: inherit
124126
needs: [prebuild_apple_dependencies, build_hermes_macos]
125127

126128
test_ios_rntester_ruby_3_2_0:
127129
runs-on: macos-14
128130
needs:
129131
[build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos, prebuild_apple_dependencies, prebuild_react_native_core]
130-
env:
131-
HERMES_WS_DIR: /tmp/hermes
132-
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
133132
steps:
134133
- name: Checkout
135134
uses: actions/checkout@v4
@@ -145,9 +144,6 @@ jobs:
145144
runs-on: macos-14-large
146145
needs:
147146
[build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos, prebuild_apple_dependencies, prebuild_react_native_core]
148-
env:
149-
HERMES_WS_DIR: /tmp/hermes
150-
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
151147
continue-on-error: true
152148
strategy:
153149
fail-fast: false
@@ -169,9 +165,6 @@ jobs:
169165
runs-on: macos-14-large
170166
needs:
171167
[test_ios_rntester]
172-
env:
173-
HERMES_WS_DIR: /tmp/hermes
174-
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
175168
strategy:
176169
fail-fast: false
177170
matrix:
@@ -259,9 +252,6 @@ jobs:
259252
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
260253
echo "React Native tgs is $REACT_NATIVE_PKG"
261254
262-
HERMES_PATH=$(find /tmp/react-native-tmp -type f -name "*.tar.gz")
263-
echo "Hermes path is $HERMES_PATH"
264-
265255
# For stable branches, we want to use the stable branch of the template
266256
# In all the other cases, we want to use "main"
267257
BRANCH=${{ github.ref_name }}
@@ -278,7 +268,7 @@ jobs:
278268
export RCT_USE_LOCAL_RN_DEP=/tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
279269
# Disable prebuilds for now, as they are causing issues with E2E tests for 0.82-stable branch
280270
# export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ matrix.flavor }}.xcframework.tar.gz"
281-
HERMES_ENGINE_TARBALL_PATH=$HERMES_PATH RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
271+
RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod update hermes-engine --no-repo-update
282272
283273
xcodebuild \
284274
-scheme "RNTestProject" \
@@ -535,6 +525,12 @@ jobs:
535525
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
536526
- name: Run yarn install
537527
uses: ./.github/actions/yarn-install
528+
- name: Set nightly Hermes versions
529+
shell: bash
530+
run: |
531+
node ./scripts/releases/set-hermes-versions.js --nightly
532+
- name: Run yarn install again, with the correct hermes version
533+
uses: ./.github/actions/yarn-install
538534
- name: Prepare the Helloworld application
539535
shell: bash
540536
run: node ./scripts/e2e/init-project-e2e.js --useHelloWorld --pathToLocalReactNative "$GITHUB_WORKSPACE/build/$(cat build/react-native-package-version)"

packages/react-native/scripts/ios-prebuild/hermes.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import type {BuildFlavor, Destination, Platform} from './types';
2929
* environment variable. If this varuable is set, the script will use the local tarball instead of downloading it.
3030
*/
3131
async function prepareHermesArtifactsAsync(
32-
version /*:string*/,
32+
reactNativeVersion /*:string*/,
3333
buildType /*: BuildFlavor */,
3434
) /*: Promise<string> */ {
3535
hermesLog(`Preparing Hermes...`);
@@ -54,7 +54,7 @@ async function prepareHermesArtifactsAsync(
5454
// Only check if the artifacts folder exists if we are not using a local tarball
5555
if (!localPath) {
5656
// Resolve the version from the environment variable or use the default version
57-
let resolvedVersion = process.env.HERMES_VERSION ?? version;
57+
let resolvedVersion = process.env.HERMES_VERSION ?? 'nightly';
5858

5959
if (resolvedVersion === 'nightly') {
6060
hermesLog('Using latest nightly tarball');
@@ -104,7 +104,7 @@ async function prepareHermesArtifactsAsync(
104104

105105
async function getNightlyVersionFromNPM() /*: Promise<string> */ {
106106
const npmResponse /*: Response */ = await fetch(
107-
'https://registry.npmjs.org/react-native/nightly',
107+
'https://registry.npmjs.org/hermes-compiler/nightly',
108108
);
109109

110110
if (!npmResponse.ok) {
@@ -191,15 +191,15 @@ function getTarballUrl(
191191
// The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
192192
const mavenRepoUrl =
193193
process.env.ENTERPRISE_REPOSITORY ?? 'https://repo1.maven.org/maven2';
194-
const namespace = 'com/facebook/react';
195-
return `${mavenRepoUrl}/${namespace}/react-native-artifacts/${version}/react-native-artifacts-${version}-hermes-ios-${buildType.toLowerCase()}.tar.gz`;
194+
const namespace = 'com/facebook/hermes';
195+
return `${mavenRepoUrl}/${namespace}/hermes-ios/${version}/hermes-ios-${version}-hermes-ios-${buildType.toLowerCase()}.tar.gz`;
196196
}
197197

198198
async function getNightlyTarballUrl(
199199
version /*: string */,
200200
buildType /*: BuildFlavor */,
201201
) /*: Promise<string> */ {
202-
const artifactCoordinate = 'react-native-artifacts';
202+
const artifactCoordinate = 'hermes-ios';
203203
const artifactName = `hermes-ios-${buildType.toLowerCase()}.tar.gz`;
204204
return await computeNightlyTarballURL(
205205
version,

packages/react-native/scripts/ios-prebuild/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async function computeNightlyTarballURL(
6565
artifactCoordinate /*: string */,
6666
artifactName /*: string */,
6767
) /*: Promise<string> */ {
68-
const xmlUrl = `https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/${artifactCoordinate}/${version}-SNAPSHOT/maven-metadata.xml`;
68+
const xmlUrl = `https://central.sonatype.com/repository/maven-snapshots/com/facebook/hermes/${artifactCoordinate}/${version}-SNAPSHOT/maven-metadata.xml`;
6969

7070
const response = await fetch(xmlUrl);
7171
if (!response.ok) {
@@ -97,7 +97,7 @@ async function computeNightlyTarballURL(
9797
const buildNumber = buildNumberMatch[1];
9898

9999
const fullVersion = `${version}-${timestamp}-${buildNumber}`;
100-
const finalUrl = `https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/${artifactCoordinate}/${version}-SNAPSHOT/${artifactCoordinate}-${fullVersion}-${artifactName}`;
100+
const finalUrl = `https://central.sonatype.com/repository/maven-snapshots/com/facebook/hermes/${artifactCoordinate}/${version}-SNAPSHOT/${artifactCoordinate}-${fullVersion}-${artifactName}`;
101101
return finalUrl;
102102
}
103103

private/helloworld/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ android {
115115
dependencies {
116116
// The version of react-native is set by the React Native Gradle Plugin
117117
implementation("com.facebook.react:react-android")
118-
implementation("com.facebook.react:hermes-android")
118+
implementation("com.facebook.hermes:hermes-android")
119119
}

0 commit comments

Comments
 (0)