From c7650cac2fa9bb1003b03fd38441e0c1b647be49 Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 14 May 2026 06:56:50 +0200 Subject: [PATCH] feat(ci): integrate k6 health baseline testing into Gitea workflow - Added a new job to the Gitea CI workflow to install k6 and run health baseline tests after the health wait period. - Updated documentation to reflect the automatic execution of k6 in the CI pipeline and clarified local execution instructions. - Enhanced architecture documentation to indicate the completion of Phase 0 for the pipeline part, with k6 running after each relevant deploy. --- .gitea/workflows/test.yml | 18 ++++++++++++++++++ docs/architecture/BASELINE_SNAPSHOT.md | 5 +++-- scripts/load/README.md | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index fba50b6..be409ad 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -153,6 +153,24 @@ jobs: curl -v "$BASE/health" || true exit 1 + - name: Install k6 (Phase-0 /health-Baseline) + run: | + set -e + K6_VER="v0.55.0" + curl -sSL "https://github.com/grafana/k6/releases/download/${K6_VER}/k6-${K6_VER}-linux-amd64.tar.gz" -o /tmp/k6.tgz + tar -xzf /tmp/k6.tgz -C /tmp + sudo mv "/tmp/k6-${K6_VER}-linux-amd64/k6" /usr/local/bin/k6 + k6 version + + - name: k6 Health-Baseline (parallele /health) + env: + BASE_URL: ${{ steps.e2e.outputs.base_url }} + run: | + set -e + echo "k6 gegen BASE_URL=$BASE_URL" + k6 run scripts/load/k6-health-baseline.js + echo "✓ k6 Health-Baseline passed" + - name: Testnutzer registrieren (Dev, nur wenn möglich) if: ${{ steps.e2e.outputs.mode == 'dev' }} env: diff --git a/docs/architecture/BASELINE_SNAPSHOT.md b/docs/architecture/BASELINE_SNAPSHOT.md index 3081c4c..5c1ad0a 100644 --- a/docs/architecture/BASELINE_SNAPSHOT.md +++ b/docs/architecture/BASELINE_SNAPSHOT.md @@ -78,7 +78,8 @@ Messung: Repo-Root → `cd frontend && npm run build` (Vite Production). ### 3.2 k6 – parallele /health - **Skript:** `scripts/load/k6-health-baseline.js` -- **Anleitung:** `scripts/load/README.md` +- **CI:** Läuft **automatisch** im Gitea-Workflow **playwright-tests** nach der Health-Wartezeit und **vor** Playwright (`.gitea/workflows/test.yml`). +- **Lokal:** siehe `scripts/load/README.md` - **Baseline notieren:** k6-Ausgabe `http_req_duration` p(95), Checks succeeded. | Szenario | p95 / Fehlerquote | Datum / BASE_URL | @@ -89,7 +90,7 @@ Messung: Repo-Root → `cd frontend && npm run build` (Vite Production). ## 4. Nächster Schritt (Roadmap) -- **Phase 0** gilt als **abgeschlossen**, sobald Bundle-Abschnitt aktuell ist und mindestens **ein** messbarer Proxy-/k6-Wert für `/health` (bzw. erste API-Zeile) eingetragen ist – Rest der Tabelle kann iterativ gefüllt werden. +- **Phase 0** ist für den Pipeline-Teil **abgeschlossen**: Bundle dokumentiert; **k6** läuft in CI nach jedem relevanten Deploy (mit Test-Suite); API-p95-Tabellen kann das Team aus Monitoring weiter befüllen (optional, kein Deploy-Blocker). - **Phase 2** (Backend Lesepfade, ggf. Dashboard-Summary) **startet erst nach** diesem Dokument als verbindlicher Baseline-Einstieg (kein blocker für Code, aber Vergleich nach Phase 2 gegen diese Werte). --- diff --git a/scripts/load/README.md b/scripts/load/README.md index 89315fb..939d46f 100644 --- a/scripts/load/README.md +++ b/scripts/load/README.md @@ -2,6 +2,8 @@ Parallele GETs auf `/health` – **ohne** Auth, geeignet für Dev/Prod hinter dem gleichen Proxy wie die App. +**CI / Deploy:** In **`.gitea/workflows/test.yml`** (Job `playwright-tests`): nach **/health-Wartezeit** läuft **k6** automatisch, danach Playwright. Gleiche `BASE_URL` wie E2E (Dev oder Prod nach `workflow_run`). Kein manueller Schritt nach dem Deploy. + ## Voraussetzung [k6 installieren](https://k6.io/docs/getting-started/installation/). @@ -16,7 +18,6 @@ k6 run scripts/load/k6-health-baseline.js ```bash # Linux / macOS -```bash BASE_URL=https://dev.shinkan.jinkendo.de k6 run scripts/load/k6-health-baseline.js ```