@@ -35,12 +35,13 @@ jobs:
3535 - host : ubuntu-latest
3636 target : x86_64-unknown-linux-musl
3737 npm_platform : linux-x64-musl
38- docker : node:22-alpine
38+ alpine : true
39+ alpine_arch : x86_64
3940 - host : ubuntu-latest
4041 target : aarch64-unknown-linux-musl
4142 npm_platform : linux-arm64-musl
42- docker : node:22-alpine
43- docker_arch : linux/arm64
43+ alpine : true
44+ alpine_arch : aarch64
4445 steps :
4546 # Speed up apt-get operations by disabling unnecessary man-db auto-update
4647 - name : Disable man-db auto-update
@@ -60,59 +61,34 @@ jobs:
6061 cache : false
6162 - name : Setup Task runner
6263 uses : go-task/setup-task@v1
63- - name : Install Linux dependencies
64- if : runner.os == 'Linux' && !matrix.settings.docker
64+ - name : Setup Alpine Linux
65+ if : matrix.settings.alpine
66+ uses : jirutka/setup-alpine@v1
67+ with :
68+ arch : ${{ matrix.settings.alpine_arch }}
69+ packages : >
70+ build-base
71+ cups-dev
72+ nodejs
73+ npm
74+ go-task
75+ - name : Install Linux dependencies (glibc)
76+ if : runner.os == 'Linux' && !matrix.settings.alpine
6577 run : |
6678 sudo apt-get update
6779 sudo apt-get install -y libcups2-dev pkg-config clang
80+ - name : Prepare Rust toolchain (musl)
81+ if : matrix.settings.alpine
82+ shell : alpine.sh {0}
83+ run : rustup target add ${{ matrix.settings.target }}
6884 - name : Install dependencies
69- if : ${{ ! matrix.settings.docker }}
85+ shell : ${{ matrix.settings.alpine && 'alpine.sh {0}' || 'bash' }}
7086 run : npm ci
71- - name : Build (native)
72- if : ${{ !matrix.settings.docker }}
73- shell : bash
87+ - name : Build N-API module
88+ shell : ${{ matrix.settings.alpine && 'alpine.sh {0}' || 'bash' }}
7489 run : |
75- # Our build script auto-detects the platform and builds for the current target
7690 echo "Building for target: ${{ matrix.settings.target }}"
7791 task build:napi
78- - name : Setup QEMU for cross-compilation
79- if : matrix.settings.docker && matrix.settings.docker_arch
80- uses : docker/setup-qemu-action@v3
81- with :
82- platforms : ${{ matrix.settings.docker_arch }}
83- - name : Build (Docker/musl)
84- if : matrix.settings.docker
85- uses : addnab/docker-run-action@v3
86- with :
87- image : ${{ matrix.settings.docker }}
88- options : --user 0:0 --platform ${{ matrix.settings.docker_arch || 'linux/amd64' }} -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build
89- run : |
90- set -e
91-
92- # Install build dependencies
93- apk add --no-cache \
94- cups-dev \
95- pkgconf \
96- clang \
97- lld \
98- musl-dev \
99- rust \
100- cargo \
101- git
102-
103- # Add Rust target
104- rustup target add ${{ matrix.settings.target }}
105-
106- # Enable corepack and install Node.js dependencies
107- corepack enable
108- npm ci
109-
110- # Build the N-API module
111- npx napi build --platform --release --target ${{ matrix.settings.target }} --esm --output-dir npm/${{ matrix.settings.npm_platform }}
112-
113- # Run post-build scripts
114- node scripts/remove-env-check.js --dir=npm/${{ matrix.settings.npm_platform }}
115- node scripts/fix-platform-packages.js
11692 - name : Post-build cleanup
11793 shell : bash
11894 run : |
@@ -150,22 +126,32 @@ jobs:
150126 strategy :
151127 fail-fast : false
152128 matrix :
153- # We can't run the cross-runtime tests on Windows ARM runners because Deno and Bun do not have ARM64 Windows builds
154129 settings :
155130 - host : macos-13
156131 target : x86_64-apple-darwin
157132 - host : macos-14
158133 target : aarch64-apple-darwin
159134 - host : windows-latest
160135 target : x86_64-pc-windows-msvc
136+ - host : windows-11-arm
137+ target : aarch64-pc-windows-msvc
138+ test_runtimes : rust node
161139 - host : ubuntu-latest
162140 target : x86_64-unknown-linux-gnu
163141 - host : ubuntu-24.04-arm
164142 target : aarch64-unknown-linux-gnu
143+ - host : ubuntu-latest
144+ target : x86_64-unknown-linux-musl
145+ alpine : true
146+ alpine_arch : x86_64
147+ - host : ubuntu-latest
148+ target : aarch64-unknown-linux-musl
149+ alpine : true
150+ alpine_arch : aarch64
165151 steps :
166152 # Speed up apt-get operations by disabling unnecessary man-db auto-update
167- - name : Disable man-db auto-update and install deps
168- if : runner.os == 'Linux'
153+ - name : Disable man-db auto-update and install deps (glibc)
154+ if : runner.os == 'Linux' && !matrix.settings.alpine
169155 run : |
170156 echo "man-db man-db/auto-update boolean false" | sudo debconf-set-selections
171157 sudo rm -f /var/lib/man-db/auto-update
@@ -191,12 +177,19 @@ jobs:
191177 uses : actions-rust-lang/setup-rust-toolchain@v1
192178 with :
193179 cache : false
194- # Install Task runner
195180 - name : Setup Task
196181 uses : arduino/setup-task@v2
197182 with :
198183 version : 3.x
199184 repo-token : ${{ secrets.GITHUB_TOKEN }}
185+ - name : Setup Alpine Linux
186+ if : matrix.settings.alpine
187+ uses : jirutka/setup-alpine@v1
188+ with :
189+ arch : ${{ matrix.settings.alpine_arch }}
190+ packages : >
191+ cups-dev
192+ go-task
200193 - name : Download all N-API binary artifacts
201194 uses : actions/download-artifact@v5
202195 with :
@@ -215,9 +208,18 @@ jobs:
215208 done
216209 ls -la npm/ 2>/dev/null || dir npm
217210 - name : Install Node.js dependencies
211+ shell : ${{ matrix.settings.alpine && 'alpine.sh {0}' || 'bash' }}
218212 run : npm ci
219213 - name : Run comprehensive tests (includes compilation)
220- run : task test
214+ shell : ${{ matrix.settings.alpine && 'alpine.sh {0}' || 'bash' }}
215+ run : |
216+ if [ -n "${{ matrix.settings.test_runtimes }}" ]; then
217+ echo "Running selective runtime tests: ${{ matrix.settings.test_runtimes }}"
218+ node scripts/test-runtimes.js ${{ matrix.settings.test_runtimes }}
219+ else
220+ echo "Running all runtime tests"
221+ task test
222+ fi
221223
222224 publish :
223225 name : Publish to npm
0 commit comments