-
Notifications
You must be signed in to change notification settings - Fork 13
/
GNUmakefile
50 lines (38 loc) · 1.47 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
TEST?=./...
TEST_PARALLEL?=12
TEST_TIMEOUT?=30m
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
PKG_NAME=aptible
TEST_COUNT?=1
CUR_DIR = $(shell echo "${PWD}")
TARGET=darwin_amd64
LOCAL_TARGET=darwin_$(shell uname -p)64
default: build
build: fmtcheck
go build
build_local:
TARGET=$(LOCAL_TARGET) go build
local-install: build_local
@mkdir -p "$$HOME/.terraform.d/plugins/aptible.com/aptible/aptible/0.0.0+local/$(LOCAL_TARGET)"
@# If the file isn't explicitly deleted before the copy then terraform fails to load when changes are made
@rm "$$HOME/.terraform.d/plugins/aptible.com/aptible/aptible/0.0.0+local/$(LOCAL_TARGET)/terraform-provider-aptible" || true
@cp terraform-provider-aptible "$$HOME/.terraform.d/plugins/aptible.com/aptible/aptible/0.0.0+local/$(LOCAL_TARGET)"
@echo "Installed as provider aptible.com/aptible/aptible version 0.0.0+local"
gen:
go generate ./...
test: fmtcheck
go test $(TEST) $(TESTARGS) -timeout=120s -parallel=4
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v -count $(TEST_COUNT) -parallel $(TEST_PARALLEL) -timeout $(TEST_TIMEOUT) $(TESTARGS)
fmt:
gofmt -s -w .
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
lint:
@bin/golangci-lint run ./$(PKG_NAME)/...
@tfproviderlint ./...
tools:
@go mod vendor
@go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.35.2
.PHONY: build gen test testacc fmt fmtcheck lint tools local-install