Created
June 20, 2016 11:37
-
-
Save hdznrrd/a457246d5bac99a1788cc81ea411fc04 to your computer and use it in GitHub Desktop.
git pre-push hook running build & tests using maven and only pushing if tests succeeded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# git pre-push hook running build & tests using maven and only pushing if tests succeeded | |
# | |
# will do a local check-out of your currentl commit state and see if that one builds. | |
# this will spare you nasty surprises from missing to add files or having broken partially commited files | |
# | |
PWD=$(pwd) | |
ROOT="file://$(git rev-parse --show-toplevel)" | |
TMP=$(mktemp -d) | |
cd "$TMP" | |
git clone "$ROOT" test --depth 1 | |
cd test | |
mvn clean test | |
SUCCESS=$? | |
cd "$PWD" | |
rm -rf "$TMP" | |
exit $SUCCESS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks