mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Stack the libnode packs on the in-process loader (#1685) and use its pack assembler and manifest format instead of a second one: build-pack.mjs keeps its CLI and fields (schema, nodeVersion, moduleVersion, bridgeAbi, platform, arch, files), adds the libnode and bridge names, strips and (on macOS) re-signs the bridge and links it with -z defs, and exports buildPack(), which the platform packs call with their package, target and build inputs as extra manifest fields. libnodeRecord falls back to the installed @scriptc/libnode-<platform> pack, found from the entry's directory and then next to the compiler, when neither --libnode nor SCRIPTC_LIBNODE names one. The Linux test lanes restore the libnode build that the libnode-packs workflow cached, assemble the linux-x64 pack from it in seconds (build.mjs --from-cache never builds Node) and export SCRIPTC_LIBNODE, so the Node island corpus and harness tests run instead of skipping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.6 KiB
YAML
54 lines
2.6 KiB
YAML
name: libnode pack (Linux x64)
|
|
description: >-
|
|
Provide the linux-x64 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-linux-x64-gnu 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: Compute the libnode cache key
|
|
id: key
|
|
shell: bash
|
|
env:
|
|
SCRIPTC_LIBNODE_TOOLCHAIN: manylinux_2_28-gcc-toolset-14
|
|
run: node packages/libnode-common/scripts/cache-key.mjs --platform linux-x64-gnu >> "$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-linux-x64-gnu
|
|
if: steps.libnode.outputs.cache-hit == 'true'
|
|
shell: bash
|
|
env:
|
|
SCRIPTC_LIBNODE_TOOLCHAIN: manylinux_2_28-gcc-toolset-14
|
|
SCRIPTC_LIBNODE_CACHE: ${{ github.workspace }}/.libnode-cache
|
|
run: |
|
|
node packages/libnode-linux-x64-gnu/scripts/build.mjs --from-cache
|
|
node packages/libnode-common/scripts/verify.mjs packages/libnode-linux-x64-gnu
|
|
echo "SCRIPTC_LIBNODE=$GITHUB_WORKSPACE/packages/libnode-linux-x64-gnu" >> "$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-linux-x64-${{ 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/libscr_node_bridge.so"
|