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:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user