mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-30 12:36:00 +02:00
Merge pull request #231 from Chemaclass/add-pre-push-hook
Add pre-push git hook to run tests
This commit is contained in:
commit
24b85ed9ac
@ -16,7 +16,8 @@ plugins {
|
||||
}
|
||||
|
||||
task installGitHook(type: Copy) {
|
||||
from new File(rootProject.rootDir, 'pre-commit')
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-commit')
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-push')
|
||||
into { new File(rootProject.rootDir, '.git/hooks') }
|
||||
fileMode 0777
|
||||
}
|
||||
|
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
|
Loading…
x
Reference in New Issue
Block a user