github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/Makefile (about) 1 TEST?=$$(go list ./... | grep -v '/terraform/vendor/' | grep -v '/builtin/bins/') 2 GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) 3 4 default: test vet 5 6 tools: 7 go get -u github.com/kardianos/govendor 8 go get -u golang.org/x/tools/cmd/stringer 9 go get -u golang.org/x/tools/cmd/cover 10 11 # bin generates the releaseable binaries for Terraform 12 bin: fmtcheck generate 13 @TF_RELEASE=1 sh -c "'$(CURDIR)/scripts/build.sh'" 14 15 # dev creates binaries for testing Terraform locally. These are put 16 # into ./bin/ as well as $GOPATH/bin 17 dev: fmtcheck generate 18 @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" 19 20 quickdev: generate 21 @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" 22 23 # Shorthand for building and installing just one plugin for local testing. 24 # Run as (for example): make plugin-dev PLUGIN=provider-aws 25 plugin-dev: generate 26 go install github.com/hashicorp/terraform/builtin/bins/$(PLUGIN) 27 mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN) 28 29 # test runs the unit tests 30 test: fmtcheck generate 31 go test -i $(TEST) || exit 1 32 echo $(TEST) | \ 33 xargs -t -n4 go test $(TESTARGS) -timeout=60s -parallel=4 34 35 # testacc runs acceptance tests 36 testacc: fmtcheck generate 37 @if [ "$(TEST)" = "./..." ]; then \ 38 echo "ERROR: Set TEST to a specific package. For example,"; \ 39 echo " make testacc TEST=./builtin/providers/aws"; \ 40 exit 1; \ 41 fi 42 TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m 43 44 test-compile: fmtcheck generate 45 @if [ "$(TEST)" = "./..." ]; then \ 46 echo "ERROR: Set TEST to a specific package. For example,"; \ 47 echo " make test-compile TEST=./builtin/providers/aws"; \ 48 exit 1; \ 49 fi 50 go test -c $(TEST) $(TESTARGS) 51 52 # testrace runs the race checker 53 testrace: fmtcheck generate 54 TF_ACC= go test -race $(TEST) $(TESTARGS) 55 56 cover: 57 @go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \ 58 go get -u golang.org/x/tools/cmd/cover; \ 59 fi 60 go test $(TEST) -coverprofile=coverage.out 61 go tool cover -html=coverage.out 62 rm coverage.out 63 64 # vet runs the Go source code static analysis tool `vet` to find 65 # any common errors. 66 vet: 67 @echo 'go vet $$(go list ./... | grep -v /terraform/vendor/)' 68 @go vet $$(go list ./... | grep -v /terraform/vendor/) ; if [ $$? -eq 1 ]; then \ 69 echo ""; \ 70 echo "Vet found suspicious constructs. Please check the reported constructs"; \ 71 echo "and fix them if necessary before submitting the code for review."; \ 72 exit 1; \ 73 fi 74 75 # generate runs `go generate` to build the dynamically generated 76 # source files. 77 generate: 78 @which stringer > /dev/null; if [ $$? -ne 0 ]; then \ 79 go get -u golang.org/x/tools/cmd/stringer; \ 80 fi 81 go generate $$(go list ./... | grep -v /terraform/vendor/) 82 @go fmt command/internal_plugin_list.go > /dev/null 83 84 fmt: 85 gofmt -w $(GOFMT_FILES) 86 87 fmtcheck: 88 @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" 89 90 vendor-status: 91 @govendor status 92 93 # disallow any parallelism (-j) for Make. This is necessary since some 94 # commands during the build process create temporary files that collide 95 # under parallel conditions. 96 .NOTPARALLEL: 97 98 .PHONY: bin cover default dev fmt fmtcheck generate plugin-dev quickdev test-compile test testacc testrace tools vendor-status vet