Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 13 additions & 24 deletions .github/actions/build-upstream/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ runs:
packages/cli/binding/index.d.cts
target/${{ inputs.target }}/release/vp
target/${{ inputs.target }}/release/vp.exe
target/${{ inputs.target }}/release/vp-shim.exe
key: ${{ steps.cache-key.outputs.key }}

# Apply Vite+ branding patches to rolldown-vite source (CI checks out
Expand All @@ -60,23 +61,14 @@ runs:
# NAPI builds - only run on cache miss (slow, especially on Windows)
# Must run before vite-plus TypeScript builds which depend on the bindings
- name: Build NAPI bindings (x86_64-linux)
- name: Build NAPI bindings (Linux)
shell: bash
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux')
run: |
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
env:
TARGET_CC: clang
DEBUG: napi:*

- name: Build NAPI bindings (aarch64-linux)
shell: bash
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
run: |
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
env:
TARGET_CC: clang
TARGET_CFLAGS: '-D_BSD_SOURCE'
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
DEBUG: napi:*

- name: Build NAPI bindings (non-Linux targets)
Expand All @@ -87,30 +79,26 @@ runs:
env:
DEBUG: napi:*

- name: Build Rust CLI binary (x86_64-linux)
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
shell: bash
run: |
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
env:
TARGET_CC: clang
DEBUG: napi:*

- name: Build Rust CLI binary (aarch64-linux)
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
- name: Build Rust CLI binary (Linux)
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux')
shell: bash
run: |
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
env:
TARGET_CC: clang
TARGET_CFLAGS: '-D_BSD_SOURCE'
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
DEBUG: napi:*

- name: Build Rust CLI binary (non-Linux targets)
if: steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
shell: bash
run: cargo build --release --target ${{ inputs.target }} -p vite_global_cli

- name: Build trampoline shim binary (Windows only)
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'windows')
shell: bash
run: cargo build --release --target ${{ inputs.target }} -p vite_trampoline

- name: Save NAPI binding cache
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@94b89442628ad1d101e352b7ee38f30e1bef108e # v5
Expand All @@ -123,6 +111,7 @@ runs:
packages/cli/binding/index.d.cts
target/${{ inputs.target }}/release/vp
target/${{ inputs.target }}/release/vp.exe
target/${{ inputs.target }}/release/vp-shim.exe
key: ${{ steps.cache-key.outputs.key }}

# Build vite-plus TypeScript after native bindings are ready
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/download-rolldown-binaries/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ runs:
- name: Install previous release
shell: bash
run: |
# Always download the binding that matches the runner OS (not the
# Rust cross-compilation target). The rolldown binding is loaded by
# Node.js on the host to run JS build steps, not cross-compiled.
if ${{ runner.os == 'Windows' }}; then
export TARGET="win32-x64-msvc"
elif ${{ runner.os == 'Linux' }}; then
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ jobs:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
Expand All @@ -96,19 +98,20 @@ jobs:
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: test
cache-key: test-${{ matrix.target }}
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' }}
- name: Add musl target
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: rustup target add x86_64-unknown-linux-musl

- run: cargo check --all-targets --all-features
- run: cargo check --all-targets --all-features --target ${{ matrix.target }}
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
- run: cargo test $(for d in crates/*/; do echo -n "-p $(basename $d) "; done) -p vite-plus-cli --target ${{ matrix.target }}

lint:
needs: detect-changes
Expand Down Expand Up @@ -195,8 +198,13 @@ jobs:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
Expand All @@ -215,7 +223,7 @@ jobs:
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: cli-e2e-test
cache-key: cli-e2e-test-${{ matrix.target }}
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}

- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
Expand All @@ -232,10 +240,10 @@ jobs:
- 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' }}
target: ${{ matrix.target }}

- name: Check TypeScript types
if: ${{ matrix.os == 'ubuntu-latest' }}
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
run: pnpm tsgo

- name: Install Global CLI vp
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ jobs:
cd packages/cli && pnpm pack --pack-destination ../../tmp/tgz && cd ../..
# Copy vp binary for e2e-test job (findVpBinary expects it in target/)
cp target/${{ matrix.target }}/release/vp tmp/tgz/vp 2>/dev/null || cp target/${{ matrix.target }}/release/vp.exe tmp/tgz/vp.exe 2>/dev/null || true
cp target/${{ matrix.target }}/release/vp-shim.exe tmp/tgz/vp-shim.exe 2>/dev/null || true
ls -la tmp/tgz

- name: Upload tgz artifacts
Expand Down Expand Up @@ -289,12 +290,16 @@ jobs:
# Place vp binary where install-global-cli.ts expects it (target/release/)
mkdir -p target/release
cp tmp/tgz/vp target/release/vp 2>/dev/null || cp tmp/tgz/vp.exe target/release/vp.exe 2>/dev/null || true
cp tmp/tgz/vp-shim.exe target/release/vp-shim.exe 2>/dev/null || true
chmod +x target/release/vp 2>/dev/null || true
node $GITHUB_WORKSPACE/packages/tools/src/install-global-cli.ts --tgz $GITHUB_WORKSPACE/tmp/tgz/vite-plus-0.0.0.tgz
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
# Use USERPROFILE (native Windows path) instead of HOME (Git Bash path /c/Users/...)
# so cmd.exe and Node.js execSync can resolve binaries in PATH
echo "${USERPROFILE:-$HOME}/.vite-plus/bin" >> $GITHUB_PATH

- name: Migrate in ${{ matrix.project.name }}
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
shell: bash
run: |
node $GITHUB_WORKSPACE/ecosystem-ci/patch-project.ts ${{ matrix.project.name }}
vp install --no-frozen-lockfile
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ jobs:
os: macos-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
Expand Down Expand Up @@ -124,6 +128,7 @@ jobs:
path: |
./target/${{ matrix.settings.target }}/release/vp
./target/${{ matrix.settings.target }}/release/vp.exe
./target/${{ matrix.settings.target }}/release/vp-shim.exe
if-no-files-found: error

- name: Remove .node files before upload dist
Expand Down
Loading
Loading