-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGNUmakefile
More file actions
64 lines (50 loc) · 2.16 KB
/
Copy pathGNUmakefile
File metadata and controls
64 lines (50 loc) · 2.16 KB
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
TEST?=$$(go list ./...)
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
GOOS?=$$(go env GOOS)
GOARCH?=$$(go env GOARCH)
VERSION?=$$(git describe --abbrev=0 --tags)
DEV_VERSION=2.99.0
TESTTIMEOUT=120m
WALLARM_API_HOST?=https://audit.api.wallarm.com
default: build
install: fmtcheck
@echo "Installing the provider..."
@go install terraform-provider-wallarm_$(VERSION) .
build: fmtcheck
@echo "Building a sideloaded provider..."
@go build -o terraform-provider-wallarm_$(VERSION) .
@echo "Binary has been built to $(CURDIR)"
init:
@echo "Initializing the Wallarm provider..."
@terraform init
dev: fmtcheck
@echo "Building dev provider (v$(DEV_VERSION))..."
@go build -o terraform-provider-wallarm .
@mkdir -p ~/.terraform.d/plugins/registry.terraform.io/wallarm/wallarm/$(DEV_VERSION)/$(GOOS)_$(GOARCH)
@cp terraform-provider-wallarm ~/.terraform.d/plugins/registry.terraform.io/wallarm/wallarm/$(DEV_VERSION)/$(GOOS)_$(GOARCH)/terraform-provider-wallarm_v$(DEV_VERSION)
@rm terraform-provider-wallarm
@echo "Installed to ~/.terraform.d/plugins/ (v$(DEV_VERSION)). Run 'terraform init' in your HCL project."
dev-clean:
@rm -rf ~/.terraform.d/plugins/registry.terraform.io/wallarm/wallarm/$(DEV_VERSION)
@echo "Dev provider (v$(DEV_VERSION)) removed. Run 'terraform init -upgrade' to switch to released version."
lint:
@echo "Running golangci-lint..."
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@golangci-lint run
test:
go test $(TEST) -v -timeout=30s -parallel=4 -race -cover
testacc: fmtcheck
TF_ACC=1 TF_ACC_TERRAFORM_PATH=$${TF_ACC_TERRAFORM_PATH:-$$(command -v terraform)} go test $(TEST) -v $(TESTARGS) -timeout $(TESTTIMEOUT) -race -cover -ldflags="-X=github.com/wallarm/terraform-provider-wallarm/version.ProviderVersion=acc"
vet:
@echo "go vet ."
@go vet $(TEST) ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi
fmt:
gofmt -w $(GOFMT_FILES)
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
.PHONY: install build init dev dev-clean test testacc vet fmt fmtcheck