forked from rancher/terraform-provider-rke
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile
98 lines (67 loc) · 4.02 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
TEST?=./...
VETARGS?=-all
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
CURRENT_VERSION = $(shell gobump show -r rke/)
BUILD_LDFLAGS = "-s -w \
-X github.com/yamamoto-febc/terraform-provider-rke/rke.Revision=`git rev-parse --short HEAD`"
export GO111MODULE=on
default: test build
.PHONY: tools
tools:
GO111MODULE=off go get -u github.com/motemen/gobump/cmd/gobump
GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports
clean:
rm -Rf $(CURDIR)/bin/*
build: clean
OS="`go env GOOS`" ARCH="`go env GOARCH`" ARCHIVE= BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
build-x: build-darwin build-windows build-linux build-bsd shasum
build-darwin: bin/terraform-provider-rke_$(CURRENT_VERSION)_darwin-386.zip bin/terraform-provider-rke_$(CURRENT_VERSION)_darwin-amd64.zip
build-windows: bin/terraform-provider-rke_$(CURRENT_VERSION)_windows-386.zip bin/terraform-provider-rke_$(CURRENT_VERSION)_windows-amd64.zip
build-linux: bin/terraform-provider-rke_$(CURRENT_VERSION)_linux-386.zip bin/terraform-provider-rke_$(CURRENT_VERSION)_linux-amd64.zip bin/terraform-provider-rke_$(CURRENT_VERSION)_linux-arm.zip
build-bsd: bin/terraform-provider-rke_$(CURRENT_VERSION)_openbsd-386.zip bin/terraform-provider-rke_$(CURRENT_VERSION)_openbsd-amd64.zip bin/terraform-provider-rke_$(CURRENT_VERSION)_openbsd-arm.zip
bin/terraform-provider-rke_$(CURRENT_VERSION)_darwin-386.zip:
OS="darwin" ARCH="386" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_darwin-amd64.zip:
OS="darwin" ARCH="amd64" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_windows-386.zip:
OS="windows" ARCH="386" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_windows-amd64.zip:
OS="windows" ARCH="amd64" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_linux-386.zip:
OS="linux" ARCH="386" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_linux-amd64.zip:
OS="linux" ARCH="amd64" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_linux-arm.zip:
OS="linux" ARCH="arm" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_openbsd-386.zip:
OS="openbsd" ARCH="386" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_openbsd-amd64.zip:
OS="openbsd" ARCH="amd64" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
bin/terraform-provider-rke_$(CURRENT_VERSION)_openbsd-arm.zip:
OS="openbsd" ARCH="arm" ARCHIVE=1 BUILD_LDFLAGS=$(BUILD_LDFLAGS) CURRENT_VERSION=$(CURRENT_VERSION) sh -c "'$(CURDIR)/scripts/build.sh'"
shasum:
(cd bin/; shasum -a 256 * > terraform-provider-rke_$(CURRENT_VERSION)_SHA256SUMS)
test: fmt
TF_ACC= go test $(TEST) -v $(TESTARGS) -timeout=30s -parallel=4 ; \
testacc:
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 240m ; \
.PHONY: lint
lint: fmt
gometalinter --config=gometalinter.json ./...
@echo
fmt:
gofmt -w $(GOFMT_FILES)
docker-build: clean
sh -c "'$(CURDIR)/scripts/build_on_docker.sh' 'build-x'"
.PHONY: default test testacc fmt fmtcheck
.PHONY: bump-patch bump-minor bump-major version
bump-patch:
gobump patch -w rke
bump-minor:
gobump minor -w rke
bump-major:
gobump major -w rke
version:
gobump show -r rke
git-tag:
git tag v`gobump show -r rke`