Skip to content

ci(pages): add smoke test step to verify build output is servable #725

Description

@lizhengfeng101

Description

The pages-ci.yml workflow currently runs lint, typecheck, build, and bundle size checks — but never verifies that the build output can actually be served and accessed. Since pages/ is a React SPA (React Router v6 + webpack), a broken HTML template or missing bundle reference would slip through undetected.

We should add a lightweight smoke test step that starts a static file server against dist/ and verifies key routes return HTTP 200 with valid bundle references.

Scope

  • File(s): .github/workflows/pages-ci.yml, pages/package.json
  • Area: Pages CI pipeline

Proposed Approach

  1. Add serve to pages/package.json devDependencies (avoids npx download on every run).
  2. After the existing Build step in pages-ci.yml, add a smoke test step:
      - name: Smoke test
        working-directory: pages
        run: |
          npx serve dist -s -l tcp://127.0.0.1:3999 &
          SERVER_PID=$!
          sleep 2

          FAILED=0
          for path in "/" "/docs/contributing" "/docs/quickstart" "/features"; do
            BODY=$(curl -sf "http://127.0.0.1:3999${path}")
            if [ $? -ne 0 ]; then
              echo "FAIL: ${path} — not reachable"
              FAILED=1
            elif ! echo "$BODY" | grep -q '\.bundle\.js'; then
              echo "FAIL: ${path} — missing bundle reference"
              FAILED=1
            else
              echo "OK: ${path}"
            fi
          done

          kill $SERVER_PID
          exit $FAILED

Key details:

  • Uses serve -s (SPA mode) to fallback all routes to index.html, matching real deployment behavior.
  • Checks that responses contain .bundle.js references to confirm the build artifact is complete.
  • Runs inside the existing node:24.18.0 container — no additional dependencies or browser binaries needed.
  • Estimated added time: ~3 seconds (server start + curl checks).

Acceptance Criteria

  • serve added to pages/package.json devDependencies
  • Smoke test step added to pages-ci.yml after the Build step
  • At least /, /docs/contributing, /docs/quickstart, /features are checked
  • Step correctly fails if a route is unreachable or missing bundle references
  • CI passes on a PR that touches pages/

Context

Discovered while adding documentation changes to pages/src/content/docs/ — realized there's no validation that the built site is actually servable. This is a lightweight alternative to full browser-based testing (Playwright) that avoids ~400MB browser binary downloads on the self-hosted runner.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions