Skip to content

Commit

Permalink
Add pre-push git hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
michakraus committed Jul 10, 2024
1 parent 2c49c8d commit 53ef70f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# pre-push git hook that runs all tests before pushing

red='\033[0;31m'
green='\033[0;32m'
no_color='\033[0m'

reponame=$(basename `git rev-parse --show-toplevel`)


echo "\nRunning pre-push hook\n"
echo "Testing $reponame"
julia --project=@. -e "using Pkg; Pkg.test(\"SimpleSolvers\")"

if [[ $? -ne 0 ]]; then
echo "\n${red}ERROR - Tests must pass before push!\n${no_color}"
exit 1
fi

echo "\n${green}Git hook was SUCCESSFUL!${no_color}\n"

0 comments on commit 53ef70f

Please sign in to comment.