Files
F-r-ldraledigplannerare/.github/workflows/ci.yml
T
jacobh2 ed5680253e Check in a browser what the unit tests cannot see
Every serious defect in this project was found by opening the app, most
recently a feature that rendered blank cards to every user while its tests
passed, and a progress bar labelled in the wrong unit. Five checks now run
without a person: that the age-four figures on screen match what the API
computed, that a multi-week period draws as one bar rather than fragments,
that Sundays and holidays are red where Saturdays are not, that no identifier
leaks into visible text, and that no page logs an error.

Three of them were confirmed by reintroducing the original bug and watching
the right test fail. Dates are derived rather than written down: Easter is
computed independently instead of asked of the system under test, and the
fixture period is placed relative to today, so the suite does not expire.

It runs as its own job and does not block a merge until it has proved itself
stable.
2026-09-17 19:46:17 +02:00

117 lines
3.2 KiB
YAML

name: CI
on:
push:
branches: [main, develop]
pull_request:
jobs:
# ---------------------------------------------------------------------------
# Backend: ruff lint + pytest with coverage gate (rises as junior tests land)
# ---------------------------------------------------------------------------
backend:
name: Backend (Python)
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Install dependencies
run: uv sync
- name: Lint (ruff)
run: uv run ruff check .
- name: Format check (ruff)
run: uv run ruff format --check .
- name: Test with coverage
# Measured ~81%; set threshold 1-2pp below to catch regressions.
run: uv run pytest --cov=app --cov-report=term-missing --cov-fail-under=80
# ---------------------------------------------------------------------------
# Frontend: ESLint + Vitest with 90% coverage gate
# ---------------------------------------------------------------------------
frontend:
name: Frontend (TypeScript)
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Test with coverage
run: npm run coverage
# ---------------------------------------------------------------------------
# E2E (Playwright): browser-driven checks the unit suites can't catch —
# see frontend/e2e/ for what each spec guards against. NOT a required/
# blocking gate yet (continue-on-error): it should run and report for a
# while before it can fail anyone's merge. Promoting it: drop
# `continue-on-error`, add this job to the branch protection's required
# checks, and confirm several consecutive green runs first.
# ---------------------------------------------------------------------------
e2e:
name: E2E (Playwright)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install backend dependencies
working-directory: backend
run: uv sync
- name: Install frontend dependencies
working-directory: frontend
run: npm install
- name: Install Playwright browsers
working-directory: frontend
run: npx playwright install --with-deps chromium
- name: Run Playwright E2E suite
working-directory: frontend
run: npm run e2e
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 7