mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-24 18:43:59 +02:00
Add pre-push git hook to run tests
This commit is contained in:
23
git-hooks/pre-commit
Executable file
23
git-hooks/pre-commit
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo "*********************************************************"
|
||||
echo "Running git pre-commit hook. Running Static analysis... "
|
||||
echo "*********************************************************"
|
||||
|
||||
./gradlew ktlintCheck
|
||||
|
||||
status=$?
|
||||
|
||||
if [ "$status" = 0 ] ; then
|
||||
echo "Static analysis found no problems."
|
||||
exit 0
|
||||
else
|
||||
echo "*********************************************************"
|
||||
echo 1>&2 "Static analysis found violations it could not fix."
|
||||
printf "Run ${GREEN}./gradlew ktlintFormat${NO_COLOR} to fix formatting related issues...\n"
|
||||
echo "*********************************************************"
|
||||
exit 1
|
||||
fi
|
23
git-hooks/pre-push
Executable file
23
git-hooks/pre-push
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo "*********************************************************"
|
||||
echo "Running git pre-push hook. Running test... "
|
||||
echo "*********************************************************"
|
||||
|
||||
./gradlew test
|
||||
|
||||
status=$?
|
||||
|
||||
if [ "$status" = 0 ] ; then
|
||||
echo "All test passed."
|
||||
exit 0
|
||||
else
|
||||
echo "*********************************************************"
|
||||
echo 1>&2 "Failing test"
|
||||
printf "Run ${GREEN}./gradlew test${NO_COLOR} to make sure you have all tests green before pushing...\n"
|
||||
echo "*********************************************************"
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user