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:
Executable
+28
@@ -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
|
||||
Reference in New Issue
Block a user