chore: pre-commit hook — pull --rebase + tests avant chaque commit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 11:02:16 +02:00
parent d64abcd9c5
commit 9bc3a98d44
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT=$(git rev-parse --show-toplevel)
BRANCH=$(git symbolic-ref --short HEAD)
echo "🔄 Pre-commit : synchronisation avec origin/$BRANCH..."
if ! git pull --rebase --autostash origin "$BRANCH"; then
echo "❌ git pull --rebase a échoué — résous les conflits avant de committer"
exit 1
fi
echo "🧪 Pre-commit : exécution des tests..."
if podman run --rm \
--privileged \
--network host \
-v "$REPO_ROOT":/workspace:Z \
-v /run/user/"$(id -u)"/podman/podman.sock:/var/run/docker.sock:Z \
-e DOCKER_HOST=unix:///var/run/docker.sock \
-e TESTCONTAINERS_RYUK_DISABLED=true \
-w /workspace \
eclipse-temurin:25-jdk \
./gradlew test --no-daemon; then
echo "✅ Tests réussis — commit autorisé"
else
echo "❌ Tests échoués — commit annulé"
exit 1
fi