Last active
January 18, 2021 14:28
-
-
Save rozd/bd0c1c1ef048649ffd36838ea9dff3a4 to your computer and use it in GitHub Desktop.
pre-push for Swift projects
This file contains hidden or 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 | |
# Prevent commits containing Tailor errors or warnings to be pushed to remote | |
remote="$1" | |
url="$2" | |
RED='\033[0;31m' # Red Color | |
NC='\033[0m' # No Color | |
tailor --max-severity error | |
tailor_exit_code=$?; | |
if [ $tailor_exit_code != 0 ] | |
then | |
echo >&2 "${RED}Tailor found some issues in your changes, please fix them before push.${NC}" | |
exit $tailor_exit_code; | |
fi | |
# Prevent commits didn't pass tests to be pushed to remote | |
xcodebuild -workspace ${PROJECT}.xcworkspace -scheme ${SCHEME} -config ${CONFIG} test -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=12.0' | |
xcodebuild_exit_code=$?; | |
if [ $xcodebuild_exit_code != 0 ] | |
then | |
echo >&2 "${RED}Some tests didn't pass.${NC}" | |
exit $xcodebuild_exit_code; | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment