Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pages-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[maintainability · medium]
Reliability concern: fixed sleep 2 is fragile.

On a busy CI runner, 2 seconds may not be enough for the server to be ready. Consider using a polling loop with retries instead, which is more resilient to variable startup times:

for i in $(seq 1 20); do
  curl -sf http://127.0.0.1:3999/ > /dev/null && break
  sleep 0.5
done


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
1 change: 1 addition & 0 deletions pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down