diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 98d60e77..c77482ca 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -111,9 +111,38 @@ jobs: - name: Start server run: | - npx serve out -l 3000 & - sleep 5 - npx wait-on http://localhost:3000 --timeout 60000 + set -euo pipefail + npx serve out -l 3000 > serve.log 2>&1 & + SERVE_PID=$! + echo "serve started, PID=$SERVE_PID" + + # Brief grace period for the child to spawn; wait-on does the real polling. + sleep 2 + + # Verify serve didn't already exit (port in use, missing out/, etc.). + if ! kill -0 "$SERVE_PID" 2>/dev/null; then + echo "::error::serve exited immediately after launch" + echo "--- serve.log ---" + cat serve.log || true + exit 1 + fi + + # Explicit exit-code propagation. Don't rely on -e interacting cleanly + # with backgrounded jobs. + if ! npx wait-on http://localhost:3000 --timeout 60000 --verbose; then + echo "::error::wait-on timed out — serve never bound to port 3000 within 60s" + echo "--- serve.log ---" + cat serve.log || true + echo "--- listening sockets ---" + ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null || true + echo "--- serve process state ---" + ps -fp "$SERVE_PID" 2>/dev/null || echo "serve process $SERVE_PID is gone" + echo "--- direct curl attempt ---" + curl -v --max-time 5 http://localhost:3000/ 2>&1 || true + exit 1 + fi + + echo "serve is responding on http://localhost:3000" - name: Run smoke tests (sign-up only - auth tests run after auth-setup) run: | @@ -183,9 +212,38 @@ jobs: - name: Start server run: | - npx serve out -l 3000 & - sleep 5 - npx wait-on http://localhost:3000 --timeout 60000 + set -euo pipefail + npx serve out -l 3000 > serve.log 2>&1 & + SERVE_PID=$! + echo "serve started, PID=$SERVE_PID" + + # Brief grace period for the child to spawn; wait-on does the real polling. + sleep 2 + + # Verify serve didn't already exit (port in use, missing out/, etc.). + if ! kill -0 "$SERVE_PID" 2>/dev/null; then + echo "::error::serve exited immediately after launch" + echo "--- serve.log ---" + cat serve.log || true + exit 1 + fi + + # Explicit exit-code propagation. Don't rely on -e interacting cleanly + # with backgrounded jobs. + if ! npx wait-on http://localhost:3000 --timeout 60000 --verbose; then + echo "::error::wait-on timed out — serve never bound to port 3000 within 60s" + echo "--- serve.log ---" + cat serve.log || true + echo "--- listening sockets ---" + ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null || true + echo "--- serve process state ---" + ps -fp "$SERVE_PID" 2>/dev/null || echo "serve process $SERVE_PID is gone" + echo "--- direct curl attempt ---" + curl -v --max-time 5 http://localhost:3000/ 2>&1 || true + exit 1 + fi + + echo "serve is responding on http://localhost:3000" - name: Run rate-limiting tests (ordered) run: pnpm test:e2e --project=rate-limiting --project=brute-force --project=signup --reporter=list --trace=on-first-retry @@ -245,9 +303,38 @@ jobs: - name: Start server run: | - npx serve out -l 3000 & - sleep 5 - npx wait-on http://localhost:3000 --timeout 60000 + set -euo pipefail + npx serve out -l 3000 > serve.log 2>&1 & + SERVE_PID=$! + echo "serve started, PID=$SERVE_PID" + + # Brief grace period for the child to spawn; wait-on does the real polling. + sleep 2 + + # Verify serve didn't already exit (port in use, missing out/, etc.). + if ! kill -0 "$SERVE_PID" 2>/dev/null; then + echo "::error::serve exited immediately after launch" + echo "--- serve.log ---" + cat serve.log || true + exit 1 + fi + + # Explicit exit-code propagation. Don't rely on -e interacting cleanly + # with backgrounded jobs. + if ! npx wait-on http://localhost:3000 --timeout 60000 --verbose; then + echo "::error::wait-on timed out — serve never bound to port 3000 within 60s" + echo "--- serve.log ---" + cat serve.log || true + echo "--- listening sockets ---" + ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null || true + echo "--- serve process state ---" + ps -fp "$SERVE_PID" 2>/dev/null || echo "serve process $SERVE_PID is gone" + echo "--- direct curl attempt ---" + curl -v --max-time 5 http://localhost:3000/ 2>&1 || true + exit 1 + fi + + echo "serve is responding on http://localhost:3000" - name: Run auth setup run: pnpm exec playwright test --project=setup --reporter=list --timeout=180000 @@ -352,9 +439,38 @@ jobs: - name: Start server run: | - npx serve out -l 3000 & - sleep 5 - npx wait-on http://localhost:3000 --timeout 60000 + set -euo pipefail + npx serve out -l 3000 > serve.log 2>&1 & + SERVE_PID=$! + echo "serve started, PID=$SERVE_PID" + + # Brief grace period for the child to spawn; wait-on does the real polling. + sleep 2 + + # Verify serve didn't already exit (port in use, missing out/, etc.). + if ! kill -0 "$SERVE_PID" 2>/dev/null; then + echo "::error::serve exited immediately after launch" + echo "--- serve.log ---" + cat serve.log || true + exit 1 + fi + + # Explicit exit-code propagation. Don't rely on -e interacting cleanly + # with backgrounded jobs. + if ! npx wait-on http://localhost:3000 --timeout 60000 --verbose; then + echo "::error::wait-on timed out — serve never bound to port 3000 within 60s" + echo "--- serve.log ---" + cat serve.log || true + echo "--- listening sockets ---" + ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null || true + echo "--- serve process state ---" + ps -fp "$SERVE_PID" 2>/dev/null || echo "serve process $SERVE_PID is gone" + echo "--- direct curl attempt ---" + curl -v --max-time 5 http://localhost:3000/ 2>&1 || true + exit 1 + fi + + echo "serve is responding on http://localhost:3000" env: CI: true @@ -482,9 +598,38 @@ jobs: path: tests/e2e/fixtures/ - name: Start server run: | - npx serve out -l 3000 & - sleep 5 - npx wait-on http://localhost:3000 --timeout 60000 + set -euo pipefail + npx serve out -l 3000 > serve.log 2>&1 & + SERVE_PID=$! + echo "serve started, PID=$SERVE_PID" + + # Brief grace period for the child to spawn; wait-on does the real polling. + sleep 2 + + # Verify serve didn't already exit (port in use, missing out/, etc.). + if ! kill -0 "$SERVE_PID" 2>/dev/null; then + echo "::error::serve exited immediately after launch" + echo "--- serve.log ---" + cat serve.log || true + exit 1 + fi + + # Explicit exit-code propagation. Don't rely on -e interacting cleanly + # with backgrounded jobs. + if ! npx wait-on http://localhost:3000 --timeout 60000 --verbose; then + echo "::error::wait-on timed out — serve never bound to port 3000 within 60s" + echo "--- serve.log ---" + cat serve.log || true + echo "--- listening sockets ---" + ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null || true + echo "--- serve process state ---" + ps -fp "$SERVE_PID" 2>/dev/null || echo "serve process $SERVE_PID is gone" + echo "--- direct curl attempt ---" + curl -v --max-time 5 http://localhost:3000/ 2>&1 || true + exit 1 + fi + + echo "serve is responding on http://localhost:3000" env: CI: true - name: Prime Supabase connection pool @@ -596,9 +741,38 @@ jobs: path: tests/e2e/fixtures/ - name: Start server run: | - npx serve out -l 3000 & - sleep 5 - npx wait-on http://localhost:3000 --timeout 60000 + set -euo pipefail + npx serve out -l 3000 > serve.log 2>&1 & + SERVE_PID=$! + echo "serve started, PID=$SERVE_PID" + + # Brief grace period for the child to spawn; wait-on does the real polling. + sleep 2 + + # Verify serve didn't already exit (port in use, missing out/, etc.). + if ! kill -0 "$SERVE_PID" 2>/dev/null; then + echo "::error::serve exited immediately after launch" + echo "--- serve.log ---" + cat serve.log || true + exit 1 + fi + + # Explicit exit-code propagation. Don't rely on -e interacting cleanly + # with backgrounded jobs. + if ! npx wait-on http://localhost:3000 --timeout 60000 --verbose; then + echo "::error::wait-on timed out — serve never bound to port 3000 within 60s" + echo "--- serve.log ---" + cat serve.log || true + echo "--- listening sockets ---" + ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null || true + echo "--- serve process state ---" + ps -fp "$SERVE_PID" 2>/dev/null || echo "serve process $SERVE_PID is gone" + echo "--- direct curl attempt ---" + curl -v --max-time 5 http://localhost:3000/ 2>&1 || true + exit 1 + fi + + echo "serve is responding on http://localhost:3000" env: CI: true - name: Prime Supabase connection pool