-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ci(pages): add smoke test step to verify build output is servable #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,6 +45,30 @@ 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 | ||||||||
| for path in "/" "/docs/contributing" "/docs/quickstart" "/features"; do | ||||||||
| BODY=$(curl -sf "http://127.0.0.1:3999${path}") | ||||||||
| if [ $? -ne 0 ]; then | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [bug · high] GitHub Actions Restructure so that Suggestion:
Suggested change
|
||||||||
| 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 | ||||||||
|
|
||||||||
| exit $FAILED | ||||||||
|
|
||||||||
| - name: Check bundle size | ||||||||
| working-directory: pages | ||||||||
| run: npm run size | ||||||||
There was a problem hiding this comment.
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 2is 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: