Skip to content
Merged
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
6 changes: 4 additions & 2 deletions .ado/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ function cmakeConfigure(buildParams) {
// Use prebuilt Hermes compiler for cross-platform builds
if (isCrossPlatformBuild(buildParams)) {
genArgs.push(
`-DIMPORT_HERMESC="${path.join(toolsPath, "ImportHermesc.cmake")}"`,
`-DIMPORT_HOST_COMPILERS="${path.join(toolsPath, "ImportHostCompilers.cmake")}"`,
);
}

Expand Down Expand Up @@ -894,7 +894,9 @@ function setupJSTestEnvPaths() {
const pythonScriptsDir = path.join(pythonDir, "Scripts");
console.log(`Found Python at: ${pythonDir}`);
if (!process.env.PATH.includes(pythonDir)) {
console.log(`Adding python directories to PATH: ${pythonDir}, ${pythonScriptsDir}`);
console.log(
`Adding python directories to PATH: ${pythonDir}, ${pythonScriptsDir}`,
);
process.env.PATH = `${pythonDir};${pythonScriptsDir};${process.env.PATH}`;
}
})();
Expand Down
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Checks: >
readability-identifier-naming,
readability-inconsistent-declaration-parameter-name,
readability-static-accessed-through-instance,
-facebook-hte-MissingBraces,
FormatStyle: file
InheritParentConfig: true
HeaderFilterRegex: include/hermes/.*
Expand Down
11 changes: 11 additions & 0 deletions .github/actions/install-cmake/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Install CMake
runs:
using: composite
steps:
- name: Install CMake
shell: bash
run: |-
if ! brew list cmake &> /dev/null; then
echo "Installing CMake"
brew install cmake
fi
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.4.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
59 changes: 59 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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
hermes-version:
required: true
description: The Hermes version to use for this build
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 git safe folders
shell: bash
run: git config --global --add safe.directory '*'
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install node dependencies
uses: ./.github/actions/yarn-install
- name: Set artifacts version
shell: bash
run: node ./utils/scripts/hermes/set-artifacts-version.js --build-type ${{ inputs.release-type }} --hermesVersion "${{ inputs.hermes-version }}"
- name: Build android
shell: bash
run: |
cd android

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

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

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
hermes-version:
required: true
description: The Hermes version to use for this build
type: string

jobs:
build_apple_slices_hermes:
runs-on: macos-15
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 git safe folders
shell: bash
run: git config --global --add safe.directory '*'
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install node dependencies
uses: ./.github/actions/yarn-install
- name: Set artifacts version
shell: bash
run: node ./utils/scripts/hermes/set-artifacts-version.js --build-type ${{ inputs.release-type }} --hermesVersion "${{ inputs.hermes-version }}"
- 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.sh
BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-mac-framework.sh
else
echo "[HERMES] Building Hermes for iOS: $SLICE"

chmod +x ./utils/build-ios-framework.sh
BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-ios-framework.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/[email protected]
with:
name: slice-${{ matrix.slice }}-${{ matrix.flavor }}
path: ./build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz
48 changes: 48 additions & 0 deletions .github/workflows/build-emscripten.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build-emscripten

on:
workflow_call

jobs:
build-emscripten:
runs-on: ubuntu-22.04
container:
image: emscripten/emsdk:3.1.17
steps:
- name: Install dependencies
run: |-
apt update
apt install -y libicu-dev libreadline-dev
- uses: actions/[email protected]
with:
path: hermes
- name: Build Hermes Compiler
run: |-
cmake -S hermes -B build_host_hermesc
cmake --build ./build_host_hermesc --target hermesc -j 4
- name: Build Hermes with Emscripten for Website Playground
run: |-
echo LINKER_FLAGS: $LINKER_FLAGS
cmake -S hermes -B playground \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS" \
-DCMAKE_TOOLCHAIN_FILE="$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DIMPORT_HOST_COMPILERS="$PWD/build_host_hermesc/ImportHostCompilers.cmake"
cmake --build ./playground --target hermes -j 4
cmake --build ./playground --target hermesc -j 4
cmake --build ./playground --target emhermesc -j 4
EMHERMESC="$PWD/playground/bin/emhermesc.js" node ./hermes/tools/emhermesc/test.js
env:
LINKER_FLAGS: "-s WASM=1 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=33554432 -s MODULARIZE=1 -s EXPORT_NAME=createHermes -s INVOKE_RUN=0 -s EXIT_RUNTIME=1 -s NODERAWFS=0 -s EXTRA_EXPORTED_RUNTIME_METHODS=[callMain,FS] -s EXPORTED_FUNCTIONS=[_malloc,_free]"
- name: Create Playground tarball
run: |-
mkdir output staging
cp ./playground/bin/hermes.js ./playground/bin/hermes.wasm staging
tar -C staging -czvf output/${TAR_NAME} .
shasum -a 256 output/${TAR_NAME} > output/${TAR_NAME}.sha256
env:
TAR_NAME: hermes-cli-emscripten.tar.gz
- uses: actions/[email protected]
with:
name: emscripten-hermes
path: output
Loading