Created
December 23, 2016 12:40
-
-
Save gwillem/f4a745fce1bbca47a282fda09268aba0 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
echo | |
echo "Running pre-commit hooks to perform unit tests (see tools/git-*)" | |
function finish { | |
OVERRIDE="$BASE/.git-commit-override-jaja" | |
echo | |
echo "Not all tests succeeded, I don't want to commit now." | |
echo "Testing for override file: $OVERRIDE" | |
if [ -f $OVERRIDE ]; | |
then | |
echo "Override file set. Am committing anyway and will unchain armageddon." | |
echo | |
exit 0 | |
else | |
echo "Override file not found, will not commit." | |
echo | |
exit 1 | |
fi | |
} | |
trap finish EXIT | |
BASE=$(git rev-parse --show-toplevel) | |
echo "- Running autopep8 on whitespace stuff" | |
git status --porcelain | grep -v -P '^(R|D)' | cut -b4- | egrep '\.py$' | xargs --no-run-if-empty $BASE/tools/autopep8.sh | |
echo "- Testing coverage of node tests, rerun with $BASE/tests/node/test_generator.py" | |
chronic $BASE/tools/ansible_task_validator.py | |
echo "- Running PEP8 and nosetests unit tests for $BASE" | |
chronic $BASE/runtests.sh -1 | |
trap - EXIT | |
echo | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment