Skip to content
Merged
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
27 changes: 27 additions & 0 deletions .github/actions/setup-node-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup Node.js and pnpm
description: Install pnpm, set up Node.js with cache, and install dependencies. Requires the repo to already be checked out.

inputs:
node-version:
description: Node.js version to use
required: false
default: "24"
registry-url:
description: npm registry URL (e.g. https://registry.npmjs.org). Leave empty to skip.
required: false
default: ""

runs:
using: composite
steps:
- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
registry-url: ${{ inputs.registry-url }}

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
Comment thread Fixed
Comment thread Fixed
13 changes: 3 additions & 10 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,17 @@ jobs:
with:
fetch-depth: 0 # Need full history for commit info

- uses: pnpm/action-setup@v4
- uses: ./.github/actions/setup-node-pnpm

- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- name: Build vinext plugin
run: pnpm run build

- name: Install hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.19.0/hyperfine_1.19.0_amd64.deb
echo "5ffe6996aefbbf547f383116eea53569263cc7cf6598ee53f0081e37b702055d hyperfine_1.19.0_amd64.deb" | sha256sum -c
sudo dpkg -i hyperfine_1.19.0_amd64.deb

# Install monorepo deps (builds vinext plugin via pnpm run build)
- run: pnpm install --frozen-lockfile
- name: Build vinext plugin
run: pnpm run build

# Generate the shared benchmark app (copies app/ into each project dir)
- name: Generate benchmark app
run: node benchmarks/generate-app.mjs
Expand Down
104 changes: 36 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm
- run: pnpm run lint

typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm
- run: pnpm run typecheck

test:
name: Vitest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm
- name: Build plugin (needed by ecosystem fixtures)
run: pnpm run build
- run: pnpm test
Expand All @@ -65,67 +50,46 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm
- name: Build plugin
run: pnpm run build

- name: Pack vinext for local install
run: npm pack --pack-destination "${{ runner.temp }}"
working-directory: packages/vinext

- name: Scaffold a fresh create-next-app project
run: npx create-next-app@latest "${{ runner.temp }}/cna-test" --yes

- name: Install vinext from local tarball
working-directory: ${{ runner.temp }}/cna-test
shell: bash
run: npm install "${{ runner.temp }}"/vinext-*.tgz

- name: Run vinext init
working-directory: ${{ runner.temp }}/cna-test
run: npx vinext init --skip-check

- name: Start dev server and verify HTTP 200
working-directory: ${{ runner.temp }}/cna-test
shell: node {0}
shell: bash
run: |
const { spawn } = require("child_process");
const http = require("http");

const isWin = process.platform === "win32";
const server = spawn("npx", ["vite", "dev", "--port", "3099"], {
cwd: process.cwd(),
stdio: "inherit",
shell: true,
});

let attempts = 0;
const maxAttempts = 30;
const interval = setInterval(() => {
attempts++;
http.get("http://localhost:3099/", (res) => {
if (res.statusCode === 200) {
console.log(`Server responded with HTTP 200 (attempt ${attempts})`);
clearInterval(interval);
if (isWin) {
spawn("taskkill", ["/pid", String(server.pid), "/T", "/F"], { stdio: "ignore" });
} else {
server.kill("SIGTERM");
}
process.exit(0);
}
}).on("error", () => {});
if (attempts >= maxAttempts) {
console.error("Server did not respond with HTTP 200 within 30 seconds");
clearInterval(interval);
if (isWin) {
spawn("taskkill", ["/pid", String(server.pid), "/T", "/F"], { stdio: "ignore" });
} else {
server.kill("SIGTERM");
}
process.exit(1);
}
}, 1000);
npx 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 }})
Expand All @@ -141,19 +105,23 @@ jobs:
- cloudflare-workers
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm
- name: Build plugin
run: pnpm run build

- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-chromium-${{ runner.os }}-${{ hashFiles('**/package.json') }}

- run: pnpm exec playwright install chromium

- run: pnpm exec playwright test
env:
CI: true
PLAYWRIGHT_PROJECT: ${{ matrix.project }}

- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/deploy-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main]

concurrency:
group: deploy-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
# Skip entirely for fork PRs — they don't have access to deploy secrets.
Expand Down Expand Up @@ -43,15 +47,7 @@ jobs:
wrangler_config: dist/server/wrangler.json
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm

- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm

- name: Build vinext plugin
run: pnpm run build
Expand Down Expand Up @@ -116,7 +112,7 @@ jobs:
script: |
const prNumber = context.issue.number;
const alias = `pr-${prNumber}`;

const examples = [
{ name: 'app-router-cloudflare', project: 'app-router-cloudflare' },
{ name: 'pages-router-cloudflare', project: 'pages-router-cloudflare' },
Expand All @@ -126,30 +122,30 @@ jobs:
{ name: 'benchmarks', project: 'benchmarks' },
{ name: 'hackernews', project: 'hackernews', original: 'https://next-react-server-components.vercel.app' },
];

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});

const marker = '<!-- vinext-deploy-previews -->';
const existingComment = comments.find(c => c.body?.includes(marker));

const rows = examples
.map(e => {
const orig = e.original ? `[original](${e.original})` : '';
return `| ${e.name} | [preview](https://${alias}-${e.project}.vinext.workers.dev) | [production](https://${e.project}.vinext.workers.dev) | ${orig} |`;
})
.join('\n');

const body = [
marker,
'| Example | Preview | Production | Original |',
'|---------|---------|------------|----------|',
rows,
].join('\n');

if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/deploy-preview-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,7 @@ jobs:
with:
ref: ${{ needs.check.outputs.sha }}

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm

- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/setup-node-pnpm

- name: Build vinext plugin
run: pnpm run build
Expand Down
Loading
Loading