Files
Charon/.github/workflows/playwright.yml
GitHub Actions 4e23a63d8f fix(ci): build Docker image before Playwright tests
- Add Docker image build step before docker compose up
- Optimize Playwright browser installation (chromium only)
- Add frontend dependency installation with logging
- Fixes workflow hanging on missing charon:local image

Previous workflow assumed image existed but CI doesn't pre-build it.
Now builds image from Dockerfile before starting application stack.
2026-01-12 19:55:56 +00:00

54 lines
1.7 KiB
YAML

name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Build Frontend
working-directory: frontend
run: |
echo "Installing frontend dependencies..."
npm ci
echo "Building frontend..."
npm run build
- name: Build Docker Image
run: |
echo "Building charon:local Docker image..."
docker build -t charon:local .
- name: Start Application Stack
run: docker compose -f .docker/compose/docker-compose.local.yml up -d
- name: Wait for Application Health
run: |
echo "Waiting for application to be ready..."
timeout 120 bash -c 'until curl -sf http://localhost:8080/api/v1/health > /dev/null; do
echo "Waiting for health endpoint..."
sleep 2
done'
echo "✅ Application is ready"
- name: Run Playwright tests
env:
PLAYWRIGHT_BASE_URL: http://localhost:8080
run: npx playwright test
- name: Stop Application Stack
if: always()
run: docker compose -f .docker/compose/docker-compose.local.yml down -v
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30