Last active
June 6, 2024 06:23
-
-
Save JonCanning/48bb00a02272c242355b2ee957687c44 to your computer and use it in GitHub Desktop.
golang continuous testing
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/bash | |
fswatch -l 1 -o ./**/*.go --event=Updated | while read -r; do | |
clear | |
output=$(go test ./... 2>&1) | |
if echo "$output" | grep -- '- FAIL' > /dev/null; then | |
echo -e "\e[31m$(echo "$output" | awk '/--- FAIL/,/Test:/')\e[0m" | |
elif [ -z "$output" ]; then | |
echo -e "\e[31mBUILD FAILED\e[0m" | |
else | |
echo -e "\e[32mPASS\e[0m" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment