github.com/autonomy/conform@v0.1.0-alpha.16/hack/test.sh (about) 1 #!/bin/bash 2 3 set -e 4 5 CGO_ENABLED=1 6 7 lint_packages() { 8 if [ "${lint}" = true ]; then 9 echo "linting packages" 10 curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.16.0 11 golangci-lint run --config "${BASH_SOURCE%/*}/golangci-lint.yaml" 12 fi 13 } 14 15 go_test() { 16 if [ "${short}" = true ]; then 17 echo "performing short tests" 18 go test -v -short ./... 19 fi 20 21 if [ "${tests}" = true ]; then 22 echo "performing tests" 23 go test -v -race -covermode=atomic -coverprofile=/coverage.txt ./... 24 fi 25 } 26 27 lint=false 28 short=false 29 tests=false 30 31 case $1 in 32 --lint) 33 lint=true 34 ;; 35 --short) 36 short=true 37 ;; 38 --integration) 39 tests=true 40 ;; 41 --all) 42 lint=true 43 short=true 44 tests=true 45 ;; 46 *) 47 ;; 48 esac 49 50 go_test 51 lint_packages 52 53 exit 0