diff --git a/.github/workflows/api-contracts.yml b/.github/workflows/api-contracts.yml index ce7f801..1727f06 100644 --- a/.github/workflows/api-contracts.yml +++ b/.github/workflows/api-contracts.yml @@ -74,13 +74,32 @@ jobs: - name: Start FastAPI backend run: | cd backend - python -m uvicorn app:app --host 0.0.0.0 --port 8000 & + BACKEND_LOG="${{ github.workspace }}/backend.log" + + # Start backend with logging + python -m uvicorn app:app --host 0.0.0.0 --port 8000 > "$BACKEND_LOG" 2>&1 & + BACKEND_PID=$! + echo "Backend started with PID: $BACKEND_PID" + # Wait for backend to be ready echo "Waiting for backend to start..." - sleep 15 - # Verify backend is responding - curl --retry 5 --retry-delay 2 --retry-connrefused http://localhost:8000/health || exit 1 - echo "Backend is ready!" + sleep 30 + + # Check if process is still running + if ! ps -p $BACKEND_PID > /dev/null; then + echo "❌ Backend process died! Logs:" + cat "$BACKEND_LOG" + exit 1 + fi + + # Verify backend is responding with more retries + echo "Checking backend health..." + curl --retry 10 --retry-delay 3 --retry-connrefused http://localhost:8000/health || { + echo "❌ Backend health check failed! Logs:" + cat "$BACKEND_LOG" + exit 1 + } + echo "✅ Backend is ready!" env: LINKEDIN_CLIENT_ID: test_client_id LINKEDIN_CLIENT_SECRET: test_client_secret