Skip to content

Commit 2e3c9b4

Browse files
authored
Merge branch 'main' into fix/ignore-claude-worktrees
2 parents 3f9a8cf + 1462953 commit 2e3c9b4

File tree

66 files changed

+611
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+611
-255
lines changed

.github/actions/build-upstream/action.yml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,44 @@ runs:
5959
pnpm --filter "@voidzero-dev/*" build
6060
pnpm --filter vite-plus build-ts
6161
62+
# Install zig + cargo-zigbuild for musl cross-compilation (napi-cross only supports gnu)
63+
- name: Add musl Rust target
64+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
65+
shell: bash
66+
run: rustup target add ${{ inputs.target }}
67+
68+
- name: Setup zig (musl)
69+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
70+
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
71+
with:
72+
version: 0.15.2
73+
74+
- name: Install cargo-zigbuild (musl)
75+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
76+
uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 # v2.68.32
77+
with:
78+
tool: cargo-zigbuild
79+
6280
# NAPI builds - only run on cache miss (slow, especially on Windows)
6381
# Must run before vite-plus TypeScript builds which depend on the bindings
64-
- name: Build NAPI bindings (x86_64-linux)
82+
- name: Build NAPI bindings (Linux gnu)
6583
shell: bash
66-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
84+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
6785
run: |
6886
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
6987
env:
7088
TARGET_CC: clang
89+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
7190
DEBUG: napi:*
7291

73-
- name: Build NAPI bindings (aarch64-linux)
92+
- name: Build NAPI bindings (Linux musl)
7493
shell: bash
75-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
94+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
7695
run: |
77-
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
96+
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} -x
7897
env:
7998
TARGET_CC: clang
80-
TARGET_CFLAGS: '-D_BSD_SOURCE'
99+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
81100
DEBUG: napi:*
82101

83102
- name: Build NAPI bindings (non-Linux targets)
@@ -88,23 +107,24 @@ runs:
88107
env:
89108
DEBUG: napi:*
90109

91-
- name: Build Rust CLI binary (x86_64-linux)
92-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
110+
- name: Build Rust CLI binary (Linux gnu)
111+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
93112
shell: bash
94113
run: |
95114
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
96115
env:
97116
TARGET_CC: clang
117+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
98118
DEBUG: napi:*
99119

100-
- name: Build Rust CLI binary (aarch64-linux)
101-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
120+
- name: Build Rust CLI binary (Linux musl)
121+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
102122
shell: bash
103123
run: |
104-
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
124+
pnpm exec napi build -x --target ${{ inputs.target }} --release -p vite_global_cli
105125
env:
106126
TARGET_CC: clang
107-
TARGET_CFLAGS: '-D_BSD_SOURCE'
127+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
108128
DEBUG: napi:*
109129

110130
- name: Build Rust CLI binary (non-Linux targets)

.github/actions/download-rolldown-binaries/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ runs:
2020
- name: Install previous release
2121
shell: bash
2222
run: |
23+
# Always download the binding that matches the runner OS (not the
24+
# Rust cross-compilation target). The rolldown binding is loaded by
25+
# Node.js on the host to run JS build steps, not cross-compiled.
2326
if ${{ runner.os == 'Windows' }}; then
2427
export TARGET="win32-x64-msvc"
2528
elif ${{ runner.os == 'Linux' }}; then

.github/workflows/ci.yml

Lines changed: 127 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ jobs:
9999
cache-key: test
100100
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}
101101

102-
- run: rustup target add x86_64-unknown-linux-musl
103-
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
104-
105102
- run: cargo check --all-targets --all-features
106103
env:
107104
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml
@@ -112,6 +109,43 @@ jobs:
112109
env:
113110
RUST_MIN_STACK: 8388608
114111

112+
test-musl:
113+
needs: detect-changes
114+
if: needs.detect-changes.outputs.code-changed == 'true'
115+
name: Test (Linux x64 musl)
116+
runs-on: namespace-profile-linux-x64-default
117+
container:
118+
image: node:22-alpine3.21
119+
env:
120+
# GitHub Actions sets HOME=/github/home in containers, but the euid home is /root.
121+
# Pin Rust tooling paths to avoid $HOME mismatch issues.
122+
CARGO_HOME: /root/.cargo
123+
RUSTUP_HOME: /root/.rustup
124+
steps:
125+
- name: Install Alpine dependencies
126+
shell: sh {0}
127+
run: apk add --no-cache bash curl git musl-dev gcc g++ python3 cmake make
128+
129+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
130+
- uses: ./.github/actions/clone
131+
132+
- name: Install rustup
133+
run: |
134+
# GitHub Actions sets HOME=/github/home in containers, but rustup expects euid home (/root)
135+
export HOME=/root
136+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
137+
echo "/root/.cargo/bin" >> "$GITHUB_PATH"
138+
139+
- name: Install Rust toolchain
140+
run: rustup show
141+
142+
# Test all crates/* packages. New crates are automatically included.
143+
# Also test vite-plus-cli (lives outside crates/) to catch type sync issues.
144+
# Skip separate cargo check — cargo test already compiles everything.
145+
- run: cargo test $(for d in crates/*/; do echo -n "-p $(basename $d) "; done) -p vite-plus-cli
146+
env:
147+
RUST_MIN_STACK: 8388608
148+
115149
lint:
116150
needs: detect-changes
117151
if: needs.detect-changes.outputs.code-changed == 'true'
@@ -146,48 +180,6 @@ jobs:
146180
- name: Deduplicate dependencies
147181
run: pnpm dedupe --check
148182

149-
run:
150-
name: Run task
151-
runs-on: namespace-profile-linux-x64-default
152-
needs:
153-
- download-previous-rolldown-binaries
154-
steps:
155-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
156-
- uses: ./.github/actions/clone
157-
158-
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
159-
with:
160-
save-cache: ${{ github.ref_name == 'main' }}
161-
cache-key: run
162-
163-
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
164-
165-
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
166-
with:
167-
name: rolldown-binaries
168-
path: ./rolldown/packages/rolldown/src
169-
merge-multiple: true
170-
171-
- name: Build with upstream
172-
uses: ./.github/actions/build-upstream
173-
with:
174-
target: x86_64-unknown-linux-gnu
175-
176-
- name: Install Global CLI vp
177-
run: |
178-
pnpm bootstrap-cli:ci
179-
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
180-
181-
- name: Print help for built-in commands
182-
run: |
183-
which vp
184-
vp -h
185-
vp run -h
186-
vp lint -h
187-
vp test -h
188-
vp build -h
189-
vp fmt -h
190-
191183
cli-e2e-test:
192184
name: CLI E2E test
193185
needs:
@@ -197,8 +189,11 @@ jobs:
197189
matrix:
198190
include:
199191
- os: namespace-profile-linux-x64-default
192+
target: x86_64-unknown-linux-gnu
200193
- os: namespace-profile-mac-default
194+
target: aarch64-apple-darwin
201195
- os: windows-latest
196+
target: x86_64-pc-windows-msvc
202197
runs-on: ${{ matrix.os }}
203198
steps:
204199
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -217,7 +212,7 @@ jobs:
217212
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
218213
with:
219214
save-cache: ${{ github.ref_name == 'main' }}
220-
cache-key: cli-e2e-test
215+
cache-key: cli-e2e-test-${{ matrix.target }}
221216
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}
222217

223218
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
@@ -234,10 +229,10 @@ jobs:
234229
- name: Build with upstream
235230
uses: ./.github/actions/build-upstream
236231
with:
237-
target: ${{ matrix.os == 'namespace-profile-linux-x64-default' && 'x86_64-unknown-linux-gnu' || matrix.os == 'windows-latest' && 'x86_64-pc-windows-msvc' || 'aarch64-apple-darwin' }}
232+
target: ${{ matrix.target }}
238233

239234
- name: Check TypeScript types
240-
if: ${{ matrix.os == 'namespace-profile-linux-x64-default' }}
235+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
241236
run: pnpm tsgo
242237

243238
- name: Install Global CLI vp
@@ -395,7 +390,7 @@ jobs:
395390
- name: Run CLI snapshot tests
396391
run: |
397392
RUST_BACKTRACE=1 pnpm test
398-
if ! git diff --exit-code; then
393+
if ! git diff --quiet; then
399394
echo "::error::Snapshot diff detected. Run 'pnpm -F vite-plus snap-test' locally and commit the updated snap.txt files."
400395
git diff --stat
401396
git diff
@@ -577,6 +572,87 @@ jobs:
577572
pnpm bootstrap-cli:ci
578573
vp --version
579574
575+
cli-e2e-test-musl:
576+
name: CLI E2E test (Linux x64 musl)
577+
needs:
578+
- download-previous-rolldown-binaries
579+
runs-on: namespace-profile-linux-x64-default
580+
steps:
581+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
582+
- uses: ./.github/actions/clone
583+
584+
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
585+
with:
586+
save-cache: ${{ github.ref_name == 'main' }}
587+
cache-key: cli-e2e-test-musl
588+
589+
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
590+
591+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
592+
with:
593+
name: rolldown-binaries
594+
path: ./rolldown/packages/rolldown/src
595+
merge-multiple: true
596+
597+
# Cross-compile for musl on the glibc host
598+
- name: Build with upstream (musl)
599+
uses: ./.github/actions/build-upstream
600+
with:
601+
target: x86_64-unknown-linux-musl
602+
603+
# Run bootstrap-cli:ci and E2E tests inside an Alpine container where musl is native.
604+
# Can't run on the glibc host because NAPI .node files are musl-linked.
605+
- name: Run E2E in Alpine container
606+
run: |
607+
docker run --rm \
608+
-e CI=true \
609+
-v "${{ github.workspace }}:/workspace" \
610+
-w /workspace \
611+
node:22-alpine3.21 sh -c "
612+
apk add --no-cache bash curl ca-certificates git
613+
614+
# Install pnpm and re-resolve optional dependencies for musl.
615+
# The host node_modules has glibc bindings; pnpm store holds both
616+
# but we need to re-link the musl variants.
617+
corepack enable
618+
pnpm install --frozen-lockfile --force
619+
620+
# Download musl rolldown binding (host downloaded glibc variant)
621+
ROLLDOWN_VERSION=\$(node -p \"require('./rolldown/packages/rolldown/package.json').version\")
622+
npm pack \"@rolldown/binding-linux-x64-musl@\${ROLLDOWN_VERSION}\"
623+
tar -xzf \"rolldown-binding-linux-x64-musl-\${ROLLDOWN_VERSION}.tgz\"
624+
cp ./package/rolldown-binding.linux-x64-musl.node ./packages/core/dist/rolldown/shared/
625+
cp ./package/rolldown-binding.linux-x64-musl.node ./rolldown/packages/rolldown/dist/shared/
626+
rm -rf package *.tgz
627+
628+
pnpm bootstrap-cli:ci
629+
export PATH=\"/root/.vite-plus/bin:\$PATH\"
630+
631+
vp --version
632+
vp -h
633+
vp env doctor
634+
635+
# Verify shims work
636+
which node
637+
which npm
638+
node --version
639+
640+
# Test global package install
641+
vp install -g typescript
642+
tsc --version
643+
vp uninstall -g typescript
644+
645+
# Run snap tests
646+
git config --global --add safe.directory /workspace
647+
RUST_BACKTRACE=1 pnpm test
648+
if ! git diff --quiet; then
649+
echo '::error::Snapshot diff detected. Run pnpm -F vite-plus snap-test locally and commit the updated snap.txt files.'
650+
git diff --stat
651+
git diff
652+
exit 1
653+
fi
654+
"
655+
580656
install-e2e-test:
581657
name: Local CLI `vp install` E2E test
582658
needs:
@@ -651,9 +727,10 @@ jobs:
651727
if: always()
652728
needs:
653729
- test
730+
- test-musl
654731
- lint
655-
- run
656732
- cli-e2e-test
733+
- cli-e2e-test-musl
657734
steps:
658735
- run: exit 1
659736
# Thank you, next https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml#L379

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ jobs:
6363
os: macos-latest
6464
- target: aarch64-unknown-linux-gnu
6565
os: ubuntu-latest
66+
- target: aarch64-unknown-linux-musl
67+
os: ubuntu-latest
6668
- target: x86_64-unknown-linux-gnu
6769
os: ubuntu-latest
70+
- target: x86_64-unknown-linux-musl
71+
os: ubuntu-latest
6872
- target: x86_64-pc-windows-msvc
6973
os: windows-latest
7074
- target: aarch64-pc-windows-msvc

0 commit comments

Comments
 (0)