-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
48 lines (39 loc) · 1.43 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
VERSION ?= 0.0.0-dev
.PHONY: lint
lint: golangci-lint ## Run golang-ci-lint against code.
$(GOLANGCI_LINT) run ./...
## Location to create the release
RELEASE_DIR ?= $(shell pwd)/release
$(RELEASE_DIR):
mkdir -p $(RELEASE_DIR)
.PHONY: release
release: gox gomplate $(RELEASE_DIR) ## Run release artifacts
CGO_ENABLED=0 $(GOX) -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -os="linux darwin windows" -arch="amd64 arm64"
VERSION=$(VERSION) $(GOMPLATE) -f hack/provider.yaml.tpl > $(RELEASE_DIR)/provider.yaml
mv dist/* $(RELEASE_DIR)
rm -rf dist/
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
## Tool Binaries
GOX ?= $(LOCALBIN)/gox
GOMPLATE ?= $(LOCALBIN)/gomplate
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
## Tool Versions
GOX_VERSION ?= latest
GOMPLATE_VERSION ?= v3.11.5
GOLANGCI_LINT_VERSION ?= v1.52.2
.PHONY: gox
gox: $(GOX)
$(GOX): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install github.com/mitchellh/gox@$(GOX_VERSION)
.PHONY: gomplate
gomplate: $(GOMPLATE)
$(GOMPLATE): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install github.com/hairyhenderson/gomplate/v3/cmd/gomplate@$(GOMPLATE_VERSION)
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(GOLANGCI_LINT)
test -s $(LOCALBIN)/golangci-lint && $(LOCALBIN)/golangci-lint version | grep -q $(GOLANGCI_LINT_VERSION) || \
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)