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

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

Serve dist/ after build and assert key SPA routes return HTML with bundle references so broken templates cannot slip through CI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci(pages): harden smoke test route checks

Clarify the SPA fallback limitation, make the curl failure branch work under set -e, and add a /404.html static-file assertion to confirm dist assets are actually served.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Mark Yoon 2026-08-06 21:25:00 +09:00 • committed by GitHub
parent e33d09e750
commit 48eb444a25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

View file

@ -45,6 +45,39 @@ jobs:
working-directory: pages
run: npm run build
- name: Smoke test
working-directory: pages
run: |
npx serve dist -s -l tcp://127.0.0.1:3999 &
SERVER_PID=$!
trap 'kill $SERVER_PID 2>/dev/null || true' EXIT
sleep 2
FAILED=0
# `serve -s` rewrites SPA routes to index.html, so this verifies
# the built shell is reachable and includes bundle references.
for path in "/" "/docs/contributing" "/docs/quickstart" "/features"; do
if ! BODY=$(curl -sf "http://127.0.0.1:3999${path}"); 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
# Also check a real static file to ensure dist assets are served.
if ! curl -sf "http://127.0.0.1:3999/404.html" >/dev/null; then
echo "FAIL: /404.html — static file not reachable"
FAILED=1
else
echo "OK: /404.html"
fi
exit $FAILED
- name: Check bundle size
working-directory: pages
run: npm run size

View file

@ -55,6 +55,7 @@
"jsdom": "^30.0.0",
"postcss": "^8.5.15",
"postcss-loader": "^7.3.3",
"serve": "^14.2.6",
"size-limit": "^13.0.1",
"style-loader": "^3.3.3",
"tailwindcss": "^3.3.5",