Skip to content

fix: prevent URL/content mismatch on rapid Pages Router navigation #2523

fix: prevent URL/content mismatch on rapid Pages Router navigation

fix: prevent URL/content mismatch on rapid Pages Router navigation #2523

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call: # allow other workflows to run CI as a gate
permissions:
contents: read
concurrency:
group: ci-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin (needed for benchmark workspace type resolution)
run: vp run build
- run: vp run check
test-unit:
name: Vitest (unit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- run: vp test run --project unit
test-integration:
name: Vitest (integration ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin (needed by ecosystem and nextjs-compat fixtures)
run: vp run build
- run: vp test run --project integration --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
env:
CI: true
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: blob-report-${{ matrix.shardIndex }}
path: .vitest-reports/*
include-hidden-files: true
retention-days: 1
test-integration-merge:
name: Vitest (integration report)
if: ${{ !cancelled() }}
needs: [test-integration]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- uses: actions/download-artifact@v7
with:
path: .vitest-reports
pattern: blob-report-*
merge-multiple: true
- run: vp test run --merge-reports
env:
CI: true
create-next-app:
name: create-next-app (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin
run: vp run build
- name: Pack vinext for local install
run: vp pm pack --pack-destination "${{ runner.temp }}"
working-directory: packages/vinext
- name: Scaffold a fresh create-next-app project
run: vp dlx create-next-app@latest "${{ runner.temp }}/cna-test" --yes
- name: Install vinext from local tarball
working-directory: ${{ runner.temp }}/cna-test
shell: bash
run: vp add "${{ runner.temp }}"/vinext-*.tgz
- name: Run vinext init
working-directory: ${{ runner.temp }}/cna-test
run: vp exec vinext init --skip-check
- name: Start dev server and verify HTTP 200
working-directory: ${{ runner.temp }}/cna-test
shell: bash
run: |
vp exec vite dev --port 3099 &
SERVER_PID=$!
for i in $(seq 1 30); do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3099/ || true)
if [ "$STATUS" = "200" ]; then
echo "Server responded with HTTP 200 (attempt $i)"
kill "$SERVER_PID" 2>/dev/null || true
exit 0
fi
sleep 1
done
echo "Server did not respond with HTTP 200 within 30 seconds"
kill "$SERVER_PID" 2>/dev/null || true
exit 1
e2e:
name: E2E (${{ matrix.project }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- pages-router
- app-router
- cloudflare-pages-router
- pages-router-prod
- cloudflare-workers
- cloudflare-dev
- cloudflare-pages-router-dev
- static-export
- app-with-src
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
- name: Build plugin
run: vp run build
- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-chromium-${{ runner.os }}-${{ hashFiles('**/package.json') }}
- run: vp exec playwright install chromium
- run: vp run test:e2e
env:
CI: true
PLAYWRIGHT_PROJECT: ${{ matrix.project }}
- uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report-${{ matrix.project }}
path: playwright-report/
retention-days: 7
ci:
name: CI
if: ${{ always() }}
needs: [check, test-unit, test-integration-merge, create-next-app, e2e]
runs-on: ubuntu-latest
steps:
- name: All checks passed
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: echo "All checks passed"
- name: Some checks failed
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1