Initial commit
This commit is contained in:
75
.github/workflows/e2e.yml
vendored
Normal file
75
.github/workflows/e2e.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# ── Docker ────────────────────────────────────────────────────────────
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build images
|
||||
run: docker compose -f cicd/docker/docker-compose.yml build
|
||||
|
||||
- name: Start services
|
||||
run: docker compose -f cicd/docker/docker-compose.yml up -d
|
||||
env:
|
||||
# Falls back to the default in docker-compose.yml if the secret is absent
|
||||
JWT_KEY: ${{ secrets.JWT_KEY }}
|
||||
|
||||
- name: Wait for frontend to be ready
|
||||
run: |
|
||||
echo "Waiting for services to become healthy..."
|
||||
timeout 120 bash -c \
|
||||
'until curl -sf http://localhost > /dev/null; do echo " still waiting..."; sleep 3; done'
|
||||
echo "Services are ready."
|
||||
|
||||
# ── Playwright ────────────────────────────────────────────────────────
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: tests/e2e/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: tests/e2e
|
||||
run: npm ci
|
||||
|
||||
- name: Install Playwright browsers
|
||||
working-directory: tests/e2e
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Run E2E tests
|
||||
working-directory: tests/e2e
|
||||
env:
|
||||
BASE_URL: http://localhost
|
||||
CI: 'true'
|
||||
run: npx playwright test
|
||||
|
||||
# ── Artifacts ─────────────────────────────────────────────────────────
|
||||
- name: Upload Playwright report
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: tests/e2e/playwright-report/
|
||||
retention-days: 30
|
||||
|
||||
- name: Dump Docker logs on failure
|
||||
if: failure()
|
||||
run: docker compose -f cicd/docker/docker-compose.yml logs
|
||||
|
||||
# ── Cleanup ───────────────────────────────────────────────────────────
|
||||
- name: Stop services
|
||||
if: always()
|
||||
run: docker compose -f cicd/docker/docker-compose.yml down -v
|
||||
Reference in New Issue
Block a user