From 96defd5b64737a275bec67542bc097ece5bc1dcf Mon Sep 17 00:00:00 2001 From: Brendan Ryan Date: Sat, 14 Feb 2026 17:50:12 -0800 Subject: [PATCH 1/2] ci: speed up deploy workflow - Add pnpm store caching (cache: pnpm on setup-node) - Run lint/types and tests in parallel jobs - Merge build + deploy into a single job (eliminate redundant checkout, pnpm/node setup, and artifact upload/download) --- .github/workflows/deploy.yml | 92 ++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 51 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2c3567af..d0626596 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy +name: Deploy on: push: @@ -15,23 +15,21 @@ concurrency: cancel-in-progress: true jobs: - ci: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up pnpm - uses: pnpm/action-setup@v4 + - uses: pnpm/action-setup@v4 with: version: 10 - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: "24" + cache: "pnpm" - - name: Install dependencies - run: pnpm install + - run: pnpm install - name: Check code run: pnpm check @@ -39,9 +37,42 @@ jobs: - name: Check types run: pnpm check:types + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 10 + + - uses: actions/setup-node@v4 + with: + node-version: "24" + cache: "pnpm" + + - run: pnpm install + - name: Tests run: pnpm test + build-and-deploy: + needs: [lint, test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 10 + + - uses: actions/setup-node@v4 + with: + node-version: "24" + cache: "pnpm" + + - run: pnpm install + - name: Build run: pnpm build env: @@ -49,23 +80,10 @@ jobs: - name: Smoke test (wrangler dev) run: | - # ────────────────────────────────────────────────────────── - # To reproduce locally: - # pnpm build - # pnpm wrangler:dev & - # curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/quickstart/tempoctl -H 'Accept: text/html' - # curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/ -H 'Accept: text/html' - # curl -s -o /dev/null -w '%{http_code}' http://localhost:8788/ -H 'Accept: text/markdown' - # All three should return 200. If any return 500, check wrangler - # logs for the error — usually a missing module or unsupported - # Node.js API. Fix in scripts/patch-cf.ts. - # ────────────────────────────────────────────────────────── - WRANGLER_LOG=$(mktemp) npx wrangler dev --port 8788 > "$WRANGLER_LOG" 2>&1 & WRANGLER_PID=$! - # Wait for wrangler to be ready (up to 30s) for i in $(seq 1 30); do if curl -sf http://localhost:8788/ -o /dev/null 2>/dev/null; then break @@ -115,34 +133,6 @@ jobs: - name: Prune server bundle run: node --experimental-strip-types scripts/prune-server.ts - - name: Upload build - uses: actions/upload-artifact@v4 - with: - name: dist - path: dist/ - - deploy: - needs: ci - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up pnpm - uses: pnpm/action-setup@v4 - with: - version: 10 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "22" - - - name: Download build - uses: actions/download-artifact@v4 - with: - name: dist - path: dist/ - - name: Sanitize branch name if: github.event_name == 'pull_request' id: branch @@ -166,7 +156,7 @@ jobs: script: | const alias = "${{ steps.branch.outputs.alias }}" const url = `https://${alias}-mpp-docs.porto.workers.dev` - const body = `MPP Docs preview: ${url}` + const body = `docs preview: ${url}` const { data: comments } = await github.rest.issues.listComments({ issue_number: context.issue.number, owner: context.repo.owner, @@ -174,7 +164,7 @@ jobs: }) let existing = null for (const comment of comments) { - if (comment.body && comment.body.startsWith('MPP Docs preview:')) { + if (comment.body && comment.body.startsWith('docs preview:')) { existing = comment break } From c25da1b4ab600cdd9f96e5bea391ae1c35eeb200 Mon Sep 17 00:00:00 2001 From: Brendan Ryan Date: Sun, 15 Feb 2026 08:00:28 -0800 Subject: [PATCH 2/2] ci: use frozen-lockfile and pnpm exec wrangler - Add --frozen-lockfile to all pnpm install steps to prevent lockfile drift - Replace npx wrangler with pnpm exec wrangler in smoke test to use pinned devDependency version --- .github/workflows/deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d0626596..2e9105f0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,7 +29,7 @@ jobs: node-version: "24" cache: "pnpm" - - run: pnpm install + - run: pnpm install --frozen-lockfile - name: Check code run: pnpm check @@ -51,7 +51,7 @@ jobs: node-version: "24" cache: "pnpm" - - run: pnpm install + - run: pnpm install --frozen-lockfile - name: Tests run: pnpm test @@ -71,7 +71,7 @@ jobs: node-version: "24" cache: "pnpm" - - run: pnpm install + - run: pnpm install --frozen-lockfile - name: Build run: pnpm build @@ -81,7 +81,7 @@ jobs: - name: Smoke test (wrangler dev) run: | WRANGLER_LOG=$(mktemp) - npx wrangler dev --port 8788 > "$WRANGLER_LOG" 2>&1 & + pnpm exec wrangler dev --port 8788 > "$WRANGLER_LOG" 2>&1 & WRANGLER_PID=$! for i in $(seq 1 30); do