-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from swapnil-musale/git_hooks_pre-commit
pre-commit Git Hooks Implementation
- Loading branch information
Showing
3 changed files
with
60 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
# | ||
# pre-commit hook will run every time when we try to commit code through Android Studio IDE or Command Line | ||
# - It will run the unit test before committing code | ||
# It will return exit 0 if everything well and good else return other than zero with valid message to fix it. | ||
# | ||
|
||
echo "Running Unit Tests ..." | ||
bash ./gradlew test --stacktrace | ||
|
||
status=$? | ||
|
||
if [ "$status" = 0 ] ; then | ||
echo "Unit test passed successfully." | ||
exit 0 | ||
else | ||
echo 1>&2 "Unit test failed." | ||
exit 1 | ||
fi |