-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
73 lines (58 loc) · 1.87 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
67
68
69
70
71
72
73
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
OS_ARCH=$(shell go env GOOS)_$(shell go env GOARCH)
HOSTNAME=registry.terraform.io
NAMESPACE=articulate
NAME=ohdear
VERSION=$(shell git describe --abbrev=0 | sed 's/^v//')
help:
@echo "+ $@"
@grep -hE '(^[a-zA-Z0-9\._-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m## /[33m/'
.PHONY: help
##
## Build
## ---------------------------------------------------------------------------
build: ## Build for current OS/Arch
@echo "+ $@"
@goreleaser build --clean --skip=validate --single-target
.PHONY: build
all: ## Build all OS/Arch
@echo "+ $@"
@goreleaser build --clean --skip=validate
.PHONY: all
install: build ## Install to global Terraform plugin directory
@echo "+ $@"
@mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
@mv dist/terraform-provider-${NAME}_${OS_ARCH}/terraform-provider-* ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
.PHONY: install
generate: ## Autogenerate docs and resources
@echo "+ $@"
@go generate ${PKG_LIST}
.PHONY: generate
##
## Development
## ---------------------------------------------------------------------------
mod: ## Make sure go.mod is up to date
@echo "+ $@"
@go mod tidy
.PHONY: mod
lint: ## Lint Go code
@echo "+ $@"
@golangci-lint run
.PHONY: lint
format: ## Try to fix lint issues
@echo "+ $@"
@golangci-lint run --fix
.PHONY: format
##
## Tests
## ---------------------------------------------------------------------------
test: ## Run tests
@echo "+ $@"
@go test ${PKG_LIST} -v $(TESTARGS) -parallel=4
.PHONY: test
testacc: ## Run acceptance tests
@echo "+ $@"
@TF_ACC=1 go test ${PKG_LIST} -v -cover $(TESTARGS) -timeout 120m
.PHONY: testacc
# Print the value of any variable as make print-VAR
print-% : ; @echo $* = $($*)