mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Reuse decoded AST nodes, parent references, and recursive class type analysis during compilation. - Split expression and library validation into smaller functions while preserving diagnostics. - Shorten sanitizer bootstrap and reuse verified CI toolchains.
73 lines
3.3 KiB
YAML
73 lines
3.3 KiB
YAML
name: Native compiler packages
|
|
description: Build or restore native packages using their complete source inputs
|
|
inputs:
|
|
target:
|
|
description: Native package suffix
|
|
required: true
|
|
helper:
|
|
description: Build the LLVM helper as well as the runtime pack
|
|
default: "true"
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Identify host toolchain
|
|
id: host
|
|
shell: bash
|
|
run: |
|
|
# Runner image changes can update the SDK, C++ ABI, and C compiler.
|
|
echo "image=${ImageOS}-${ImageVersion}" >> "$GITHUB_OUTPUT"
|
|
if test "$RUNNER_OS" = Linux; then
|
|
echo "zig=$(zig version)" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- uses: actions/cache/restore@v4
|
|
id: helper
|
|
if: inputs.helper == 'true'
|
|
with:
|
|
path: packages/llvm-${{ inputs.target }}/bin
|
|
key: helper-v1-${{ inputs.target }}-${{ steps.host.outputs.image }}-${{ steps.host.outputs.zig }}-${{ hashFiles('.node-version', '.github/actions/native-packages/action.yml', '.github/actions/llvm-linux/action.yml', 'native/llvm-codegen/**', 'packages/llvm-*/package.json', 'packages/llvm-*/scripts/**') }}
|
|
- uses: actions/cache/restore@v4
|
|
id: runtime
|
|
with:
|
|
path: |
|
|
packages/runtime-${{ inputs.target }}/artifacts
|
|
packages/runtime-${{ inputs.target }}/runtime-pack.json
|
|
key: runtime-v1-${{ inputs.target }}-${{ steps.host.outputs.image }}-${{ steps.host.outputs.zig }}-${{ hashFiles('.node-version', '.github/actions/native-packages/action.yml', '.github/actions/llvm-linux/action.yml', 'packages/runtime/package.json', 'packages/runtime/LICENSE', 'packages/runtime/src/**', 'packages/runtime/vendor/**', 'packages/runtime-*/package.json', 'packages/runtime-*/scripts/**', 'packages/runtime-*/*.mjs') }}
|
|
- name: Install macOS LLVM
|
|
if: runner.os == 'macOS' && inputs.helper == 'true' && steps.helper.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: brew install llvm@22
|
|
- name: Build LLVM helper
|
|
if: inputs.helper == 'true' && steps.helper.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
SCRIPTC_PACKAGE_TARGET: ${{ inputs.target }}
|
|
run: pnpm --filter "@scriptc/llvm-$SCRIPTC_PACKAGE_TARGET" build:native
|
|
- name: Build runtime pack
|
|
if: steps.runtime.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
SCRIPTC_PACKAGE_TARGET: ${{ inputs.target }}
|
|
run: |
|
|
if test "$RUNNER_OS" = Linux; then
|
|
CC=zig AR=zig pnpm --filter "@scriptc/runtime-$SCRIPTC_PACKAGE_TARGET" build:native
|
|
else
|
|
pnpm --filter "@scriptc/runtime-$SCRIPTC_PACKAGE_TARGET" build:native
|
|
fi
|
|
- name: Verify runtime content
|
|
shell: bash
|
|
env:
|
|
SCRIPTC_PACKAGE_TARGET: ${{ inputs.target }}
|
|
run: node "packages/runtime-$SCRIPTC_PACKAGE_TARGET/scripts/verify.mjs"
|
|
- uses: actions/cache/save@v4
|
|
if: inputs.helper == 'true' && steps.helper.outputs.cache-hit != 'true'
|
|
with:
|
|
path: packages/llvm-${{ inputs.target }}/bin
|
|
key: ${{ steps.helper.outputs.cache-primary-key }}
|
|
- uses: actions/cache/save@v4
|
|
if: steps.runtime.outputs.cache-hit != 'true'
|
|
with:
|
|
path: |
|
|
packages/runtime-${{ inputs.target }}/artifacts
|
|
packages/runtime-${{ inputs.target }}/runtime-pack.json
|
|
key: ${{ steps.runtime.outputs.cache-primary-key }}
|