-
Notifications
You must be signed in to change notification settings - Fork 30
/
GNUmakefile
115 lines (92 loc) · 3.2 KB
/
GNUmakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
TEST?=./...
GOFMT_FILES?=$(shell find . -name '*.go')
PKG_NAME=outscale
TEST?=./...
VERSION=$(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
WEBSITE_REPO=github.com/hashicorp/terraform-website
.PHONY: default
default: build
.PHONY: build
build: fmtcheck
go build -ldflags "-X github.com/outscale/terraform-provider-outscale/version.version=${VERSION}"
.PHONY: fmtcheck
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
.PHONY: vet
vet: fmtcheck
go vet $(TEST)
.PHONY: test
test: fmtcheck vet
go test $(TEST) -count 1 -timeout=30s -parallel=4
.PHONY: testacc
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -count 1 -v -parallel 4 $(TESTARGS) -timeout 240m -cover
.PHONY: test-net
test-net: fmtcheck
TF_ACC=1 go test $(TEST) -run=TestAccNet -count 1 -v -parallel 1 $(TESTARGS) -timeout 240m -cover
.PHONY: test-vm
test-vm: fmtcheck
TF_ACC=1 go test $(TEST) -run=TestAccVM -count 1 -v -parallel 6 $(TESTARGS) -timeout 240m -cover
.PHONY: test-others
test-others: fmtcheck test-gen-cert
TF_ACC=1 go test $(TEST) -run=TestAccOthers -count 1 -v -parallel 6 $(TESTARGS) -timeout 240m -cover
.PHONY: fmt
fmt:
gofmt -s -w ./utils/
gofmt -s -w ./main.go
gofmt -s -w ./$(PKG_NAME)
.PHONY: lint
lint:
@GOGC=30 golangci-lint run ./$(PKG_NAME) --deadline=30m
.PHONY: tools
tools:
GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
.PHONY: test-compile
test-compile:
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make test-compile TEST=./$(PKG_NAME)"; \
exit 1; \
fi
go test -c $(TEST) $(TESTARGS)
.PHONY: test-locally
test-locally:
"$(CURDIR)/scripts/local-test.sh" TestAccOthers_Volume_io1Type
"$(CURDIR)/scripts/local-test.sh" TestAccVM_withFlexibleGpuLink_basic
.PHONY: terraform-examples
terraform-examples:
@sh -c "'$(CURDIR)/scripts/terraform-examples.sh'"
.PHONY: tofu-examples
tofu-examples:
@sh -c "'$(CURDIR)/scripts/tofu-examples.sh'"
.PHONY: test-integration
test-integration: test-gen-cert
@sh -c "'$(CURDIR)/scripts/integration.sh'"
.PHONY: test-gen-cert
test-gen-cert:
@sh -c "'$(CURDIR)/scripts/generate-certificate.sh'"
.PHONY: website
website:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
endif
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
.PHONY: website-local
website-local:
@sh -c "'$(CURDIR)/scripts/test-doc.sh'"
.PHONY: website-lint
website-lint:
@misspell -error -source=text website/
.PHONY: website-test
website-test:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
endif
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
.PHONY: doc
doc:
@sh -c "'$(CURDIR)/scripts/generate-doc.sh'"