build-apple-slices-hermes workflow (facebook/hermes)
The build-apple-slices-hermes workflow from facebook/hermes, explained and optimized by Latchkey.
A
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the build-apple-slices-hermes workflow from the facebook/hermes repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: build-apple-slices-hermes
on: workflow_call
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 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
echo "[HERMES] Building Hermes for $SLICE"
BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-apple-framework.sh "$SLICE"
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
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: build-apple-slices-hermes on: workflow_call jobs: build_apple_slices_hermes: timeout-minutes: 30 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 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 echo "[HERMES] Building Hermes for $SLICE" BUILD_TYPE="${{ matrix.flavor }}" ./utils/build-apple-framework.sh "$SLICE" 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
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job (16 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.