Ampel v2: universelle Vorlage (Fix: checkout braucht Node im Container)
Ampel / ampel (push) Failing after 12m54s
Ampel / ampel (push) Failing after 12m54s
+ package-lock.json (fehlte komplett - Builds waren nie reproduzierbar)
This commit is contained in:
+59
-33
@@ -1,45 +1,71 @@
|
|||||||
# CI-Ampel für Rippy — läuft bei jedem Push auf dem Gitea-Runner (arcane-VM).
|
# Universelle CI-Ampel (Vorlage: mission-control-v2/deploy/ampel-ci.yml, 22.07.2026).
|
||||||
# Zweck: „Erfundenes" mechanisch fangen, bevor irgendwas „fertig" heißen darf.
|
# GRUNDSATZ: Rot ist ein Ergebnis („nicht bewiesen"), kein Ärgernis.
|
||||||
# ROT ist ein Ergebnis, kein Ärgernis: Stand 22.07. ist ROT korrekt, weil es
|
# • Reines Doku-Repo (noch kein Code) → GRÜN mit Vermerk.
|
||||||
# noch keine echten Tests gibt (test_health.py hat kein einziges assert).
|
# • Code ohne Tests → ROT. Tests sind Pflicht, kein Deko.
|
||||||
name: CI
|
# Der Workflow erkennt selbst, was das Projekt ist (Python / Node / beides).
|
||||||
|
name: Ampel
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
api-und-worker:
|
ampel:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: python:3.12-slim
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Ruff (Linter — findet toten Code, kaputte Imports, Schlampereien)
|
- name: Ampel — erkennt Projekt-Typ selbst und prüft entsprechend
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pip install -q ruff
|
set -uo pipefail
|
||||||
ruff check docker/api docker/worker udev
|
rot=0
|
||||||
|
py_datei=$(find . -name '*.py' -not -path './.git/*' -not -path '*/node_modules/*' -print -quit)
|
||||||
|
pkg_dateien=$(find . -name package.json -not -path '*/node_modules/*' -not -path './.git/*')
|
||||||
|
|
||||||
- name: Abhängigkeiten installierbar? (halluzinierte Pakete fliegen hier auf)
|
if [ -z "$py_datei" ] && [ -z "$pkg_dateien" ]; then
|
||||||
run: |
|
echo "✅ Doku-Repo (noch kein Code) — Ampel GRÜN mit Vermerk."
|
||||||
pip install -q -r docker/api/requirements.txt
|
exit 0
|
||||||
pip install -q -r docker/worker/requirements.txt
|
fi
|
||||||
|
|
||||||
- name: Importierbar? (kaputte Modul-Struktur fliegt hier auf)
|
if [ -n "$py_datei" ]; then
|
||||||
run: |
|
echo "== Python erkannt =="
|
||||||
python -m compileall -q docker/api docker/worker udev
|
python3 -m venv /tmp/ampel-venv && . /tmp/ampel-venv/bin/activate
|
||||||
|
pip install -q ruff pytest
|
||||||
|
echo "-- Ruff (Linter: toter Code, kaputte Imports, Schlampereien)"
|
||||||
|
ruff check . || rot=1
|
||||||
|
echo "-- Abhängigkeiten installierbar? (halluzinierte Pakete fliegen hier auf)"
|
||||||
|
while IFS= read -r req; do
|
||||||
|
[ -n "$req" ] || continue
|
||||||
|
pip install -q -r "$req" || { echo "❌ $req nicht installierbar"; rot=1; }
|
||||||
|
done < <(find . -name 'requirements*.txt' -not -path '*/node_modules/*' -not -path './.git/*')
|
||||||
|
echo "-- Importierbar? (kaputte Modul-Struktur fliegt hier auf)"
|
||||||
|
python -m compileall -q . || rot=1
|
||||||
|
echo "-- Pytest (keine Tests gefunden = ROT)"
|
||||||
|
pytest -q; ec=$?
|
||||||
|
if [ $ec -eq 5 ]; then
|
||||||
|
echo "❌ KEINE TESTS GEFUNDEN — Tests sind Pflicht, kein Deko (AGENTS.md)."
|
||||||
|
rot=1
|
||||||
|
elif [ $ec -ne 0 ]; then
|
||||||
|
rot=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Pytest (KEINE Tests gefunden = ROT — Tests sind Pflicht, kein Deko)
|
if [ -n "$pkg_dateien" ]; then
|
||||||
run: |
|
echo "== Node/TypeScript erkannt =="
|
||||||
pip install -q pytest
|
while IFS= read -r pkg; do
|
||||||
pytest docker -q
|
[ -n "$pkg" ] || continue
|
||||||
|
d=$(dirname "$pkg")
|
||||||
|
echo "-- $d"
|
||||||
|
if [ ! -f "$d/package-lock.json" ]; then
|
||||||
|
echo "❌ $d: kein package-lock.json — Build nicht reproduzierbar."
|
||||||
|
echo " Fix: dort 'npm install --package-lock-only' ausführen und committen."
|
||||||
|
rot=1; continue
|
||||||
|
fi
|
||||||
|
(cd "$d" && npm ci --no-audit --no-fund) || { rot=1; continue; }
|
||||||
|
if grep -q '"build"' "$pkg"; then (cd "$d" && npm run build) || rot=1; fi
|
||||||
|
if grep -q '"test"' "$pkg"; then (cd "$d" && npm test --silent) || rot=1; fi
|
||||||
|
done <<< "$pkg_dateien"
|
||||||
|
fi
|
||||||
|
|
||||||
ui:
|
if [ $rot -ne 0 ]; then
|
||||||
runs-on: ubuntu-latest
|
echo "❌ AMPEL ROT — nichts heißt ‚fertig', solange das rot ist."
|
||||||
container: node:22
|
fi
|
||||||
steps:
|
exit $rot
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: UI baut? (TypeScript-Fehler + kaputte Imports fliegen hier auf)
|
|
||||||
working-directory: docker/ui
|
|
||||||
run: |
|
|
||||||
npm ci --no-audit --no-fund
|
|
||||||
npm run build
|
|
||||||
|
|||||||
Generated
+3018
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user