From d1e58811bb8d80aef83e92347ee09b3e26535109 Mon Sep 17 00:00:00 2001 From: Asger Geel Weirsoee Date: Fri, 27 Feb 2026 12:25:36 +0100 Subject: [PATCH] Add CI quality-gate baseline and merge policy targets --- .gitea/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ TODO.md | 7 +++++++ docs/QUALITY_GATES.md | 17 +++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 docs/QUALITY_GATES.md diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..f277444 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + pull_request: + push: + branches: [ main, 'feature/**', 'release/**' ] + +jobs: + test-and-quality: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install pytest pytest-cov ruff black mypy + + - name: Lint + run: ruff check . + + - name: Format check + run: black --check . + + - name: Type check + run: mypy . || true + + - name: Tests + coverage + run: | + pytest --maxfail=1 --disable-warnings --cov=. --cov-report=term-missing --cov-report=xml --cov-fail-under=70 diff --git a/TODO.md b/TODO.md index af5891a..ac1f4a6 100644 --- a/TODO.md +++ b/TODO.md @@ -116,3 +116,10 @@ Byg **Weirsøe Party Protocol**: en dansk party-webapp platform ala Jackbox, hvo - [ ] Opret .po for en og da (dev beholdes som udviklingssprog) - [ ] Tilføj make-targets/kommandoer for makemessages og compilemessages - [ ] Tilføj test der sikrer i18n tags i templates (inspireret af email-manager) + +### Fase 12 — CI/CD og merge-gates (Gitea) +- [ ] Opret CI-workflow i .gitea/workflows/ci.yml +- [ ] Kør lint, format, tests, coverage i CI +- [ ] Enforce coverage >= 70% +- [ ] Branch protection på main (kræv grøn CI + review) +- [ ] Tilføj quality gate-dokumentation i docs/QUALITY_GATES.md diff --git a/docs/QUALITY_GATES.md b/docs/QUALITY_GATES.md new file mode 100644 index 0000000..aabd0e9 --- /dev/null +++ b/docs/QUALITY_GATES.md @@ -0,0 +1,17 @@ +# Quality gates (mål) + +## Merge til main kræver +1. Alle tests grønne +2. Test coverage >= 70% +3. Lint/format/type checks grønne + +## Planlagte checks +- pytest + pytest-cov (coverage XML + summary) +- ruff (lint) +- black --check (format) +- mypy (type checks, gradvis indfasning) + +## Enforcement i Gitea +- Branch protection på main +- Kræv successful checks fra CI-workflow før merge +- Kræv mindst 1 review (kan justeres)