Add a pre-push git-hook to run tests on obitools commands before pushing on master

This commit is contained in:
Eric Coissac
2025-03-08 18:56:02 +01:00
parent 52d5f6fe11
commit 50d11ce374
3 changed files with 42 additions and 16 deletions

23
git-hooks/pre-push Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
remote="$1"
#url="$2"
log() {
echo -e "[Pre-Push tests @ $(date)] $*" 1>&2
}
current_branch=$(git symbolic-ref --short head)
cmd="make githubtests"
if [[ $current_branch = "master" ]]; then
log "you are on $current_branch, running build test"
if ! eval "$cmd"; then
log "Pre-push tests failed $cmd"
exit 1
fi
fi
log "Tests are OK, ready to push on $remote"
exit 0