Created
September 7, 2014 13:22
-
-
Save lukestringer90/c1f44cbcbf92b9548c3e to your computer and use it in GitHub Desktop.
Pre commit hook to run Xcode unit tests
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/sh | |
# A hook script to run Xcode unit tests before committing. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
WORKSPACE_PATH="path/to/your.xcworkspace" | |
SCHEME="scheme-name" | |
SDK="iphonesimulator" | |
DEFAULT_TASK="xcodebuild -workspace $WORKSPACE_PATH -scheme $SCHEME -sdk $SDK clean test" | |
# xcpretty makes output nicer | |
if hash xcpretty 2>/dev/null; then | |
$DEFAULT_TASK | xcpretty -t; exit ${PIPESTATUS[0]} | |
else | |
$DEFAULT_TASK | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment