From 15af4f09629cd6e6b3edf3fc229bf3f057d6a558 Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Thu, 21 May 2026 21:19:22 +0000 Subject: [PATCH] fix(ci): add 30s grace period after services report healthy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even after nginx is listening on port 80, there can be a brief window where the first Playwright requests hit still-warming router logic or upstream connection pool setup, causing inconsistent E2E failures. Now the readiness step: 1. Polls until both http://localhost:8080 and http://localhost:3000/health return HTTP 200 (up to 60 attempts = 10 min max) 2. Once both are confirmed up, sleeps 30 additional seconds before proceeding to E2E tests — a settling period for nginx and the Node server to fully stabilize Co-Authored-By: Paperclip --- .github/workflows/ci.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09810a3..f9a4a68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,16 +82,22 @@ jobs: - name: Wait for services to be ready run: | echo "Waiting for services to become ready..." - for i in $(seq 1 30); do - if curl -sf http://localhost:8080 > /dev/null 2>&1 && curl -sf http://localhost:3000/health > /dev/null 2>&1; then - echo "Services ready after ${i} attempts" + for i in $(seq 1 60); do + # Poll both the web root (proves nginx + static app are up) and the + # API /health endpoint (proves the Node server is responding). + WEB_STATUS=$(curl -sf -o /dev/null -w "%{http_code}" http://localhost:8080 2>/dev/null || echo "000") + API_STATUS=$(curl -sf -o /dev/null -w "%{http_code}" http://localhost:3000/health 2>/dev/null || echo "000") + if [ "$WEB_STATUS" = "200" ] && [ "$API_STATUS" = "200" ]; then + echo "Both services healthy after ${i} attempts (web=$WEB_STATUS, api=$API_STATUS)" + echo "Allowing 30s grace period for nginx to fully initialize..." + sleep 30 exit 0 fi - echo "Attempt $i/30: services not ready yet, waiting 10s..." + echo "Attempt $i/60: web=$WEB_STATUS api=$API_STATUS — waiting 10s..." sleep 10 done - echo "Warning: services may not be fully ready after 30 attempts (5m)" - timeout-minutes: 6 + echo "Warning: services may not be fully ready after 60 attempts (10m)" + timeout-minutes: 12 - name: Run E2E tests run: pnpm --filter @groombook/e2e test