Created
May 17, 2018 02:20
-
-
Save jimschubert/38fe5491aa0c25df9d2c8c13d327a1b6 to your computer and use it in GitHub Desktop.
git bisect evaluate example
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
#!/usr/bin/env bash | |
# Evaluates a report that running multiple generators results in | |
# Pet#category being of type Object/Any rather than Category | |
set -e | |
ROOT=/Users/jim/projects/openapi-generator | |
targetfile=samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt | |
echo "Building $(git rev-parse --short HEAD)." | |
mvn -B clean package install 2>&1 >/dev/null | |
if [ $? -ne 0 ]; then | |
echo "Build faiiled, can't evaluate generator usage" | |
exit 125 | |
fi | |
env LOG4J_LEVEL=FATAL sh bin/kotlin-client-petstore.sh 2>&1 >/dev/null | |
if [ $? -ne 0 ]; then | |
echo "Generator failed, can't evaluate if it outputs incorrect code." | |
exit 125 | |
fi | |
if [ -z "$(cat ${targetfile} | grep 'val category' | grep 'Category')" ]; then | |
osascript -e "display notification \"$(git rev-parse --short HEAD)\" with title \"Bad commit\"" | |
echo "Missing expected object type" | |
exit 1 | |
else | |
osascript -e "display notification \"$(git rev-parse --short HEAD)\" with title \"Good commit\"" | |
echo "Code is fine" | |
exit 0 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment