Skip to content

Commit

Permalink
Merge pull request quarkusio#114 from frobware/add-verify-target
Browse files Browse the repository at this point in the history
build: Add verify target
  • Loading branch information
openshift-merge-robot authored Apr 17, 2020
2 parents bdf9cc9 + 3856d77 commit c6b904a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ images/router/*/Dockerfile.rhel: images/router/base/Dockerfile.rhel

check:
$(GO) test -race ./...

.PHONY: verify
verify:
hack/verify-gofmt.sh
hack/verify-deps.sh
17 changes: 17 additions & 0 deletions hack/verify-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail

function print_failure {
echo "There are unexpected changes to the vendor tree following 'go mod vendor' and 'go mod tidy'. Please"
echo "run these commands locally and double-check the Git repository for unexpected changes which may"
echo "need to be committed."
exit 1
}

if [ "${OPENSHIFT_CI:-false}" = true ]; then
go mod vendor
go mod tidy

test -z "$(git status --porcelain)" || print_failure
echo "verified Go modules"
fi
10 changes: 10 additions & 0 deletions hack/verify-gofmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

go_files=$( find . -name '*.go' -not -path './vendor/*' -print )
bad_files=$(gofmt -s -l ${go_files})
if [[ -n "${bad_files}" ]]; then
(>&2 echo "!!! gofmt needs to be run on the listed files")
echo "${bad_files}"
(>&2 echo "Try running 'gofmt -s -d [path]' or autocorrect with 'hack/verify-gofmt.sh | xargs -n 1 gofmt -s -w'")
exit 1
fi
2 changes: 1 addition & 1 deletion pkg/router/template/certmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func TestCertManagerConfig(t *testing.T) {
config *certificateManagerConfig
shouldPass bool
}{
"valid": {shouldPass: true, config: validCfg},
"valid": {shouldPass: true, config: validCfg},
"missing certificateKeyFunc": {shouldPass: false, config: missingCertKeyCfg},
"missing caCertificateKeyFunc": {shouldPass: false, config: missingCACertKeyCfg},
"missing destCertificateKeyFunc": {shouldPass: false, config: missingDestCertKeyCfg},
Expand Down

0 comments on commit c6b904a

Please sign in to comment.