Files
tarpc/hooks/pre-push
Adam Wright 6e37d3a37e Fix pre-push/commit hooks so they work.
- Move them back to the root directory of the repo
- Explicitly specify the path to the manifest we are running tests for
2016-01-12 23:35:53 -08:00

31 lines
536 B
Bash
Executable File

#!/bin/sh
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
git diff --exit-code &>/dev/null
if [ "$?" != 0 ];
then
echo ${RED}ERROR${NC} You have uncommitted changes please commit or stash them before pushing so that I can run tests!
exit 1
fi
TEST_RESULT=0
cargo test --manifest-path tarpc/Cargo.toml &>/dev/null
if [ "$?" != "0" ];
then
echo ${RED}FAIL${NC} pre-push test check
TEST_RESULT=1
else
echo ${GREEN}PASS${NC} pre-push test check
fi
RESULT=0
if [ "$TEST_RESULT" == "1" ];
then
RESULT=1
fi
exit $RESULT