Skip to content

Commit f9574e2

Browse files
Saadnajmiclaude
andcommitted
feat: enable Hermes and ReactNativeDependencies builds for macOS SPM
Add comprehensive build pipeline for macOS SPM support: - Create build-hermes-macos-spm.yml workflow to build Hermes for macOS - Use Hermes commit e0fc67142ec0763c6b6153ca2bf96df815539782 (at merge base) - Add ReactNativeDependencies build workflow call - Re-enable build-spm-macos in PR validation with proper dependencies The workflow now builds all required artifacts: 1. Hermes for macOS (Debug + Release) 2. ReactNativeDependencies including macOS slice 3. React Native SPM build for macOS Estimated CI time: ~90-120 minutes for full build pipeline Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 72f1dc5 commit f9574e2

File tree

2 files changed

+157
-6
lines changed

2 files changed

+157
-6
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Build Hermes for macOS SPM
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
hermes-version:
7+
description: "The version of Hermes that was built"
8+
value: ${{ jobs.prepare_hermes_workspace.outputs.hermes-version }}
9+
react-native-version:
10+
description: "The version of React Native"
11+
value: ${{ jobs.prepare_hermes_workspace.outputs.react-native-version }}
12+
13+
jobs:
14+
prepare_hermes_workspace:
15+
runs-on: ubuntu-latest
16+
env:
17+
HERMES_WS_DIR: /tmp/hermes
18+
HERMES_VERSION_FILE: packages/react-native/sdks/.hermesversion
19+
# Use the Hermes commit at the merge base with facebook/react-native
20+
HERMES_COMMIT: e0fc67142ec0763c6b6153ca2bf96df815539782
21+
outputs:
22+
react-native-version: ${{ steps.prepare-hermes-workspace.outputs.react-native-version }}
23+
hermes-version: ${{ steps.prepare-hermes-workspace.outputs.hermes-version }}
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Prepare Hermes Workspace
28+
id: prepare-hermes-workspace
29+
uses: ./.github/actions/prepare-hermes-workspace
30+
with:
31+
hermes-ws-dir: ${{ env.HERMES_WS_DIR }}
32+
hermes-version-file: ${{ env.HERMES_VERSION_FILE }}
33+
34+
build_hermesc_apple:
35+
runs-on: macos-14
36+
needs: prepare_hermes_workspace
37+
env:
38+
HERMES_WS_DIR: /tmp/hermes
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
- name: Build HermesC Apple
43+
uses: ./.github/actions/build-hermesc-apple
44+
with:
45+
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
46+
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
47+
48+
build_macos_slice:
49+
runs-on: macos-14
50+
needs: [build_hermesc_apple, prepare_hermes_workspace]
51+
env:
52+
HERMES_WS_DIR: /tmp/hermes
53+
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
54+
HERMES_OSXBIN_ARTIFACTS_DIR: /tmp/hermes/osx-bin
55+
MAC_DEPLOYMENT_TARGET: "10.15"
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
flavor: [Debug, Release]
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
- name: Build macOS Slice
64+
uses: ./.github/actions/build-apple-slices-hermes
65+
with:
66+
flavor: ${{ matrix.flavor }}
67+
slice: macosx
68+
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
69+
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
70+
71+
package_hermes_macos:
72+
runs-on: macos-14
73+
needs: [build_macos_slice, prepare_hermes_workspace]
74+
env:
75+
HERMES_WS_DIR: /tmp/hermes
76+
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
flavor: [Debug, Release]
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
- name: Setup toolchain
85+
uses: ./.github/actions/microsoft-setup-toolchain
86+
with:
87+
platform: macos
88+
node-version: '22'
89+
- name: Download macOS slice
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: slice-macosx-${{ matrix.flavor }}
93+
path: ./packages/react-native/sdks/hermes/
94+
- name: Unzip slice
95+
shell: bash
96+
run: |
97+
cd ./packages/react-native/sdks/hermes
98+
tar -xzv -f build_macosx_${{ matrix.flavor }}.tar.gz
99+
mv build_macosx_${{ matrix.flavor }} build_macosx
100+
- name: Prepare destroot folder
101+
shell: bash
102+
run: |
103+
cd ./packages/react-native/sdks/hermes || exit 1
104+
chmod +x ./utils/build-apple-framework.sh
105+
. ./utils/build-apple-framework.sh
106+
prepare_dest_root_for_ci
107+
- name: Create framework for macOS
108+
shell: bash
109+
run: |
110+
cd ./packages/react-native/sdks/hermes || exit 1
111+
echo "[HERMES] Creating the macOS framework"
112+
chmod +x ./utils/build-ios-framework.sh
113+
# Only build for macOS, not the full iOS framework
114+
./utils/build-ios-framework.sh build_framework
115+
chmod +x ./destroot/bin/hermesc
116+
- name: Package Hermes macOS tarball
117+
shell: bash
118+
run: |
119+
BUILD_TYPE="${{ matrix.flavor }}"
120+
echo "Packaging Hermes for macOS $BUILD_TYPE build type"
121+
122+
TARBALL_OUTPUT_DIR=$(mktemp -d /tmp/hermes-tarball-output-XXXXXXXX)
123+
124+
TARBALL_FILENAME=$(node ./packages/react-native/scripts/hermes/get-tarball-name.js --buildType "$BUILD_TYPE")
125+
126+
TARBALL_OUTPUT_PATH=$(node ./packages/react-native/scripts/hermes/create-tarball.js \
127+
--inputDir ./packages/react-native/sdks/hermes \
128+
--buildType "$BUILD_TYPE" \
129+
--outputDir $TARBALL_OUTPUT_DIR)
130+
131+
echo "Hermes tarball saved to $TARBALL_OUTPUT_PATH"
132+
133+
mkdir -p $HERMES_TARBALL_ARTIFACTS_DIR
134+
cp $TARBALL_OUTPUT_PATH $HERMES_TARBALL_ARTIFACTS_DIR/.
135+
136+
ls -lh $HERMES_TARBALL_ARTIFACTS_DIR
137+
- name: Upload Hermes tarball
138+
uses: actions/upload-artifact@v4.3.4
139+
with:
140+
name: hermes-darwin-bin-${{ matrix.flavor }}
141+
path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz

.github/workflows/microsoft-pr.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,21 @@ jobs:
132132
permissions: {}
133133
uses: ./.github/workflows/microsoft-build-rntester.yml
134134

135-
# TODO: Re-enable once Hermes and ReactNativeDependencies build jobs are set up
136-
# build-spm-macos:
137-
# name: "Build SPM macOS"
138-
# permissions: {}
139-
# uses: ./.github/workflows/prebuild-macos-core.yml
135+
build-hermes-macos:
136+
name: "Build Hermes for macOS"
137+
permissions: {}
138+
uses: ./.github/workflows/build-hermes-macos-spm.yml
139+
140+
build-react-native-dependencies:
141+
name: "Build ReactNativeDependencies"
142+
permissions: {}
143+
uses: ./.github/workflows/prebuild-ios-dependencies.yml
144+
145+
build-spm-macos:
146+
name: "Build SPM macOS"
147+
permissions: {}
148+
needs: [build-hermes-macos, build-react-native-dependencies]
149+
uses: ./.github/workflows/prebuild-macos-core.yml
140150

141151
# https://github.com/microsoft/react-native-macos/issues/2344
142152
# Disable these tests because verdaccio hangs
@@ -164,7 +174,7 @@ jobs:
164174
- yarn-constraints
165175
- javascript-tests
166176
- build-rntester
167-
# - build-spm-macos # TODO: Re-enable once prerequisites are set up
177+
- build-spm-macos
168178
# - test-react-native-macos-init
169179
# - react-native-test-app-integration
170180
steps:

0 commit comments

Comments
 (0)