Files
scriptc/.github/actions/libnode/action.yml
T
Malte UblandClaude Opus 5.5 5f3e97998d Merge the macOS island fixes of ni/1-libnode-loader
The libnode-linux action becomes .github/actions/libnode, which serves
the Linux x64 and macOS lanes: the libnode-packs cache for the runner's
platform, else the development pack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 12:50:39 -07:00

65 lines
3.4 KiB
YAML

name: libnode pack (Linux x64, macOS)
description: >-
Provide the runner's libnode pack for the Node island tests and export
SCRIPTC_LIBNODE. Restores the libnode build that the libnode-packs
workflow cached and assembles @scriptc/libnode-<platform> from it (the
bridge compiles in seconds; Node is never built here). Until that cache
exists for this ref, it falls back to the pinned, checksum-verified
development pack (packages/libnode-common/dev-pack.json). Fails the job if
no pack results: the island tests must never skip in CI.
runs:
using: composite
steps:
- name: Name the runner's pack
id: target
shell: bash
run: |
case "$RUNNER_OS-$RUNNER_ARCH" in
Linux-X64) platform=linux-x64-gnu toolchain=manylinux_2_28-gcc-toolset-14 bridge=libscr_node_bridge.so ;;
macOS-ARM64) platform=darwin-arm64 toolchain=macos-15-xcode-clang bridge=libscr_node_bridge.dylib ;;
macOS-X64) platform=darwin-x64 toolchain=macos-15-xcode-clang bridge=libscr_node_bridge.dylib ;;
*) echo "::error::no libnode pack for $RUNNER_OS $RUNNER_ARCH"; exit 1 ;;
esac
printf 'platform=%s\ntoolchain=%s\nbridge=%s\n' "$platform" "$toolchain" "$bridge" >> "$GITHUB_OUTPUT"
- name: Compute the libnode cache key
id: key
shell: bash
env:
SCRIPTC_LIBNODE_TOOLCHAIN: ${{ steps.target.outputs.toolchain }}
run: node packages/libnode-common/scripts/cache-key.mjs --platform ${{ steps.target.outputs.platform }} >> "$GITHUB_OUTPUT"
- uses: actions/cache/restore@v4
id: libnode
with:
path: .libnode-cache/${{ steps.key.outputs.path }}
key: ${{ steps.key.outputs.key }}
- name: Assemble @scriptc/libnode-${{ steps.target.outputs.platform }}
if: steps.libnode.outputs.cache-hit == 'true'
shell: bash
env:
SCRIPTC_LIBNODE_TOOLCHAIN: ${{ steps.target.outputs.toolchain }}
SCRIPTC_LIBNODE_CACHE: ${{ github.workspace }}/.libnode-cache
run: |
node packages/libnode-${{ steps.target.outputs.platform }}/scripts/build.mjs --from-cache
node packages/libnode-common/scripts/verify.mjs packages/libnode-${{ steps.target.outputs.platform }}
echo "SCRIPTC_LIBNODE=$GITHUB_WORKSPACE/packages/libnode-${{ steps.target.outputs.platform }}" >> "$GITHUB_ENV"
- uses: actions/cache@v4
if: steps.libnode.outputs.cache-hit != 'true'
id: devpack
with:
path: ${{ runner.temp }}/libnode-dev-pack
key: libnode-dev-pack-${{ steps.target.outputs.platform }}-${{ hashFiles('packages/libnode-common/dev-pack.json', 'packages/libnode-common/build-pack.mjs', 'packages/libnode-common/fetch-dev-pack.mjs', 'packages/libnode-common/bridge/**', 'packages/runtime/src/scr_node_bridge.h') }}
- name: Assemble the development pack
if: steps.libnode.outputs.cache-hit != 'true'
shell: bash
run: |
echo "::notice::no cached libnode-packs build for ${{ steps.key.outputs.key }}; using the development pack"
if [ "${{ steps.devpack.outputs.cache-hit }}" != true ]; then
node packages/libnode-common/fetch-dev-pack.mjs --out "$RUNNER_TEMP/libnode-dev-pack"
fi
echo "SCRIPTC_LIBNODE=$RUNNER_TEMP/libnode-dev-pack" >> "$GITHUB_ENV"
- name: Check the pack
shell: bash
run: |
test -f "$SCRIPTC_LIBNODE/manifest.json"
test -f "$SCRIPTC_LIBNODE/${{ steps.target.outputs.bridge }}"