Skip to content

Commit 714b68b

Browse files
committed
feat(ci): add musl CLI E2E test
Add cli-e2e-test-musl job that builds with musl target and runs directly on ubuntu-latest (musl binaries are statically linked). Includes full test parity with the glibc variant: vp check, global package install, CLI snapshot tests, upgrade, and implode.
1 parent 86db067 commit 714b68b

1 file changed

Lines changed: 154 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 154 additions & 3 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.os == 'ubuntu-latest' }}
104-
105102
- run: cargo check --all-targets --all-features
106103
env:
107104
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml
@@ -573,6 +570,159 @@ jobs:
573570
pnpm bootstrap-cli:ci
574571
vp --version
575572
573+
cli-e2e-test-musl:
574+
name: CLI E2E test (Linux x64 musl)
575+
needs:
576+
- download-previous-rolldown-binaries
577+
runs-on: ubuntu-latest
578+
steps:
579+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
580+
- uses: ./.github/actions/clone
581+
582+
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
583+
with:
584+
save-cache: ${{ github.ref_name == 'main' }}
585+
cache-key: cli-e2e-test-musl
586+
587+
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
588+
589+
- name: Install docs dependencies
590+
run: pnpm -C docs install --frozen-lockfile
591+
592+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
593+
with:
594+
name: rolldown-binaries
595+
path: ./rolldown/packages/rolldown/src
596+
merge-multiple: true
597+
598+
- name: Build with upstream (musl)
599+
uses: ./.github/actions/build-upstream
600+
with:
601+
target: x86_64-unknown-linux-musl
602+
603+
- name: Install Global CLI vp
604+
run: |
605+
pnpm bootstrap-cli:ci
606+
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
607+
608+
- name: Verify vp installation
609+
run: |
610+
which vp
611+
vp --version
612+
vp -h
613+
614+
- name: Run vp check
615+
run: vp check
616+
617+
- name: Test global package install (bash)
618+
run: |
619+
echo "PATH: $PATH"
620+
ls -la ~/.vite-plus/
621+
ls -la ~/.vite-plus/bin/
622+
which node
623+
which npm
624+
which npx
625+
which vp
626+
vp env doctor
627+
628+
# Test 1: Install a JS-based CLI (typescript)
629+
vp install -g typescript
630+
tsc --version
631+
which tsc
632+
633+
# Test 2: Verify the package was installed correctly
634+
ls -la ~/.vite-plus/packages/typescript/
635+
ls -la ~/.vite-plus/bin/
636+
637+
# Test 3: Uninstall
638+
vp uninstall -g typescript
639+
640+
# Test 4: Verify uninstall removed shim
641+
echo "Checking bin dir after uninstall:"
642+
ls -la ~/.vite-plus/bin/
643+
if [ -f ~/.vite-plus/bin/tsc ]; then
644+
echo "Error: tsc shim file still exists at ~/.vite-plus/bin/tsc"
645+
exit 1
646+
fi
647+
echo "tsc shim removed successfully"
648+
649+
# Test 5: use session
650+
vp env use 18
651+
node --version
652+
vp env doctor
653+
vp env use --unset
654+
node --version
655+
656+
- name: Install Playwright browsers
657+
run: pnpx playwright install chromium
658+
659+
- name: Run CLI snapshot tests
660+
run: |
661+
RUST_BACKTRACE=1 pnpm test
662+
if ! git diff --exit-code; then
663+
echo "::error::Snapshot diff detected. Run 'pnpm -F vite-plus snap-test' locally and commit the updated snap.txt files."
664+
git diff --stat
665+
git diff
666+
exit 1
667+
fi
668+
669+
- name: Test upgrade (bash)
670+
shell: bash
671+
run: |
672+
# Helper to read the installed CLI version from package.json
673+
get_cli_version() {
674+
node -p "require(require('path').resolve(process.env.USERPROFILE || process.env.HOME, '.vite-plus', 'current', 'node_modules', 'vite-plus', 'package.json')).version"
675+
}
676+
677+
# Save initial (dev build) version
678+
INITIAL_VERSION=$(get_cli_version)
679+
echo "Initial version: $INITIAL_VERSION"
680+
681+
# --check queries npm registry and prints update status
682+
vp upgrade --check
683+
684+
# full upgrade: download, extract, swap
685+
vp upgrade --tag alpha --force
686+
vp --version
687+
vp env doctor
688+
689+
ls -la ~/.vite-plus/
690+
691+
# Verify version changed after update
692+
UPDATED_VERSION=$(get_cli_version)
693+
echo "Updated version: $UPDATED_VERSION"
694+
if [ "$UPDATED_VERSION" == "$INITIAL_VERSION" ]; then
695+
echo "Error: version should have changed after upgrade (still $INITIAL_VERSION)"
696+
exit 1
697+
fi
698+
699+
# rollback to the previous version
700+
vp upgrade --rollback
701+
vp --version
702+
vp env doctor
703+
704+
# Verify version restored after rollback
705+
ROLLBACK_VERSION=$(get_cli_version)
706+
echo "Rollback version: $ROLLBACK_VERSION"
707+
if [ "$ROLLBACK_VERSION" != "$INITIAL_VERSION" ]; then
708+
echo "Error: version should have been restored after rollback (expected $INITIAL_VERSION, got $ROLLBACK_VERSION)"
709+
exit 1
710+
fi
711+
712+
- name: Test implode (bash)
713+
shell: bash
714+
run: |
715+
vp implode --yes
716+
ls -la ~/
717+
VP_HOME="${USERPROFILE:-$HOME}/.vite-plus"
718+
if [ -d "$VP_HOME" ]; then
719+
echo "Error: $VP_HOME still exists after implode"
720+
exit 1
721+
fi
722+
# Reinstall
723+
pnpm bootstrap-cli:ci
724+
vp --version
725+
576726
install-e2e-test:
577727
name: Local CLI `vp install` E2E test
578728
needs:
@@ -650,6 +800,7 @@ jobs:
650800
- lint
651801
- run
652802
- cli-e2e-test
803+
- cli-e2e-test-musl
653804
steps:
654805
- run: exit 1
655806
# Thank you, next https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml#L379

0 commit comments

Comments
 (0)