ci: pre-push-Hook + Installer für lokalen Test-Gate

scripts/git-hooks/pre-push lässt pytest vor jedem Push laufen und bricht
bei roten Tests ab — automatischer Regressionsschutz ohne Forgejo-Runner.
scripts/install-hooks.sh installiert die versionierten Hooks nach .git/hooks
(das selbst nicht versioniert ist). In DEPLOYMENT.md Teil 4.0 dokumentiert.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-06-25 00:58:09 +02:00
commit 7a0cf0abb4
3 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
# pre-push: Die Test-Suite muss gruen sein, sonst wird der Push abgebrochen.
# Installation: scripts/install-hooks.sh | Im Notfall umgehen: git push --no-verify
set -uo pipefail
REPO="/opt/voice-assistant"
PYTHON="$REPO/.venv/bin/python"
echo "▶ pre-push: pytest laeuft (ca. 35 s) ..."
if [ ! -x "$PYTHON" ]; then
echo "✗ pre-push: $PYTHON nicht gefunden — Push abgebrochen."
exit 1
fi
cd "$REPO" || exit 1
if ! "$PYTHON" -m pytest -q; then
echo
echo "✗ pre-push: Tests fehlgeschlagen — Push abgebrochen."
echo " (Im Notfall umgehen mit: git push --no-verify)"
exit 1
fi
echo "✓ pre-push: alle Tests gruen — Push wird fortgesetzt."
exit 0