Skip to content

Compile Hermes Compiler #2

Compile Hermes Compiler

Compile Hermes Compiler #2

name: Compile Hermes Compiler
on:
workflow_dispatch:
inputs:
repo:
type: string
description: Hermes repository to checkout
default: discord/hermes
required: true
commit:
type: string
description: Commit SHA (sdks/.hermesversion)
default: "771efd86736d9c26fadf716ca525255beefffbff"
required: true
jobs:
build:
runs-on: ubuntu-latest
container:
image: emscripten/emsdk:2.0.9
steps:
- uses: actions/checkout@v4
- name: Checkout hermes
uses: actions/checkout@v4
with:
repository: ${{ inputs.repo }}
ref: ${{ inputs.commit }}
path: hermes
- name: Install dependencies
run: |
apt update
apt install -y libicu-dev
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
- name: Apply patches
working-directory: hermes
run: |
for file in ../patches/*.patch; do
patch -p1 < "$file"
done
- name: Build hermesc
run: |
cmake -S hermes -B ./build_host_hermesc
- name: Build emhermesc
env:
LINKER_FLAGS: -s WASM=1 \
-s ALLOW_MEMORY_GROWTH=0 \
-s TOTAL_MEMORY=33554432 \
-s MODULARIZE=1 \
-s INVOKE_RUN=0 \
-s EXIT_RUNTIME=1 \
-s NODERAWFS=1 \
-s BINARYEN_ASYNC_COMPILATION=0 \
-s SINGLE_FILE=0 \
-s WASM_ASYNC_COMPILATION=0 \
run: |
echo LINKER_FLAGS: $LINKER_FLAGS
cmake -S hermes -B ./build_emhermesc \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS" \
-DCMAKE_TOOLCHAIN_FILE="$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DIMPORT_HERMESC="./build_host_hermesc/ImportHermesc.cmake"
cmake --build ./build_emhermesc --target emhermesc -j 4
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: emhermesc
path: ./build_emhermesc/bin/
# - name: Release artifacts
# uses: softprops/action-gh-release@v2
# with:
# tag_name: ${{ inputs.commit }}
# files: |
# ./build_emhermesc/bin/emhermesc.js
# ./build_emhermesc/bin/hermesc.js
# ./build_emhermesc/bin/hermesc.wasm