This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
54 lines (40 loc) · 1.52 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
COMMIT := $(shell git describe --tags --always --dirty)
VERSION := dev
OS_ARCH :=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
BIN := terraform-provider-bunny
INSTALLDIR := "$(HOME)/.terraform.d/plugins/local/simplesurance/bunny/"
LDFLAGS := "-X github.com/simplesurance/terraform-provider-bunny/internal/provider.Version=$(VERSION) -X github.com/simplesurance/terraform-provider-bunny/internal/provider.Commit=$(COMMIT)"
BUILDFLAGS := -trimpath -ldflags=$(LDFLAGS)
TFTRC_FILENAME := bunny-dev.tftrc
SWEEPERS := pullzones
REPO_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
default: build
.PHONY: build
build:
$(info * compiling $(BIN))
go build $(BUILDFLAGS) -o $(BIN)
.PHONY: check
check:
$(info * running golangci-lint code checks)
golangci-lint run
.PHONY: install
install:
$(info * installing provider to $(INSTALLDIR)/$(BIN))
GOBIN=$(INSTALLDIR) go install $(BUILDFLAGS)
.PHONY: gen-dev-tftrc
gen-dev-tftrc:
$(info * generating $(TFTRC_FILENAME))
@scripts/gen-dev-tftrc.sh "$(INSTALLDIR)" > $(TFTRC_FILENAME)
$(info run 'export TF_CLI_CONFIG_FILE=$(REPO_ROOT)/$(TFTRC_FILENAME)' to use it)
# Run acceptance tests
.PHONY: testacc
testacc:
TF_ACC=1 go test $(BUILDFLAGS) -race -v $(TESTARGS) -timeout 120m ./...
.PHONY: docs
docs:
$(info * generating documentation files (docs/))
go generate $(BUILDFLAGS)
.PHONY: sweep
sweep:
$(warning WARNING: This will destroy infrastructure. Use only in development accounts.)
cd internal/provider && TF_ACC=1 go test -v -sweep=all -sweep-run=$(SWEEPERS) -timeout=5m ./...