diff options
author | Kevin Lyda <kevin@ie.suberic.net> | 2017-01-27 08:48:29 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-01-27 08:48:29 +0000 |
commit | 13054312850d1014e814d2f64afa030a4fea5ef3 (patch) | |
tree | c7b7ff70ef7b45aab9f95421f656e2e218465176 | |
parent | fe53f90bf0c7fab6cbf5cb019a337e02c6b3ffbf (diff) |
Move tests out of travis config to a standalone script
Can also be used as a pre-commit hook.
-rw-r--r-- | .travis.yml | 6 | ||||
-rwxr-xr-x | run_tests.sh | 16 |
2 files changed, 17 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index 441fa19..d36d907 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,8 +26,4 @@ before_script: sudo: false script: - - go install -v ./cmd/cashier ./cmd/cashierd - - go list ./... |grep -v vendor/ |xargs go test - - gofmt -d $(find -type f -name '*.go' -not -path './vendor/*') - - go list ./... |grep -v vendor/ |xargs go vet - - go list ./... |grep -v vendor/ |xargs -L1 golint -set_exit_status + - ./run_tests.sh diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 0000000..87d5cbd --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +# This can be used as a pre-commit script. Just run +# cp run_tests.sh .git/hooks/pre-commit +# and it will run before each commit. + +set -xue + +go install -v ./cmd/cashier ./cmd/cashierd +go list ./... |grep -v vendor/ |xargs go test +gofmt -d $(find * -type f -name '*.go' -not -path 'vendor/*') +go list ./... |grep -v vendor/ |xargs go vet +if ! type -f golint > /dev/null; then + go get -u github.com/golang/lint/golint +fi +go list ./... |grep -v vendor/ |xargs -L1 golint -set_exit_status |