Wasserdicht-Runde: universelle CI-Ampel fuer ALLE Lucy/MC2-Repos
- deploy/ampel-ci.yml: sprachneutrale Actions-Ampel (erkennt Python/Node selbst; Doku-Repo=gruen, Code ohne Tests=ROT) - gitea-repo-create.sh: pflanzt die Ampel bei JEDER Repo-Anlage ein (Contents-API, Push-Token, defensiv) - projektstart-SOUL: drei harte AGENTS-Regeln (Ampel-Pflicht, Spec-Abweichung=STOPP, Deploy nur via deploy.sh) — rippy-Lehren Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Universelle CI-Ampel — wird bei der Repo-Anlage automatisch eingepflanzt
|
||||
# (gitea-repo-create.sh, Wasserdicht-Runde 22.07.2026) und läuft auf dem
|
||||
# Gitea-Actions-Runner (arcane-VM).
|
||||
# GRUNDSATZ: Rot ist ein Ergebnis („nicht bewiesen"), kein Ärgernis.
|
||||
# • Reines Doku-Repo (noch kein Code) → GRÜN mit Vermerk.
|
||||
# • Code ohne Tests → ROT. Tests sind Pflicht, kein Deko.
|
||||
# Der Workflow erkennt selbst, was das Projekt ist (Python / Node / beides).
|
||||
name: Ampel
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
ampel:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Ampel — erkennt Projekt-Typ selbst und prüft entsprechend
|
||||
shell: bash
|
||||
run: |
|
||||
set -uo pipefail
|
||||
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/*')
|
||||
|
||||
if [ -z "$py_datei" ] && [ -z "$pkg_dateien" ]; then
|
||||
echo "✅ Doku-Repo (noch kein Code) — Ampel GRÜN mit Vermerk."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$py_datei" ]; then
|
||||
echo "== Python erkannt =="
|
||||
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
|
||||
|
||||
if [ -n "$pkg_dateien" ]; then
|
||||
echo "== Node/TypeScript erkannt =="
|
||||
while IFS= read -r pkg; do
|
||||
[ -n "$pkg" ] || continue
|
||||
d=$(dirname "$pkg")
|
||||
echo "-- $d"
|
||||
(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
|
||||
|
||||
if [ $rot -ne 0 ]; then
|
||||
echo "❌ AMPEL ROT — nichts heißt ‚fertig', solange das rot ist."
|
||||
fi
|
||||
exit $rot
|
||||
Reference in New Issue
Block a user