Files
CapaKraken/.github/workflows/deploy-test.yml
T
Hartmut 1d02afddfd ci(e2e): add Playwright smoke tests to deploy-test workflow
Completes Epic #37 remaining scope:
- playwright.ci.config.ts — targets localhost:3100 (already-running Docker
  app), testMatch restricted to smoke.spec.ts, HTML report on failure
- e2e/smoke.spec.ts — 5 tests: health endpoint, unauth redirect, signin
  page render, admin login redirect, app shell nav visible
- deploy-test.yml — seed admin user via docker exec, setup Node 20, install
  Playwright 1.49 + Chromium, run smoke tests, upload report artifact on failure

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-02 23:25:12 +02:00

91 lines
2.5 KiB
YAML

name: Docker Deploy Test
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: deploy-test-${{ github.ref }}
cancel-in-progress: true
jobs:
docker-deploy-test:
name: Fresh-Linux Docker Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create minimal .env
run: |
cat <<'EOF' > .env
NEXTAUTH_URL=http://localhost:3100
NEXTAUTH_SECRET=ci-test-secret-minimum-32-chars-xx
PGADMIN_PASSWORD=ci-pgadmin
EOF
- name: Start infrastructure (postgres + redis)
run: docker compose up -d postgres redis
- name: Wait for postgres
run: |
for i in $(seq 1 20); do
docker compose exec -T postgres pg_isready -U capakraken -d capakraken && break
sleep 3
done
- name: Build and start app (full profile)
run: docker compose --profile full up -d --build app
- name: Wait for /api/health (up to 3 minutes)
run: |
for i in $(seq 1 36); do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100/api/health || echo "000")
echo "Attempt $i: HTTP $STATUS"
if [ "$STATUS" = "200" ]; then exit 0; fi
sleep 5
done
echo "Health check timed out"
docker compose logs app --tail=50
exit 1
- name: Verify health response contains status ok
run: |
BODY=$(curl -sf http://localhost:3100/api/health)
echo "$BODY"
echo "$BODY" | grep '"status":"ok"'
- name: Seed admin user
run: |
docker compose exec -T app node /app/scripts/setup-admin.mjs \
--email admin@capakraken.dev \
--name "Admin" \
--password admin123
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Playwright and Chromium
run: |
npm install -g @playwright/test@1.49
playwright install chromium --with-deps
- name: Run smoke tests
run: npx playwright test --config apps/web/playwright.ci.config.ts
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-smoke-report
path: apps/web/playwright-report/
retention-days: 7
- name: Show logs on failure
if: failure()
run: docker compose logs --tail=100