Skip to content

fix(cli): scope CI env var to child process in Windows install script #500

fix(cli): scope CI env var to child process in Windows install script

fix(cli): scope CI env var to child process in Windows install script #500

name: Test Standalone Install Scripts
permissions: {}
on:
workflow_dispatch:
pull_request:
paths:
- 'packages/cli/install.sh'
- 'packages/cli/install.ps1'
- '.github/workflows/test-standalone-install.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
VP_VERSION: alpha
jobs:
test-install-sh:
name: Test install.sh (${{ matrix.name }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: Linux x64 glibc
- os: macos-15-intel
name: macOS x64
- os: macos-latest
name: macOS ARM64
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run install.sh
run: cat packages/cli/install.sh | bash
- name: Verify installation
working-directory: ${{ runner.temp }}
run: |
# Source shell config to get PATH updated
if [ -f ~/.zshenv ]; then
# non-interactive shells use zshenv
source ~/.zshenv
elif [ -f ~/.zshrc ]; then
# interactive shells use zshrc
source ~/.zshrc
elif [ -f ~/.bash_profile ]; then
# non-interactive shells use bash_profile
source ~/.bash_profile
elif [ -f ~/.bashrc ]; then
# interactive shells use bashrc
source ~/.bashrc
else
export PATH="$HOME/.vite-plus/bin:$PATH"
fi
echo "PATH: $PATH"
ls -al ~/
vp --version
vp --help
# test create command
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build && vp --version
- name: Set PATH
shell: bash
run: |
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
- name: Verify bin setup
run: |
# Verify bin directory was created by vp env --setup
BIN_PATH="$HOME/.vite-plus/bin"
ls -al "$BIN_PATH"
if [ ! -d "$BIN_PATH" ]; then
echo "Error: Bin directory not found: $BIN_PATH"
exit 1
fi
# Verify shim executables exist
for shim in node npm npx; do
if [ ! -f "$BIN_PATH/$shim" ]; then
echo "Error: Shim not found: $BIN_PATH/$shim"
exit 1
fi
echo "Found shim: $BIN_PATH/$shim"
done
# Verify vp env doctor works
vp env doctor
vp env run --node 24 -- node -p "process.versions"
which node
which npm
which npx
which vp
- name: Verify upgrade
run: |
# --check queries npm registry and prints update status
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
# rollback to the previous version (should succeed after a real update)
vp upgrade --rollback
vp --version
test-install-sh-readonly-config:
name: Test install.sh (readonly shell config)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Make shell config files read-only
run: |
# Simulate Nix-managed or read-only shell configs
touch ~/.bashrc ~/.bash_profile ~/.profile
chmod 444 ~/.bashrc ~/.bash_profile ~/.profile
- name: Run install.sh
run: |
output=$(cat packages/cli/install.sh | bash 2>&1) || {
echo "$output"
echo "Install script exited with non-zero status"
exit 1
}
echo "$output"
# Verify installation succeeds (not a fatal error)
echo "$output" | grep -q "successfully installed"
# Verify fallback message shows binary location
echo "$output" | grep -q "vp was installed to:"
# Verify fallback message shows manual instructions
echo "$output" | grep -q "Or run vp directly:"
# Verify the permission warning was shown
echo "$output" | grep -qi "permission denied"
- name: Verify vp works via direct path
run: |
~/.vite-plus/bin/vp --version
test-install-sh-arm64:
name: Test install.sh (Linux ARM64 glibc via QEMU)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
with:
platforms: arm64
- name: Run install.sh in ARM64 container
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
-e VP_VERSION=alpha \
ubuntu:20.04 bash -c "
ls -al ~/
apt-get update && apt-get install -y curl ca-certificates
cat /workspace/packages/cli/install.sh | bash
if [ -f ~/.profile ]; then
source ~/.profile
elif [ -f ~/.bashrc ]; then
source ~/.bashrc
else
export PATH="$HOME/.vite-plus/bin:$PATH"
fi
vp --version
vp --help
vp dlx print-current-version
# Verify bin setup
BIN_PATH=\"\$HOME/.vite-plus/bin\"
if [ ! -d \"\$BIN_PATH\" ]; then
echo \"Error: Bin directory not found: \$BIN_PATH\"
exit 1
fi
for shim in node npm npx; do
if [ ! -f \"\$BIN_PATH/\$shim\" ]; then
echo \"Error: Shim not found: \$BIN_PATH/\$shim\"
exit 1
fi
echo \"Found shim: \$BIN_PATH/\$shim\"
done
vp env doctor
export VITE_LOG=trace
vp env run --node 24 -- node -p \"process.versions\"
# Verify upgrade
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
# FIXME: qemu: uncaught target signal 11 (Segmentation fault) - core dumped
# vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
# cd hello && vp run build
"
test-install-sh-musl-x64:
name: Test install.sh (Linux x64 musl)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run install.sh in Alpine container
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-e VP_VERSION=alpha \
-e CI=true \
alpine:3.21 sh -c "
# libstdc++: required by unofficial-builds Node.js musl binary
apk add --no-cache bash curl ca-certificates libstdc++
cat /workspace/packages/cli/install.sh | bash
export PATH=\"\$HOME/.vite-plus/bin:\$PATH\"
vp --version
vp --help
vp dlx print-current-version
# Verify bin setup
BIN_PATH=\"\$HOME/.vite-plus/bin\"
if [ ! -d \"\$BIN_PATH\" ]; then
echo \"Error: Bin directory not found: \$BIN_PATH\"
exit 1
fi
for shim in node npm npx; do
if [ ! -f \"\$BIN_PATH/\$shim\" ]; then
echo \"Error: Shim not found: \$BIN_PATH/\$shim\"
exit 1
fi
echo \"Found shim: \$BIN_PATH/\$shim\"
done
vp env doctor
vp env run --node 24 -- node -p \"process.versions\"
# Test create command
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build && vp --version
cd ..
# Verify upgrade
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
"
test-install-sh-musl-arm64:
name: Test install.sh (Linux ARM64 musl via QEMU)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
with:
platforms: arm64
- name: Run install.sh in ARM64 Alpine container
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
-e VP_VERSION=alpha \
-e CI=true \
alpine:3.21 sh -c "
# libstdc++ is needed by unofficial-builds Node.js musl binary
apk add --no-cache bash curl ca-certificates libstdc++
cat /workspace/packages/cli/install.sh | bash
export PATH=\"\$HOME/.vite-plus/bin:\$PATH\"
vp --version
vp --help
vp dlx print-current-version
# Verify bin setup
BIN_PATH=\"\$HOME/.vite-plus/bin\"
if [ ! -d \"\$BIN_PATH\" ]; then
echo \"Error: Bin directory not found: \$BIN_PATH\"
exit 1
fi
for shim in node npm npx; do
if [ ! -f \"\$BIN_PATH/\$shim\" ]; then
echo \"Error: Shim not found: \$BIN_PATH/\$shim\"
exit 1
fi
echo \"Found shim: \$BIN_PATH/\$shim\"
done
vp env doctor
export VITE_LOG=trace
vp env run --node 24 -- node -p \"process.versions\"
# FIXME: QEMU doesn't support all syscalls needed by rolldown/tsdown
# vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
# cd hello && vp run build && vp --version
# Verify upgrade
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
"
test-install-ps1-v5:
name: Test install.ps1 (Windows x64, PowerShell 5.1)
runs-on: windows-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Assert PowerShell 5.x
shell: powershell
run: |
Write-Host "PowerShell version: $($PSVersionTable.PSVersion)"
if ($PSVersionTable.PSVersion.Major -ne 5) {
Write-Error "Expected PowerShell 5.x but got $($PSVersionTable.PSVersion)"
exit 1
}
- name: Run install.ps1
shell: powershell
run: |
& ./packages/cli/install.ps1
- name: Run install.ps1 via irm simulation (catches BOM issues)
shell: powershell
run: |
$ErrorActionPreference = "Stop"
Get-Content ./packages/cli/install.ps1 -Raw | Invoke-Expression
- name: Set PATH
shell: bash
run: |
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
- name: Verify installation
shell: powershell
working-directory: ${{ runner.temp }}
run: |
Write-Host "PATH: $env:Path"
vp --version
vp --help
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello
vp run build
vp --version
- name: Verify bin setup
shell: powershell
run: |
$binPath = "$env:USERPROFILE\.vite-plus\bin"
Get-ChildItem -Force $binPath
if (-not (Test-Path $binPath)) {
Write-Error "Bin directory not found: $binPath"
exit 1
}
$expectedShims = @("node.exe", "npm.exe", "npx.exe")
foreach ($shim in $expectedShims) {
$shimFile = Join-Path $binPath $shim
if (-not (Test-Path $shimFile)) {
Write-Error "Shim not found: $shimFile"
exit 1
}
Write-Host "Found shim: $shimFile"
}
where.exe node
where.exe npm
where.exe npx
where.exe vp
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
vp env doctor
vp env run --node 24 -- node -p "process.versions"
- name: Verify upgrade
shell: powershell
run: |
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
test-install-ps1-arm64:
name: Test install.ps1 (Windows ARM64)
runs-on: windows-11-arm
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run install.ps1
shell: pwsh
run: |
& ./packages/cli/install.ps1
- name: Set PATH
shell: bash
run: |
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
- name: Verify installation
shell: pwsh
working-directory: ${{ runner.temp }}
run: |
Write-Host "PATH: $env:Path"
vp --version
vp --help
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello
vp run build
vp --version
- name: Verify bin setup
shell: pwsh
run: |
$binPath = "$env:USERPROFILE\.vite-plus\bin"
Get-ChildItem -Force $binPath
if (-not (Test-Path $binPath)) {
Write-Error "Bin directory not found: $binPath"
exit 1
}
$expectedShims = @("node.exe", "npm.exe", "npx.exe")
foreach ($shim in $expectedShims) {
$shimFile = Join-Path $binPath $shim
if (-not (Test-Path $shimFile)) {
Write-Error "Shim not found: $shimFile"
exit 1
}
Write-Host "Found shim: $shimFile"
}
where.exe node
where.exe npm
where.exe npx
where.exe vp
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
vp env doctor
vp env run --node 24 -- node -p "process.versions"
- name: Verify upgrade
shell: pwsh
run: |
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
test-install-ps1:
name: Test install.ps1 (Windows x64)
runs-on: windows-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run install.ps1
shell: pwsh
run: |
& ./packages/cli/install.ps1
- name: Set PATH
shell: bash
run: |
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
- name: Verify upgrade
shell: pwsh
run: |
# --check queries npm registry and prints update status
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
# rollback to the previous version (should succeed after a real update)
vp upgrade --rollback
vp --version
- name: Verify installation on powershell
shell: pwsh
working-directory: ${{ runner.temp }}
run: |
# Print PATH from environment
echo "PATH: $env:Path"
vp --version
vp --help
# $env:VITE_LOG = "trace"
# test create command
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build && vp --version
- name: Verify bin setup on powershell
shell: pwsh
run: |
# Verify bin directory was created by vp env --setup
$binPath = "$env:USERPROFILE\.vite-plus\bin"
Get-ChildItem -Force $binPath
if (-not (Test-Path $binPath)) {
Write-Error "Bin directory not found: $binPath"
exit 1
}
# Verify shim executables exist (trampoline .exe files on Windows)
$expectedShims = @("node.exe", "npm.exe", "npx.exe")
foreach ($shim in $expectedShims) {
$shimFile = Join-Path $binPath $shim
if (-not (Test-Path $shimFile)) {
Write-Error "Shim not found: $shimFile"
exit 1
}
Write-Host "Found shim: $shimFile"
}
where.exe node
where.exe npm
where.exe npx
where.exe vp
# Verify vp env doctor works
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
vp env doctor
vp env run --node 24 -- node -p "process.versions"
- name: Verify installation on cmd
shell: cmd
working-directory: ${{ runner.temp }}
run: |
echo PATH: %PATH%
dir "%USERPROFILE%\.vite-plus"
dir "%USERPROFILE%\.vite-plus\bin"
REM test create command
vp create vite --no-interactive --no-agent -- hello-cmd --no-interactive -t vanilla
cd hello-cmd && vp run build && vp --version
- name: Verify bin setup on cmd
shell: cmd
run: |
REM Verify bin directory was created by vp env --setup
set "BIN_PATH=%USERPROFILE%\.vite-plus\bin"
dir "%BIN_PATH%"
REM Verify shim executables exist (Windows uses trampoline .exe files)
for %%s in (node.exe npm.exe npx.exe vp.exe) do (
if not exist "%BIN_PATH%\%%s" (
echo Error: Shim not found: %BIN_PATH%\%%s
exit /b 1
)
echo Found shim: %BIN_PATH%\%%s
)
where node
where npm
where npx
where vp
REM Verify vp env doctor works
vp env doctor
vp env run --node 24 -- node -p "process.versions"
- name: Verify installation on bash
shell: bash
working-directory: ${{ runner.temp }}
run: |
echo "PATH: $PATH"
ls -al ~/.vite-plus
ls -al ~/.vite-plus/bin
vp --version
vp --help
# test create command
vp create vite --no-interactive --no-agent -- hello-bash --no-interactive -t vanilla
cd hello-bash && vp run build && vp --version
- name: Verify bin setup on bash
shell: bash
run: |
# Verify bin directory was created by vp env --setup
BIN_PATH="$HOME/.vite-plus/bin"
ls -al "$BIN_PATH"
if [ ! -d "$BIN_PATH" ]; then
echo "Error: Bin directory not found: $BIN_PATH"
exit 1
fi
# Verify trampoline .exe files exist
for shim in node.exe npm.exe npx.exe vp.exe; do
if [ ! -f "$BIN_PATH/$shim" ]; then
echo "Error: Trampoline shim not found: $BIN_PATH/$shim"
exit 1
fi
echo "Found trampoline shim: $BIN_PATH/$shim"
done
# Verify vp env doctor works
vp env doctor
vp env run --node 24 -- node -p "process.versions"
which node
which npm
which npx
which vp