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
0 commit comments