pkg-fetch/.github/workflows/build-linuxstatic.yml
faulpeltz a4bdb1649a
feat: node 24 support and attempt some Node 22 fixes (by @faulpeltz) (#107)
This PR adds Node24 support

**Node/V8 changes:**
- Move to new V8 syntax for some constructs (e.g. Cast<>)
- Tracked down two issues which caused the read-only snapshot to be
different across platforms:
- in `read-only-serializer:258` the "live" pointer gets overwritten by
the encoded slot (EncodedTagged).
If V8_COMPRESS_POINTERS is not enabled, EncodedTagged is 4 bytes, but
the live pointer is 8 bytes.
memcpy() only copies EncodeTagged leaving 4bytes of "garbage" (=previous
upper pointer half) which is semi-random per run - fixed this by
clearing the whole value first
- the CSA_HOLE_SECURITY_CHECK macro somehow leaves a string with a
platform-dependent filename in the readonly heap as a constant, replaced
that with "placeholder"
- add PKG_TRACE_READONLY_HEAP blocks for debugging further snapshot
issues

Those fixes partially fix the sourceless cross-build issues introduced
in Node 22 - For my test builds linux/linuxstatic/alpine/win on x64 are
now compatible again. The heap contents on macos builds and other arm64
is wildly different, not sure why. I don't think this kind of
compatibility is a goal for the V8 snapshot implementation in general.
(This affects Node SEA as well, but SEA always has the source to fall
back onto, which incurs a small performance hit)

**Build Changes:**

- Update linux/linuxcross build to use gcc 12 (required for Node 24)
- For aloine/linuxstatic: Node 24 doesn't build on the muslcc image used
previously, the image is unmaintained (although the toolchain builder
isn't, we could build our own image)
- Moved alpine/linuxstatic to native Alpine x64/arm64 toolchains, which
seems to work quite well
- Some minor upgrades to the Windows build, but had to enable `full-icu`
for now because the ICU code gen step crashes with `small-icu` on the GH
action build runners (not on my Windows test machine though)
- Moved the macos build to macos 14 which is now required for Node 24 -
x64 is now cross-built from arm64 because GH doesn't offer free macos14
x64 build workers
- Removed all builds for Node 18 and older
- 
**Notes:**
- Needs more testing, I did some basic testing for x64 builds as well as
macos/arm64
- I added a backport of the snapshot-determinism fixes to the latest
Node 22 patch
2025-09-17 14:50:36 +02:00

134 lines
3.8 KiB
YAML

name: Build Node binaries for Linux static
on:
workflow_dispatch:
workflow_call:
jobs:
linuxstatic-legacy:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target-node: [20, 22]
target-arch: [x64, arm64, armv7]
include:
- target-arch: x64
target-triple: x86_64-linux-musl
host-arch: x86_64
- target-arch: arm64
target-triple: aarch64-linux-musl
host-arch: x86_64
- target-arch: armv7
target-triple: armv7l-linux-musleabihf
host-arch: i686
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
build-args: |
HOST_ARCH=${{ matrix.host-arch }}
TARGET_TRIPLE=${{ matrix.target-triple }}
PKG_FETCH_OPTION_a=${{ matrix.target-arch }}
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
PKG_FETCH_OPTION_p=linuxstatic
context: .
file: ./Dockerfile.alpine-muslcc
platforms: linux/amd64
outputs: type=local, dest=dist
- name: Check if binary is compiled, skip if download only
id: check_file
run: |
ls -l dist
(test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-linuxstatic-${{ matrix.target-arch }}
path: dist/*
linuxstatic-x64:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target-node: [24]
target-arch: [x64]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
build-args: |
PKG_FETCH_OPTION_a=${{ matrix.target-arch }}
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
PKG_FETCH_OPTION_p=linuxstatic
context: .
file: ./Dockerfile.alpine
outputs: type=local, dest=dist
- name: Check if binary is compiled, skip if download only
id: check_file
run: |
ls -l dist
(test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-linuxstatic-${{ matrix.target-arch }}
path: dist/*
linuxstatic-arm64:
runs-on: ubuntu-22.04-arm
strategy:
fail-fast: false
matrix:
target-node: [24]
target-arch: [arm64]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
build-args: |
PKG_FETCH_OPTION_a=${{ matrix.target-arch }}
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
PKG_FETCH_OPTION_p=linuxstatic
context: .
file: ./Dockerfile.alpine
outputs: type=local, dest=dist
- name: Check if binary is compiled, skip if download only
id: check_file
run: |
ls -l dist
(test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-linuxstatic-${{ matrix.target-arch }}
path: dist/*