Skip to content

Commit

Permalink
added web server retry logic to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aasimsyed committed May 17, 2024
1 parent 2f41e31 commit 8260303
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/pr_ci_playwright_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,30 @@ jobs:
run: |
sudo yarn playwright install --with-deps
- name: Wait for web server to be ready
- name: Wait for web server to be ready with retry
working-directory: ./frontend
run: |
yarn wait-on http://localhost:3000
MAX_ATTEMPTS=3
WAIT_TIME=90
ATTEMPT=1
while [[ $ATTEMPT -le $MAX_ATTEMPTS ]]
do
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS"
if yarn wait-on http://localhost:3000 --timeout ${WAIT_TIME}000; then
echo "Server is ready!"
break
else
echo "Server not ready, restarting Docker Compose..."
docker compose --env-file .env.dev down
docker compose --env-file .env.dev up --build -d
ATTEMPT=$((ATTEMPT + 1))
if [[ $ATTEMPT -gt $MAX_ATTEMPTS ]]; then
echo "Server failed to start after $MAX_ATTEMPTS attempts."
exit 1
fi
sleep 10
fi
done
- name: Run Playwright tests
working-directory: ./frontend
Expand Down

0 comments on commit 8260303

Please sign in to comment.