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.
This commit is contained in:
Matt Kane
2026-04-07 20:07:07 +01:00
committed by GitHub
parent 5b3e33c26b
commit 885df3b3a8
2 changed files with 43 additions and 2 deletions

View File

@@ -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

View File

@@ -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 () => {