[E2E] CI Integration: Gitea Workflow + Docker Test Pod #12

Open
opened 2026-09-08 04:48:30 +00:00 by rock · 0 comments
Owner

Parent

Ref: #5
Depends on: #6, #7, #8, #9, #10, #11

Objective

Create Gitea Actions workflow that spawns a Docker test pod, runs all Playwright E2E tests, and reports results.

Tasks

  • Create .gitea/workflows/e2e-test.yml
  • Workflow triggers: push to main, PR to main, manual dispatch
  • Build app Docker image from existing Dockerfile
  • Spawn test pod using docker-compose or inline Docker commands:
    • Start app container (port 3000)
    • Start Playwright test runner container
    • Wait for app healthcheck (curl http://localhost:3000)
  • Run pnpm test:e2e inside test container with BASE_URL=http://app:3000
  • Collect artifacts:
    • test-results/results.json — machine-readable
    • test-results/results.xml — JUnit for CI integration
    • playwright-report/ — HTML report
    • Screenshots/videos on failure
  • Upload test report as Gitea Action artifact
  • Fail workflow if any test fails (CI gate)
  • Clean up containers after test run (success or failure)
  • Add test summary comment on PR (if triggered by PR)

Workflow Skeleton

name: E2E Tests

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

jobs:
  e2e:
    runs-on: node
    steps:
      - uses: actions/checkout@v4
      - name: Install Docker
        run: apt-get update && apt-get install -y docker.io docker-compose
      - name: Build app image
        run: docker build -t riotpiao-app:test .
      - name: Start app container
        run: docker run -d --name app -p 3000:3000 riotpiao-app:test
      - name: Wait for app
        run: |
          for i in $(seq 1 30); do
            curl -s http://localhost:3000 && break || sleep 2
          done
      - name: Install deps + Playwright
        run: |
          corepack enable && corepack install
          pnpm install --ignore-scripts
          npx playwright install --with-deps chromium
      - name: Run E2E tests
        run: BASE_URL=http://localhost:3000 pnpm test:e2e --project=chromium
        env:
          CI: true
      - name: Upload report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: playwright-report
          path: playwright-report/
      - name: Cleanup
        if: always()
        run: docker stop app && docker rm app

Considerations

  • Start with Chromium only in CI (speed). Full matrix later.
  • Gitea runner is node image — needs Docker-in-Docker or sidecar.
  • Existing build-push.yml runs on same runner — avoid resource conflicts.
  • NEXT_PUBLIC_COMMIT_SHA env var needed for build.
  • API routes (/api/chat, /api/exec) need mocking or env vars to skip real backends.

Acceptance

  • Workflow runs end-to-end on push to main
  • Green check on passing tests, red X on failure
  • HTML report artifact downloadable from Gitea
  • Container cleanup verified (no orphaned containers)
  • Total E2E job completes in <10 min
## Parent Ref: #5 Depends on: #6, #7, #8, #9, #10, #11 ## Objective Create Gitea Actions workflow that spawns a Docker test pod, runs all Playwright E2E tests, and reports results. ## Tasks - [ ] Create `.gitea/workflows/e2e-test.yml` - [ ] Workflow triggers: push to main, PR to main, manual dispatch - [ ] Build app Docker image from existing `Dockerfile` - [ ] Spawn test pod using `docker-compose` or inline Docker commands: - Start app container (port 3000) - Start Playwright test runner container - Wait for app healthcheck (`curl http://localhost:3000`) - [ ] Run `pnpm test:e2e` inside test container with `BASE_URL=http://app:3000` - [ ] Collect artifacts: - `test-results/results.json` — machine-readable - `test-results/results.xml` — JUnit for CI integration - `playwright-report/` — HTML report - Screenshots/videos on failure - [ ] Upload test report as Gitea Action artifact - [ ] Fail workflow if any test fails (CI gate) - [ ] Clean up containers after test run (success or failure) - [ ] Add test summary comment on PR (if triggered by PR) ## Workflow Skeleton ```yaml name: E2E Tests on: push: branches: [main] pull_request: branches: [main] workflow_dispatch: jobs: e2e: runs-on: node steps: - uses: actions/checkout@v4 - name: Install Docker run: apt-get update && apt-get install -y docker.io docker-compose - name: Build app image run: docker build -t riotpiao-app:test . - name: Start app container run: docker run -d --name app -p 3000:3000 riotpiao-app:test - name: Wait for app run: | for i in $(seq 1 30); do curl -s http://localhost:3000 && break || sleep 2 done - name: Install deps + Playwright run: | corepack enable && corepack install pnpm install --ignore-scripts npx playwright install --with-deps chromium - name: Run E2E tests run: BASE_URL=http://localhost:3000 pnpm test:e2e --project=chromium env: CI: true - name: Upload report if: always() uses: actions/upload-artifact@v4 with: name: playwright-report path: playwright-report/ - name: Cleanup if: always() run: docker stop app && docker rm app ``` ## Considerations - Start with Chromium only in CI (speed). Full matrix later. - Gitea runner is `node` image — needs Docker-in-Docker or sidecar. - Existing `build-push.yml` runs on same runner — avoid resource conflicts. - `NEXT_PUBLIC_COMMIT_SHA` env var needed for build. - API routes (`/api/chat`, `/api/exec`) need mocking or env vars to skip real backends. ## Acceptance - Workflow runs end-to-end on push to main - Green check on passing tests, red X on failure - HTML report artifact downloadable from Gitea - Container cleanup verified (no orphaned containers) - Total E2E job completes in <10 min
rock added this to the Functional Testing milestone 2026-09-08 04:55:47 +00:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rock/riotpiao.com#12