]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - GNUmakefile
Merge pull request #23 from terraform-providers/go1.11-upgrade-2019-01-07
[github/fretlink/terraform-provider-statuscake.git] / GNUmakefile
1 TEST?=$$(go list ./... |grep -v 'vendor')
2 GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
3 WEBSITE_REPO=github.com/hashicorp/terraform-website
4 PKG_NAME=statuscake
5
6 default: build
7
8 build: fmtcheck
9 go install
10
11 test: fmtcheck
12 go test -i $(TEST) || exit 1
13 echo $(TEST) | \
14 xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
15
16 testacc: fmtcheck
17 TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
18
19 vet:
20 @echo "go vet ."
21 @go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \
22 echo ""; \
23 echo "Vet found suspicious constructs. Please check the reported constructs"; \
24 echo "and fix them if necessary before submitting the code for review."; \
25 exit 1; \
26 fi
27
28 fmt:
29 gofmt -w $(GOFMT_FILES)
30
31 fmtcheck:
32 @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
33
34 errcheck:
35 @sh -c "'$(CURDIR)/scripts/errcheck.sh'"
36
37 vendor-status:
38 @govendor status
39
40 test-compile:
41 @if [ "$(TEST)" = "./..." ]; then \
42 echo "ERROR: Set TEST to a specific package. For example,"; \
43 echo " make test-compile TEST=./$(PKG_NAME)"; \
44 exit 1; \
45 fi
46 go test -c $(TEST) $(TESTARGS)
47
48 website:
49 ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
50 echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
51 git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
52 endif
53 @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
54
55 website-test:
56 ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
57 echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
58 git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
59 endif
60 @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
61
62 .PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test
63