How-to: Configure CI Smoke Tests
Before a branch hits Vercel, we want confidence that npm run build won’t implode. A 60-second smoke test is usually enough to catch syntax errors and missing env vars.
Goal
Wire a GitHub Actions workflow that installs dependencies, runs the Next.js build, and fails pull requests early if anything breaks. Optionally build the Astro docs too.
Steps
- Create
.github/workflows/smoke.yml.
name: smoke
on:
pull_request:
branches: ["*"]
jobs:
build-and-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install web deps
run: cd web && npm ci
- name: Lint + build
run: cd web && npm run build
- name: Confirm build artifacts
run: test -f web/.next/BUILD_MANIFEST
- (Optional) Add docs build if you deploy the Astro book.
- name: Build docs
run: cd astro-book && npm ci && npm run build
Expected output
Each PR gets a “smoke” check. When it’s green, we know next build succeeded and Turbopack didn’t choke. When it’s red, the log shows the exact command that failed—no guesswork.
Pitfalls
- Don’t stuff end-to-end tests into this workflow; keep it fast so contributors see feedback quickly.
- Cache
~/.npmif builds start feeling slow (actions/cachemakes it trivial).
Time estimate
About 10 minutes, including the commit.