Skip to content

Commit

Permalink
Add compilation test to githook (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikmaeckel authored Oct 29, 2024
1 parent 4160a46 commit ed7b99a
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,30 @@ echo "------------"

git stash -q --keep-index

./gradlew spotlessCheck
echo "--------------------"
echo "Compiling classes..."
echo "--------------------"

./gradlew assemble
compile_status=$?

status=$?
if [ "$compile_status" = 0 ] ; then
echo "Classes compiled successfully."
else
echo "------------"
echo 1>&2 "Compilation of classes failed."
echo "Fix the compilation issues before trying to push again."
echo "------------"
fi

echo "--------------------"
echo "Running spotless..."
echo "--------------------"

./gradlew spotlessCheck
spotless_status=$?

if [ "$status" = 0 ] ; then
if [ "$spotless_status" = 0 ] ; then
echo "Static analysis found no problems."
else
echo "------------"
Expand All @@ -20,4 +39,4 @@ fi

git stash pop -q

exit $status
exit $((spotless_status + compile_status))

0 comments on commit ed7b99a

Please sign in to comment.