-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (56 loc) · 1.44 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?=./...
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
HOSTNAME=registry.terraform.io
NAMESPACE?=streamnative
PKG_NAME=streamnative
BINARY=terraform-provider-${PKG_NAME}
VERSION?=0.1.0
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
OS_ARCH := ${OS}_${ARCH}
default: build
build: fmtcheck
go build -o ${BINARY}
build-dev: build
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${PKG_NAME}/${VERSION}/${OS_ARCH}
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${PKG_NAME}/${VERSION}/${OS_ARCH}
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v -count 1 $(TESTARGS) -timeout 120m
fmt:
@echo "==> Fixing source code with gofmt..."
@gofmt -s -w cloud
# Currently required by tf-deploy compile
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
lint:
@echo "==> Checking source code against linters..."
@golangci-lint run -c .golangci.yaml ./...
@tfproviderlint \
-c 1 \
-AT001 \
-AT002 \
-S001 \
-S002 \
-S003 \
-S004 \
-S005 \
-S007 \
-S008 \
-S009 \
-S010 \
-S011 \
-S012 \
-S013 \
-S014 \
-S015 \
-S016 \
-S017 \
-S019 \
./cloud
tools:
go install github.com/bflad/tfproviderlint/cmd/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]
go install github.com/hashicorp/terraform-plugin-docs/cmd/[email protected]
docs:
tfplugindocs
.PHONY: build tools docs fmt fmtcheck lint testacc