-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
66 lines (47 loc) · 1.67 KB
/
Makefile
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
TEST?=$$(go list ./... | grep -v 'vendor')
HOSTNAME=registry.terraform.io
NAMESPACE=canonical
NAME=maas
PROVIDER_NAME=terraform-provider-${NAME}
BINARY=terraform-provider-${NAME}
VERSION=1.0.1
OS?=$$(go env GOOS)
ARCH?=$$(go env GOARCH)
TEST_PARALLELISM?=4
default: install
BIN=$(CURDIR)/bin
$(BIN)/%:
@echo "Installing tools from tools/tools.go"
@cat tools/tools.go | grep _ | awk -F '"' '{print $$2}' | GOBIN=$(BIN) xargs -tI {} go install {}
.PHONY: build install clean clean_install test testacc generate_docs validate_docs tfproviderlintx tfproviderlint
build:
mkdir -p $(BIN)
go build -o $(BIN)/${BINARY}
create_dev_overrides: build
@sh -c "'$(CURDIR)/scripts/generate-dev-overrides.sh'"
install: build
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS}_${ARCH}
mv $(BIN)/${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS}_${ARCH}
clean:
rm -rf $(BIN)
clean_install: clean
rm -rf ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}
.PHONY: lint
lint: lint-go lint-tf
.PHONY: lint-go
lint-go:
@test -z "$$(gofmt -l -s -d . | tee /dev/stderr)"
.PHONY: lint-tf
lint-tf: tfproviderlint tfproviderlintx
test:
go test $(TEST) -v $(TESTARGS) -timeout=5m -parallel=$(TEST_PARALLELISM)
testacc:
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m -parallel=$(TEST_PARALLELISM)
generate_docs: $(BIN)/tfplugindocs
$(BIN)/tfplugindocs generate --provider-name $(PROVIDER_NAME)
validate_docs: $(BIN)/tfplugindocs
$(BIN)/tfplugindocs validate
tfproviderlintx: $(BIN)/tfproviderlintx
$(BIN)/tfproviderlintx $(TFPROVIDERLINT_ARGS) ./...
tfproviderlint: $(BIN)/tfproviderlint
$(BIN)/tfproviderlint $(TFPROVIDERLINT_ARGS) ./...