From 885df3b3a83b38d2586326061400824dd619b833 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Tue, 7 Apr 2026 20:07:07 +0100 Subject: [PATCH] test(smoke): add astro build verification for all demos and templates (#361) Smoke tests only ran astro dev, which uses Vite's on-demand compilation and never invokes the adapter build pipeline. Build failures in cloudflare/playground demos (or any adapter-dependent site) passed CI undetected. Add a build verification suite that runs astro build for every site in the matrix before the existing runtime tests. Bumps smoke test CI timeout from 15 to 30 minutes to accommodate. --- .github/workflows/ci.yml | 2 +- .../smoke/site-matrix-smoke.test.ts | 43 ++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3220481..6aba14c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: test-smoke: name: Smoke Tests runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 30 services: postgres: image: postgres:17 diff --git a/packages/core/tests/integration/smoke/site-matrix-smoke.test.ts b/packages/core/tests/integration/smoke/site-matrix-smoke.test.ts index 2f2bf93..6d0ec10 100644 --- a/packages/core/tests/integration/smoke/site-matrix-smoke.test.ts +++ b/packages/core/tests/integration/smoke/site-matrix-smoke.test.ts @@ -180,7 +180,48 @@ async function fetchWithRetry(url: string, retries = 10, delayMs = 1500): Promis throw lastError instanceof Error ? lastError : new Error(`Request failed for ${url}`); } -describe.sequential("Site smoke matrix", () => { +// --------------------------------------------------------------------------- +// Build verification — runs `astro build` for every site to catch adapter +// and bundling errors that dev mode doesn't surface. +// --------------------------------------------------------------------------- + +describe.sequential("Site build verification", () => { + const BUILD_TIMEOUT = 120_000; + + for (const site of SITE_MATRIX) { + if (site.mode === "typecheck") continue; + + it(`${site.name} builds successfully`, { timeout: BUILD_TIMEOUT + 30_000 }, async () => { + await ensureBuilt(); + + try { + await execAsync("pnpm", ["exec", "astro", "build"], { + cwd: site.dir, + timeout: BUILD_TIMEOUT, + env: { + ...process.env, + CI: "true", + }, + }); + } catch (error) { + const stderr = + error instanceof Error && "stderr" in error ? (error as { stderr: string }).stderr : ""; + const stdout = + error instanceof Error && "stdout" in error ? (error as { stdout: string }).stdout : ""; + throw new Error(`${site.name} build failed:\n\n${stderr || stdout}`.slice(0, 5000), { + cause: error, + }); + } + }); + } +}); + +// --------------------------------------------------------------------------- +// Runtime verification — boots each site with `astro dev` and checks that +// admin + frontend respond. +// --------------------------------------------------------------------------- + +describe.sequential("Site runtime verification", () => { for (const site of SITE_MATRIX) { if (site.mode === "typecheck") { it(`${site.name} typechecks`, { timeout: 120_000 }, async () => {