Skip to content

test: skip flaky snap tests on macOS and win32 #6149

test: skip flaky snap tests on macOS and win32

test: skip flaky snap tests on macOS and win32 #6149

Workflow file for this run

name: CI
permissions:
# Doing it explicitly because the default permission only includes metadata: read.
contents: read
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, labeled]
push:
branches:
- main
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
defaults:
run:
shell: bash
jobs:
optimize-ci:
runs-on: ubuntu-latest # or whichever runner you use for your CI
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
uses: withgraphite/graphite-ci-action@ee395f3a78254c006d11339669c6cabddf196f72
with:
graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
detect-changes:
runs-on: ubuntu-latest
needs: optimize-ci
if: needs.optimize-ci.outputs.skip == 'false'
permissions:
contents: read
pull-requests: read
outputs:
code-changed: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
code:
- '!**/*.md'
download-previous-rolldown-binaries:
needs: detect-changes
if: needs.detect-changes.outputs.code-changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/download-rolldown-binaries
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test:
needs: detect-changes
if: needs.detect-changes.outputs.code-changed == 'true'
name: Test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- name: Setup Dev Drive
if: runner.os == 'Windows'
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
with:
drive-size: 12GB
drive-format: ReFS
env-mapping: |
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: test
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}
- run: rustup target add x86_64-unknown-linux-musl
if: ${{ matrix.os == 'ubuntu-latest' }}
- run: cargo check --all-targets --all-features
env:
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml
# Test all crates/* packages. New crates are automatically included.
# Also test vite-plus-cli (lives outside crates/) to catch type sync issues.
- run: cargo test $(for d in crates/*/; do echo -n "-p $(basename $d) "; done) -p vite-plus-cli
lint:
needs: detect-changes
if: needs.detect-changes.outputs.code-changed == 'true'
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: lint
tools: cargo-shear
components: clippy rust-docs rustfmt
- run: |
cargo shear
cargo fmt --check
# cargo clippy --all-targets --all-features -- -D warnings
# RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items
- uses: crate-ci/typos@631208b7aac2daa8b707f55e7331f9112b0e062d # v1.44.0
with:
files: .
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- name: Install docs dependencies
run: pnpm -C docs install --frozen-lockfile
- name: Deduplicate dependencies
run: pnpm dedupe --check
run:
name: Run task
runs-on: ubuntu-latest
needs:
- download-previous-rolldown-binaries
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: run
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: rolldown-binaries
path: ./rolldown/packages/rolldown/src
merge-multiple: true
- name: Build with upstream
uses: ./.github/actions/build-upstream
with:
target: x86_64-unknown-linux-gnu
- name: Install Global CLI vp
run: |
pnpm bootstrap-cli:ci
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
- name: Print help for built-in commands
run: |
which vp
vp -h
vp run -h
vp lint -h
vp test -h
vp build -h
vp fmt -h
cli-e2e-test:
name: CLI E2E test
needs:
- download-previous-rolldown-binaries
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- name: Setup Dev Drive
if: runner.os == 'Windows'
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
with:
drive-size: 12GB
drive-format: ReFS
env-mapping: |
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: cli-e2e-test
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- name: Install docs dependencies
run: pnpm -C docs install --frozen-lockfile
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: rolldown-binaries
path: ./rolldown/packages/rolldown/src
merge-multiple: true
- name: Build with upstream
uses: ./.github/actions/build-upstream
with:
target: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || matrix.os == 'windows-latest' && 'x86_64-pc-windows-msvc' || 'aarch64-apple-darwin' }}
- name: Check TypeScript types
if: ${{ matrix.os == 'ubuntu-latest' }}
run: pnpm tsgo
- name: Install Global CLI vp
run: |
pnpm bootstrap-cli:ci
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
else
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
fi
- name: Verify vp installation
run: |
which vp
vp --version
vp -h
- name: Run vp check
run: vp check
- name: Test global package install (powershell)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
echo "PATH: $env:Path"
where.exe node
where.exe npm
where.exe npx
where.exe vp
vp env doctor
# Test 1: Install a JS-based CLI (typescript)
vp install -g typescript
tsc --version
where.exe tsc
# Test 2: Verify the package was installed correctly
Get-ChildItem "$env:USERPROFILE\.vite-plus\packages\typescript\"
Get-ChildItem "$env:USERPROFILE\.vite-plus\bin\"
# Test 3: Uninstall
vp uninstall -g typescript
# Test 4: Verify uninstall removed shim
Write-Host "Checking bin dir after uninstall:"
Get-ChildItem "$env:USERPROFILE\.vite-plus\bin\"
$shimPath = "$env:USERPROFILE\.vite-plus\bin\tsc.cmd"
if (Test-Path $shimPath) {
Write-Error "tsc shim file still exists at $shimPath"
exit 1
}
Write-Host "tsc shim removed successfully"
# Test 5: use session
vp env use 18
node --version
vp env doctor
vp env use --unset
node --version
- name: Test global package install (cmd)
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
run: |
echo "PATH: %PATH%"
where.exe node
where.exe npm
where.exe npx
where.exe vp
vp env use 18
node --version
vp env use --unset
node --version
vp env doctor
REM Test 1: Install a JS-based CLI (typescript)
vp install -g typescript
tsc --version
where.exe tsc
REM Test 2: Verify the package was installed correctly
dir "%USERPROFILE%\.vite-plus\packages\typescript\"
dir "%USERPROFILE%\.vite-plus\bin\"
REM Test 3: Uninstall
vp uninstall -g typescript
REM Test 4: Verify uninstall removed shim (.cmd wrapper)
echo Checking bin dir after uninstall:
dir "%USERPROFILE%\.vite-plus\bin\"
if exist "%USERPROFILE%\.vite-plus\bin\tsc.cmd" (
echo Error: tsc.cmd shim file still exists
exit /b 1
)
echo tsc.cmd shim removed successfully
REM Test 5: Verify shell script was also removed (for Git Bash)
if exist "%USERPROFILE%\.vite-plus\bin\tsc" (
echo Error: tsc shell script still exists
exit /b 1
)
echo tsc shell script removed successfully
REM Test 6: use session
vp env use 18
node --version
vp env doctor
vp env use --unset
node --version
- name: Test global package install (bash)
run: |
echo "PATH: $PATH"
ls -la ~/.vite-plus/
ls -la ~/.vite-plus/bin/
which node
which npm
which npx
which vp
vp env doctor
# Test 1: Install a JS-based CLI (typescript)
vp install -g typescript
tsc --version
which tsc
# Test 2: Verify the package was installed correctly
ls -la ~/.vite-plus/packages/typescript/
ls -la ~/.vite-plus/bin/
# Test 3: Uninstall
vp uninstall -g typescript
# Test 4: Verify uninstall removed shim
echo "Checking bin dir after uninstall:"
ls -la ~/.vite-plus/bin/
if [ -f ~/.vite-plus/bin/tsc ]; then
echo "Error: tsc shim file still exists at ~/.vite-plus/bin/tsc"
exit 1
fi
echo "tsc shim removed successfully"
# Test 5: use session
vp env use 18
node --version
vp env doctor
vp env use --unset
node --version
- name: Install Playwright browsers
run: pnpx playwright install chromium
- name: Run CLI snapshot tests
run: |
RUST_BACKTRACE=1 pnpm test
if ! git diff --exit-code; then
echo "::error::Snapshot diff detected. Run 'pnpm -F vite-plus snap-test' locally and commit the updated snap.txt files."
git diff --stat
git diff
exit 1
fi
# Upgrade tests (merged from separate job to avoid duplicate build)
- name: Test upgrade (bash)
shell: bash
run: |
# Helper to read the installed CLI version from package.json
get_cli_version() {
node -p "require(require('path').resolve(process.env.USERPROFILE || process.env.HOME, '.vite-plus', 'current', 'node_modules', 'vite-plus', 'package.json')).version"
}
# Save initial (dev build) version
INITIAL_VERSION=$(get_cli_version)
echo "Initial version: $INITIAL_VERSION"
# --check queries npm registry and prints update status
vp upgrade --check
# full upgrade: download, extract, swap
vp upgrade --force
vp --version
vp env doctor
ls -la ~/.vite-plus/
# Verify version changed after update
UPDATED_VERSION=$(get_cli_version)
echo "Updated version: $UPDATED_VERSION"
if [ "$UPDATED_VERSION" == "$INITIAL_VERSION" ]; then
echo "Error: version should have changed after upgrade (still $INITIAL_VERSION)"
exit 1
fi
# rollback to the previous version
vp upgrade --rollback
vp --version
vp env doctor
# Verify version restored after rollback
ROLLBACK_VERSION=$(get_cli_version)
echo "Rollback version: $ROLLBACK_VERSION"
if [ "$ROLLBACK_VERSION" != "$INITIAL_VERSION" ]; then
echo "Error: version should have been restored after rollback (expected $INITIAL_VERSION, got $ROLLBACK_VERSION)"
exit 1
fi
- name: Test upgrade (powershell)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
Get-ChildItem "$env:USERPROFILE\.vite-plus\"
# Helper to read the installed CLI version from package.json
function Get-CliVersion {
node -p "require(require('path').resolve(process.env.USERPROFILE, '.vite-plus', 'current', 'node_modules', 'vite-plus', 'package.json')).version"
}
# Save initial (dev build) version
$initialVersion = Get-CliVersion
Write-Host "Initial version: $initialVersion"
# --check queries npm registry and prints update status
vp upgrade --check
# full upgrade: download, extract, swap
vp upgrade --force
vp --version
vp env doctor
Get-ChildItem "$env:USERPROFILE\.vite-plus\"
# Verify version changed after update
$updatedVersion = Get-CliVersion
Write-Host "Updated version: $updatedVersion"
if ($updatedVersion -eq $initialVersion) {
Write-Error "Error: version should have changed after upgrade (still $initialVersion)"
exit 1
}
# rollback to the previous version
vp upgrade --rollback
vp --version
vp env doctor
# Verify version restored after rollback
$rollbackVersion = Get-CliVersion
Write-Host "Rollback version: $rollbackVersion"
if ($rollbackVersion -ne $initialVersion) {
Write-Error "Error: version should have been restored after rollback (expected $initialVersion, got $rollbackVersion)"
exit 1
}
- name: Test upgrade (cmd)
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
run: |
REM Save initial (dev build) version
for /f "usebackq delims=" %%v in (`node -p "require(require('path').resolve(process.env.USERPROFILE, '.vite-plus', 'current', 'node_modules', 'vite-plus', 'package.json')).version"`) do set INITIAL_VERSION=%%v
echo Initial version: %INITIAL_VERSION%
REM --check queries npm registry and prints update status
vp upgrade --check
REM full upgrade: download, extract, swap
vp upgrade --force
vp --version
vp env doctor
dir "%USERPROFILE%\.vite-plus\"
REM Verify version changed after update
for /f "usebackq delims=" %%v in (`node -p "require(require('path').resolve(process.env.USERPROFILE, '.vite-plus', 'current', 'node_modules', 'vite-plus', 'package.json')).version"`) do set UPDATED_VERSION=%%v
echo Updated version: %UPDATED_VERSION%
if "%UPDATED_VERSION%"=="%INITIAL_VERSION%" (
echo Error: version should have changed after upgrade, still %INITIAL_VERSION%
exit /b 1
)
REM rollback to the previous version
vp upgrade --rollback
vp --version
vp env doctor
REM Verify version restored after rollback
for /f "usebackq delims=" %%v in (`node -p "require(require('path').resolve(process.env.USERPROFILE, '.vite-plus', 'current', 'node_modules', 'vite-plus', 'package.json')).version"`) do set ROLLBACK_VERSION=%%v
echo Rollback version: %ROLLBACK_VERSION%
if not "%ROLLBACK_VERSION%"=="%INITIAL_VERSION%" (
echo Error: version should have been restored after rollback, expected %INITIAL_VERSION%, got %ROLLBACK_VERSION%
exit /b 1
)
- name: Test implode (bash)
shell: bash
run: |
vp implode --yes
ls -la ~/
VP_HOME="${USERPROFILE:-$HOME}/.vite-plus"
if [ -d "$VP_HOME" ]; then
echo "Error: $VP_HOME still exists after implode"
exit 1
fi
# Reinstall
pnpm bootstrap-cli:ci
vp --version
- name: Test implode (powershell)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
vp implode --yes
Start-Sleep -Seconds 5
dir "$env:USERPROFILE\"
if (Test-Path "$env:USERPROFILE\.vite-plus") {
Write-Error "~/.vite-plus still exists after implode"
exit 1
}
pnpm bootstrap-cli:ci
vp --version
- name: Test implode (cmd)
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
run: |
REM vp.exe renames its own parent directory; cmd.exe may report
REM "The system cannot find the path specified" on exit — ignore it.
vp implode --yes || ver >NUL
timeout /T 5 /NOBREAK >NUL
dir "%USERPROFILE%\"
if exist "%USERPROFILE%\.vite-plus" (
echo Error: .vite-plus still exists after implode
exit /b 1
)
pnpm bootstrap-cli:ci
vp --version
install-e2e-test:
name: Local CLI `vp install` E2E test
needs:
- download-previous-rolldown-binaries
runs-on: ubuntu-latest
# Run if: not a PR, OR PR has 'test: install-e2e' label
if: >-
github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'test: install-e2e')
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/clone
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: install-e2e-test
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: rolldown-binaries
path: ./rolldown/packages/rolldown/src
merge-multiple: true
- name: Build with upstream
uses: ./.github/actions/build-upstream
with:
target: x86_64-unknown-linux-gnu
- name: Build CLI
run: |
pnpm bootstrap-cli:ci
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
- name: Run local CLI `vp install`
run: |
export PATH=$PWD/node_modules/.bin:$PATH
vp -h
# Test vp install on various repositories with different package managers
repos=(
# pnpm workspace
"pnpm/pnpm:pnpm"
"vitejs/vite:vite"
# yarn workspace
"napi-rs/napi-rs:napi-rs"
"toeverything/AFFiNE:AFFiNE"
# npm workspace
"npm/cli:npm"
"redhat-developer/vscode-extension-tester:vscode-extension-tester"
)
for repo_info in "${repos[@]}"; do
IFS=':' read -r repo dir_name <<< "$repo_info"
echo "Testing vp install on $repo…"
# remove the directory if it exists
if [ -d "$RUNNER_TEMP/$dir_name" ]; then
rm -rf "$RUNNER_TEMP/$dir_name"
fi
git clone --depth 1 "https://github.com/$repo.git" "$RUNNER_TEMP/$dir_name"
cd "$RUNNER_TEMP/$dir_name"
vp install
# run again to show install cache increase by time
time vp install
echo "✓ Successfully installed dependencies for $repo"
echo ""
done
done:
runs-on: ubuntu-latest
if: always()
needs:
- test
- lint
- run
- cli-e2e-test
steps:
- run: exit 1
# Thank you, next https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml#L379
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}