Skip to content

Instantly share code, notes, and snippets.

@x1a0
Created February 11, 2014 10:33
Show Gist options
  • Save x1a0/8932553 to your computer and use it in GitHub Desktop.
Save x1a0/8932553 to your computer and use it in GitHub Desktop.
Run test before pushing
#!/bin/bash
CMD="sbt test"
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
exit 0
fi
$CMD
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo -e "\e[1m\e[31mFailed $CMD\e[0m\e[21m"
exit 1
fi
echo -e "\e[1m\e[32mAll Tests passed!\e[0m\e[21m"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment