2023-03-07 18:08:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
NO_COLOR='\033[0m'
|
|
|
|
|
|
|
|
echo "*********************************************************"
|
2023-10-17 19:36:26 +00:00
|
|
|
echo "Running git pre-push hook."
|
2023-03-07 18:08:11 +00:00
|
|
|
echo "*********************************************************"
|
2023-10-17 19:36:26 +00:00
|
|
|
echo ""
|
|
|
|
echo "Java Version: "
|
|
|
|
echo "$JAVA_HOME"
|
|
|
|
echo "$(java -version)"
|
|
|
|
echo "Running test... "
|
2023-03-07 18:08:11 +00:00
|
|
|
|
2023-03-08 19:17:04 +00:00
|
|
|
./gradlew test
|
2023-03-07 18:08:11 +00:00
|
|
|
|
|
|
|
status=$?
|
|
|
|
|
|
|
|
if [ "$status" = 0 ] ; then
|
2023-03-08 19:17:04 +00:00
|
|
|
echo "All test passed."
|
2023-03-07 18:08:11 +00:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "*********************************************************"
|
2023-03-08 19:17:04 +00:00
|
|
|
echo 1>&2 "Failing test"
|
|
|
|
printf "Run ${GREEN}./gradlew test${NO_COLOR} to make sure you have all tests green before pushing...\n"
|
2023-03-07 18:08:11 +00:00
|
|
|
echo "*********************************************************"
|
|
|
|
exit 1
|
|
|
|
fi
|