Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup node.js
description: 'Set up your GitHub Actions workflow with a specific version of node.js'
inputs:
node-version:
description: 'The node.js version to use'
required: false
default: '22.14.0'
runs:
using: "composite"
steps:
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
14 changes: 14 additions & 0 deletions .github/actions/setup-xcode/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup xcode
description: 'Set up your GitHub Actions workflow with a specific version of xcode'
inputs:
xcode-version:
description: 'The xcode version to use'
required: false
default: '16.2.0'
runs:
using: "composite"
steps:
- name: Setup xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: ${{ inputs.xcode-version }}
23 changes: 23 additions & 0 deletions .github/actions/yarn-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: yarn-install
runs:
using: composite
steps:
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install dependencies
shell: bash
run: |
cd utils/scripts/hermes
MAX_ATTEMPTS=2
ATTEMPT=0
WAIT_TIME=20
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
yarn install --non-interactive --frozen-lockfile && break
echo "yarn install failed. Retrying in $WAIT_TIME seconds..."
sleep $WAIT_TIME
ATTEMPT=$((ATTEMPT + 1))
done
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
echo "All attempts to invoke yarn install failed - Aborting the workflow"
exit 1
fi
52 changes: 52 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: build-android

on:
workflow_call:
inputs:
release-type:
required: true
description: The type of release we are building. It could be commitly, release or dry-run
type: string

jobs:
build-android:
runs-on: 8-core-ubuntu
env:
HERMES_WS_DIR: /home/runner/work/hermes/hermes
container:
image: reactnativecommunity/react-native-android:latest
env:
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install node dependencies
uses: ./.github/actions/yarn-install
- name: Set React Native Version
shell: bash
run: node ./utils/scripts/hermes/set-artifacts-version.js --build-type ${{ inputs.release-type }}
- name: Build android
shell: bash
run: |
cd android

if [[ "${{ inputs.release-type }}" == "commitly" ]]; then
export ORG_GRADLE_PROJECT_isSnapshot="true"
TASKS="publishAndroidOnlyToMavenTempLocal publishAndroidOnlyToSonatype :build"
else
TASKS="publishAndroidOnlyToMavenTempLocal :build"
fi

./gradlew $TASKS -PenableWarningsAsErrors=true
- name: Upload Maven Artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: maven-local
path: /tmp/maven-local
86 changes: 86 additions & 0 deletions .github/workflows/build-apple-slices-hermes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: build-apple-slices-hermes

on: workflow_call

jobs:
build_apple_slices_hermes:
runs-on: macos-14
env:
IOS_DEPLOYMENT_TARGET: "15.1"
XROS_DEPLOYMENT_TARGET: "1.0"
MAC_DEPLOYMENT_TARGET: "10.15"
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
slice:
[
macosx,
iphoneos,
iphonesimulator,
appletvos,
appletvsimulator,
catalyst,
xros,
xrsimulator,
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup xcode
uses: ./.github/actions/setup-xcode
- name: Restore HermesC Artifact
uses: actions/download-artifact@v4
with:
name: hermesc-apple
path: ./build_host_hermesc
- name: Build the Hermes ${{ matrix.slice }} frameworks
shell: bash
run: |
SLICE=${{ matrix.slice }}
FLAVOR=${{ matrix.flavor }}
FINAL_PATH=build_"$SLICE"_"$FLAVOR"
echo "Final path for this slice is: $FINAL_PATH"

# HermesC is used to build hermes, so it has to be executable
chmod +x ./build_host_hermesc/bin/hermesc

if [[ "$SLICE" == "macosx" ]]; then
echo "[HERMES] Building Hermes for MacOS"

chmod +x ./utils/build-mac-framework-rn.sh
BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-mac-framework-rn.sh
else
echo "[HERMES] Building Hermes for iOS: $SLICE"

chmod +x ./utils/build-ios-framework-rn.sh
BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-ios-framework-rn.sh "$SLICE"
fi

echo "Moving from build_$SLICE to $FINAL_PATH"
mv build_"$SLICE" "$FINAL_PATH"

# check whether everything is there
if [[ -d "$FINAL_PATH/lib/hermesvm.framework" ]]; then
echo "Successfully built hermesvm.framework for $SLICE in $FLAVOR"
else
echo "Failed to built hermesvm.framework for $SLICE in $FLAVOR"
exit 1
fi

if [[ -d "$FINAL_PATH/lib/hermesvm.framework.dSYM" ]]; then
echo "Successfully built hermesvm.framework.dSYM for $SLICE in $FLAVOR"
else
echo "Failed to built hermesvm.framework.dSYM for $SLICE in $FLAVOR"
echo "Please try again"
exit 1
fi
- name: Compress slices to preserve Symlinks
shell: bash
run: |
tar -czv -f build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz build_${{ matrix.slice }}_${{ matrix.flavor }}
- name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }})
uses: actions/upload-artifact@v4.3.4
with:
name: slice-${{ matrix.slice }}-${{ matrix.flavor }}
path: ./build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz
144 changes: 144 additions & 0 deletions .github/workflows/build-hermes-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: build-hermes-macos

on: workflow_call

jobs:
build-hermes-macos:
runs-on: macos-14
continue-on-error: true
env:
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup xcode
uses: ./.github/actions/setup-xcode
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Yarn Install Dependencies
uses: ./.github/actions/yarn-install
- name: Download slice artifacts
uses: actions/download-artifact@v4
with:
pattern: slice-*-${{ matrix.flavor }}
path: .
merge-multiple: true
- name: Unzip slices
shell: bash
run: |
ls -l .
tar -xzv -f build_catalyst_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_iphoneos_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_iphonesimulator_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_appletvos_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_appletvsimulator_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_macosx_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_xros_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_xrsimulator_${{ matrix.flavor }}.tar.gz
- name: Move back build folders
shell: bash
run: |
ls -l build_*
mv build_catalyst_${{ matrix.flavor }} build_catalyst
mv build_iphoneos_${{ matrix.flavor }} build_iphoneos
mv build_iphonesimulator_${{ matrix.flavor }} build_iphonesimulator
mv build_appletvos_${{ matrix.flavor }} build_appletvos
mv build_appletvsimulator_${{ matrix.flavor }} build_appletvsimulator
mv build_macosx_${{ matrix.flavor }} build_macosx
mv build_xros_${{ matrix.flavor }} build_xros
mv build_xrsimulator_${{ matrix.flavor }} build_xrsimulator
- name: Prepare destroot folder
shell: bash
run: |
chmod +x ./utils/build-apple-framework-rn.sh
source ./utils/build-apple-framework-rn.sh
prepare_dest_root_for_ci
- name: Create fat framework for iOS
shell: bash
run: |
echo "[HERMES] Creating the universal framework"
chmod +x ./utils/build-ios-framework-rn.sh
./utils/build-ios-framework-rn.sh build_framework

chmod +x ./destroot/bin/hermesc
- name: Package the Hermes Apple frameworks
shell: bash
run: |
BUILD_TYPE="${{ matrix.flavor }}"
echo "Packaging Hermes Apple frameworks for $BUILD_TYPE build type"

TARBALL_OUTPUT_DIR=$(mktemp -d /tmp/hermes-tarball-output-XXXXXXXX)

echo "Packaging Hermes Apple frameworks for $BUILD_TYPE build type"

TARBALL_OUTPUT_PATH=$(node ./utils/scripts/hermes/create-tarball.js \
--inputDir . \
--buildType "$BUILD_TYPE" \
--outputDir $TARBALL_OUTPUT_DIR)

echo "Hermes tarball saved to $TARBALL_OUTPUT_PATH"

mkdir -p $HERMES_TARBALL_ARTIFACTS_DIR
cp $TARBALL_OUTPUT_PATH $HERMES_TARBALL_ARTIFACTS_DIR/.

mkdir -p /tmp/hermes/osx-bin/${{ matrix.flavor }}
cp ./build_macosx/bin/* /tmp/hermes/osx-bin/${{ matrix.flavor }}
ls -lR /tmp/hermes/osx-bin/
- name: Create dSYM archive
shell: bash
run: |
FLAVOR=${{ matrix.flavor }}
WORKING_DIR="/tmp/hermes_tmp/dSYM/$FLAVOR"

mkdir -p "$WORKING_DIR/macosx"
mkdir -p "$WORKING_DIR/catalyst"
mkdir -p "$WORKING_DIR/iphoneos"
mkdir -p "$WORKING_DIR/iphonesimulator"
mkdir -p "$WORKING_DIR/appletvos"
mkdir -p "$WORKING_DIR/appletvsimulator"
mkdir -p "$WORKING_DIR/xros"
mkdir -p "$WORKING_DIR/xrsimulator"

DSYM_FILE_PATH=lib/hermesvm.framework.dSYM
cp -r build_macosx/$DSYM_FILE_PATH "$WORKING_DIR/macosx/"
cp -r build_catalyst/$DSYM_FILE_PATH "$WORKING_DIR/catalyst/"
cp -r build_iphoneos/$DSYM_FILE_PATH "$WORKING_DIR/iphoneos/"
cp -r build_iphonesimulator/$DSYM_FILE_PATH "$WORKING_DIR/iphonesimulator/"
cp -r build_appletvos/$DSYM_FILE_PATH "$WORKING_DIR/appletvos/"
cp -r build_appletvsimulator/$DSYM_FILE_PATH "$WORKING_DIR/appletvsimulator/"
cp -r build_xros/$DSYM_FILE_PATH "$WORKING_DIR/xros/"
cp -r build_xrsimulator/$DSYM_FILE_PATH "$WORKING_DIR/xrsimulator/"

DEST_DIR="/tmp/hermes/dSYM/$FLAVOR"
tar -C "$WORKING_DIR" -czvf "hermesvm.framework.dSYM" .

mkdir -p "$DEST_DIR"
mv "hermesvm.framework.dSYM" "$DEST_DIR"
- name: Upload hermes dSYM artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: hermes-dSYM-${{ matrix.flavor }}
path: /tmp/hermes/dSYM/${{ matrix.flavor }}
- name: Upload hermes Runtime artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: hermes-darwin-bin-${{ matrix.flavor }}
path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz
- name: Upload hermes osx artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: hermes-osx-bin-${{ matrix.flavor }}
path: /tmp/hermes/osx-bin/${{ matrix.flavor }}
- name: Upload Hermes Artifacts
uses: actions/cache/save@v4
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
with:
key: v4-hermes-artifacts-${{ matrix.flavor }}-${{ matrix.hermes-version }}-${{ matrix.react-native-version }}-${{ hashFiles('./packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}
path: |
/tmp/hermes/osx-bin/${{ matrix.flavor }}
/tmp/hermes/dSYM/${{ matrix.flavor }}
/tmp/hermes/hermes-runtime-darwin/hermes-ios-${{ matrix.flavor }}.tar.gz
22 changes: 22 additions & 0 deletions .github/workflows/build-hermesc-apple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build-hermesc-apple

on: workflow_call

jobs:
build-hermesc-apple:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup xcode
uses: ./.github/actions/setup-xcode
- name: Build HermesC Apple
shell: bash
run: |
source ./utils/build-apple-framework-rn.sh
build_host_hermesc_if_needed
- name: Upload HermesC Artifact
uses: actions/upload-artifact@v4.3.4
with:
name: hermesc-apple
path: ./build_host_hermesc
Loading
Loading