mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-26 17:02:32 +01:00
Test all crates and format on pre-commit
This commit is contained in:
@@ -52,3 +52,11 @@ fi
|
||||
|
||||
# If there are whitespace errors, print the offending file names and fail.
|
||||
exec git diff-index --check --cached $against --
|
||||
|
||||
YELLOW='\033[0;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
function cargo_format() {
|
||||
echo ${YELLOW}[PRECOMMIT]${NC} Formatting $1 ...
|
||||
cargo fmt --manifest-path $1/Cargo.toml &>/dev/null
|
||||
}
|
||||
|
||||
@@ -17,18 +17,23 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "${YELLOW}[PRESUBMIT]${NC} Running tests ... "
|
||||
|
||||
TEST_RESULT=0
|
||||
cargo test --manifest-path tarpc/Cargo.toml &>/dev/null
|
||||
if [ "$?" != "0" ];
|
||||
then
|
||||
printf "${RED}FAILED${NC}"
|
||||
TEST_RESULT=1
|
||||
else
|
||||
printf "${GREEN}ok${NC}"
|
||||
fi
|
||||
printf "\n"
|
||||
|
||||
function cargo_test() {
|
||||
printf "${YELLOW}[PREPUSH]${NC} Testing $1 ... "
|
||||
cargo test --manifest-path $1/Cargo.toml &>/dev/null
|
||||
if [ "$?" != "0" ];
|
||||
then
|
||||
printf "${RED}FAILED${NC}"
|
||||
TEST_RESULT=1
|
||||
else
|
||||
printf "${GREEN}ok${NC}"
|
||||
fi
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
cargo_test tarpc
|
||||
cargo_test tarpc_examples
|
||||
|
||||
RESULT=0
|
||||
if [ "$TEST_RESULT" == "1" ];
|
||||
|
||||
Reference in New Issue
Block a user