Merge pull request #11050 from spowelljr/runLint

Check if go mod tidy || make generate-docs create file changes in CI
pull/11150/head
Medya Ghazizadeh 2021-04-19 14:52:34 -07:00 committed by GitHub
commit 08fe139136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

10
test.sh
View File

@ -17,6 +17,7 @@
set -eu -o pipefail
TESTSUITE="${TESTSUITE:-all}" # if env variable not set run all the tests
CI="${CI:-false}" # if env variable not set don't run CI tests
exitcode=0
if [[ "$TESTSUITE" = "lint" ]] || [[ "$TESTSUITE" = "all" ]] || [[ "$TESTSUITE" = "lintall" ]]
@ -25,7 +26,14 @@ then
make -s lint-ci && echo ok || ((exitcode += 4))
echo "= go mod ================================================================"
go mod download 2>&1 | grep -v "go: finding" || true
go mod tidy -v && git diff --quiet && echo ok || (((exitcode += 2)) && echo ERROR: Please run go mod tidy)
if [[ "$CI" = "true" ]]
then
go mod tidy -v && git diff --quiet go.* && echo ok || (((exitcode += 2)) && echo ERROR: Please run go mod tidy)
echo "= generate docs ========================================================="
make generate-docs > /dev/null 2>&1 && git diff --quiet site && echo ok || (((exitcode += 3)) && echo ERROR: Please run make generate-docs)
else
go mod tidy -v && echo ok || ((exitcode += 2))
fi
fi