Skip to content

Commit 12a86c9

Browse files
branchseerclaude
andcommitted
refactor: simplify Alpine CI with node image, corepack, and smart linker scripts
- Use node:22-alpine3.21 image instead of alpine:3.21 to get Node.js with TypeScript support pre-installed - Use corepack to install pnpm, respecting packageManager in package.json - Update .cargo linker scripts to detect Linux hosts and use system cc directly, removing the need for the sed workaround in CI - Split Rust setup into rustup install + toolchain install from rust-toolchain.toml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2733656 commit 12a86c9

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ rustflags = ["--cfg", "tokio_unstable", "-D", "warnings"]
44
[unstable]
55
bindeps = true
66

7-
# Linker wrappers for cross-compiling bindep targets (fspy_test_bin) via cargo-zigbuild.
8-
# On native Linux the system linker can handle musl targets; these are needed on non-Linux hosts.
7+
# Linker wrappers for musl targets. On Linux hosts these use the system cc directly;
8+
# on non-Linux hosts (macOS, Windows) they cross-compile via cargo-zigbuild.
99
[target.x86_64-unknown-linux-musl]
1010
rustflags = ["-C", "linker=.cargo/zigcc-x86_64-unknown-linux-musl"]
1111

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
#!/bin/sh
2+
# Linker wrapper for aarch64-unknown-linux-musl targets.
3+
# On Linux, use the system cc directly. On other hosts, cross-compile via cargo-zigbuild.
4+
if [ "$(uname -s)" = "Linux" ]; then
5+
exec cc "$@"
6+
fi
27
exec cargo-zigbuild zig cc -- -fno-sanitize=all -target aarch64-linux-musl "$@"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
#!/bin/sh
2+
# Linker wrapper for x86_64-unknown-linux-musl targets.
3+
# On Linux, use the system cc directly. On other hosts, cross-compile via cargo-zigbuild.
4+
if [ "$(uname -s)" = "Linux" ]; then
5+
exec cc "$@"
6+
fi
27
exec cargo-zigbuild zig cc -- -fno-sanitize=all -target x86_64-linux-musl "$@"

.github/workflows/ci.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
name: Test (musl)
140140
runs-on: ubuntu-latest
141141
container:
142-
image: alpine:3.21
142+
image: node:22-alpine3.21
143143
options: --shm-size=256m # shm_io tests need bigger shared memory
144144
steps:
145145
- name: Install Alpine dependencies
@@ -151,28 +151,19 @@ jobs:
151151
persist-credentials: false
152152
submodules: true
153153

154-
# Alpine's Node.js package is compiled without TypeScript type-stripping.
155-
# Install the official Node.js musl binary which includes full TypeScript support.
156-
- name: Install Node.js from official distribution
154+
- name: Install rustup
157155
run: |
158-
NODE_VERSION=v$(cat .node-version)
159-
curl -fsSL "https://unofficial-builds.nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64-musl.tar.gz" | tar -xz -C /usr/local --strip-components=1
160-
161-
- name: Install Rust
162-
run: |
163-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2026-03-05
156+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
164157
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
165158
159+
- name: Install Rust toolchain
160+
run: rustup show
161+
166162
- name: Install pnpm and Node tools
167163
run: |
168-
npm install -g pnpm
164+
corepack enable
169165
pnpm install
170166
171-
# Remove the zig cross-compilation config from .cargo/config.toml — in Alpine,
172-
# the system cc is already musl-based, so no cross-compilation linker is needed.
173-
- name: Remove zig linker config for native musl
174-
run: sed -i '/\[target.*musl\]/,/^$/d' .cargo/config.toml
175-
176167
- run: cargo test --no-fail-fast
177168

178169
fmt:

0 commit comments

Comments
 (0)