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
30 changes: 24 additions & 6 deletions .github/workflows/build-hermesc-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ on: workflow_call

jobs:
build-hermesc-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- runner: ubuntu-latest
cmake-arch: x86_64
binary-dir: linux64-bin
artifact: hermes-linux-bin
- runner: ubuntu-24.04-arm
cmake-arch: aarch64
binary-dir: linuxarm64-bin
artifact: hermes-linux-arm64-bin
runs-on: ${{ matrix.runner }}
env:
HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin
steps:
Expand All @@ -18,7 +29,7 @@ jobs:
libreadline-dev libicu-dev jq zip python3

sudo mkdir -p /usr/local/cmake
sudo wget -qO- https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-linux-x86_64.tar.gz \
sudo wget -qO- https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-linux-${{ matrix.cmake-arch }}.tar.gz \
| sudo tar --strip-components=1 -xz -C /usr/local/cmake
sudo cp /usr/local/cmake/bin/* /usr/local/bin/
export PATH=/usr/local/bin:$PATH
Expand All @@ -27,17 +38,24 @@ jobs:
- name: Set up workspace
shell: bash
run: |
mkdir -p /tmp/hermes/linux64-bin
mkdir -p /tmp/hermes/${{ matrix.binary-dir }}
- name: Build HermesC for Linux
shell: bash
run: |
cmake -S . -B build -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release -DHERMES_ENABLE_TEST_SUITE=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive"
cmake --build build --target hermesc -j 4
cp build/bin/hermesc /tmp/hermes/linux64-bin/.
cp build/bin/hermesc /tmp/hermes/${{ matrix.binary-dir }}/.
test "$(uname -m)" = '${{ matrix.cmake-arch }}'
/tmp/hermes/${{ matrix.binary-dir }}/hermesc --version
printf 'print(1);\n' > /tmp/hermes/smoke.js
/tmp/hermes/${{ matrix.binary-dir }}/hermesc -emit-binary \
-out /tmp/hermes/smoke.hbc /tmp/hermes/smoke.js
test -s /tmp/hermes/smoke.hbc
- name: Upload linux artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: hermes-linux-bin
path: /tmp/hermes/linux64-bin
name: ${{ matrix.artifact }}
path: /tmp/hermes/${{ matrix.binary-dir }}
if-no-files-found: error
21 changes: 21 additions & 0 deletions .github/workflows/rn-build-hermes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ jobs:
with:
name: hermes-linux-bin
path: /tmp/hermes/linux64-bin
- name: Download linux-arm64-bin artifacts
uses: actions/download-artifact@v4
with:
name: hermes-linux-arm64-bin
path: /tmp/hermes/linuxarm64-bin
- name: Download windows-bin artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -167,6 +172,22 @@ jobs:
shell: bash
run: |
node ./utils/scripts/hermes/prepare-artifacts.js
- name: Verify Linux compilers are included in the npm package
shell: bash
run: |
node - <<'NODE'
const {execFileSync} = require('node:child_process');
const [packed] = JSON.parse(execFileSync('npm', ['pack', '--dry-run', '--json'], {
cwd: 'npm/hermes-compiler',
}));
const files = new Set(packed.files.map(file => file.path));
for (const binary of [
'hermesc/linux64-bin/hermesc',
'hermesc/linuxarm64-bin/hermesc',
]) {
if (!files.has(binary)) throw new Error(`Missing from npm package: ${binary}`);
}
NODE
- name: Print Artifacts Directory
shell: bash
run: ls -lR ./android/ios-artifacts/artifacts/
Expand Down
11 changes: 11 additions & 0 deletions utils/scripts/hermes/prepare-artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function copyHermesBinaries() {
// Create directories for npm/hermes-compiler/hermesc binaries
mkdir('-p', './npm/hermes-compiler/hermesc/osx-bin');
mkdir('-p', './npm/hermes-compiler/hermesc/linux64-bin');
mkdir('-p', './npm/hermes-compiler/hermesc/linuxarm64-bin');
mkdir('-p', './npm/hermes-compiler/hermesc/win64-bin');

const osxBinDir = path.join(HERMES_WS_DIR, 'osx-bin');
Expand Down Expand Up @@ -82,6 +83,16 @@ function copyHermesBinaries() {
path.join(HERMES_WS_DIR, 'linux64-bin/*'),
'./npm/hermes-compiler/hermesc/linux64-bin/.',
);
echo('Copying Linux ARM64 binary...');
const linuxArm64Hermesc = path.join(HERMES_WS_DIR, 'linuxarm64-bin', 'hermesc');
if (!test('-f', linuxArm64Hermesc)) {
echo('Could not locate Linux ARM64 hermesc binary.');
exit(1);
}
cp(
linuxArm64Hermesc,
'./npm/hermes-compiler/hermesc/linuxarm64-bin/.',
);

echo('Making hermesc files executable...');
chmod('-R', '+x', 'npm/hermes-compiler/hermesc/*');
Expand Down