pr_ci_playwright_e2e #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pr_ci_playwright_e2e | |
on: | |
workflow_dispatch: | |
jobs: | |
frontend: | |
name: Run PR Frontend E2E Check | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: Cleanup Old Checkout | |
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*; | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clean Any Existing Containers | |
run: | | |
docker stop $(docker ps -aq) || true | |
docker rm $(docker ps -aq) || true | |
- name: Check Port Availability | |
run: | | |
! nc -z localhost 3000 && \ | |
! nc -z localhost 8000 && \ | |
! nc -z localhost 5432 | |
- name: Run Docker Compose | |
run: docker compose --env-file .env.dev up --build -d backend db | |
- name: Check Docker Container Logs | |
run: docker compose --env-file .env.dev logs | |
- name: Setup Node Environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Set Environment Variables | |
working-directory: ./frontend | |
run: set -a && source ../.env.dev && set +a | |
- name: Clean Yarn Cache | |
working-directory: ./frontend | |
run: sudo yarn cache clean | |
- name: Install dependencies via Yarn | |
working-directory: ./frontend | |
run: | | |
sudo yarn install | |
sudo yarn build | |
- name: Run Node Server | |
working-directory: ./frontend | |
run: node .output/server/index.mjs | |
- name: Install Playwright Browsers | |
working-directory: ./frontend | |
run: sudo yarn playwright install --with-deps | |
- name: Wait for Web Server | |
working-directory: ./frontend | |
run: | | |
MAX_ATTEMPTS=3 | |
WAIT_TIME=30 | |
ATTEMPT=1 | |
while [[ $ATTEMPT -le $MAX_ATTEMPTS ]]; do | |
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS" | |
yarn wait-on http://localhost:3000 --timeout ${WAIT_TIME}000 | |
STATUS=$? | |
if [[ $STATUS -eq 0 ]]; then | |
echo "Server is ready!" | |
break | |
else | |
echo "Server not ready, retrying..." | |
ATTEMPT=$((ATTEMPT + 1)) | |
if [[ $ATTEMPT -gt $MAX_ATTEMPTS ]]; then | |
echo "Server failed to start after $MAX_ATTEMPTS attempts." | |
exit 1 | |
fi | |
sleep 1 | |
fi | |
done | |
- name: Run Playwright Tests | |
working-directory: ./frontend | |
run: sudo yarn playwright test | |
- name: Upload Playwright Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: frontend/playwright-report/ | |
retention-days: 30 |