-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
61 lines (46 loc) · 1.5 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
GO ?= go
DIST_DIR := dist
TOOLS_BIN_DIR := $(CURDIR)/hack/tools/bin
$(shell mkdir -p $(TOOLS_BIN_DIR))
GORELEASER := $(TOOLS_BIN_DIR)/goreleaser
GORELEASER_VERSION ?= v1.10.3
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.49.0
VALIDATE_KREW_MAIFEST := $(TOOLS_BIN_DIR)/validate-krew-manifest
VALIDATE_KREW_MAIFEST_VERSION ?= v0.4.3
$(GORELEASER):
GOBIN=$(TOOLS_BIN_DIR) $(GO) install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION)
$(GOLANGCI_LINT):
GOBIN=$(TOOLS_BIN_DIR) $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
$(VALIDATE_KREW_MAIFEST):
GOBIN=$(TOOLS_BIN_DIR) $(GO) install sigs.k8s.io/krew/cmd/validate-krew-manifest@$(VALIDATE_KREW_MAIFEST_VERSION)
.PHONY: build
build: $(GORELEASER)
$(GORELEASER) build --snapshot --rm-dist --single-target --output $(DIST_DIR)/ksort
.PHONY: build-cross
build-cross: $(GORELEASER)
$(GORELEASER) build --snapshot --rm-dist
.PHONY: vet
vet:
$(GO) vet ./...
.PHONY: fmt
fmt:
$(GO) fmt ./...
.PHONY: lint
lint: $(GOLANGCI_LINT) vet fmt
$(GOLANGCI_LINT) run
.PHONY: test
test:
$(GO) test -v ./...
.PHONY: validate-krew-manifest
validate-krew-manifest: $(VALIDATE_KREW_MAIFEST)
$(VALIDATE_KREW_MAIFEST) -manifest dist/sort-manifests.yaml -skip-install
.PHONY: dist
dist: $(GORELEASER)
$(GORELEASER) release --rm-dist --skip-publish --snapshot
.PHONY: release
release: $(GORELEASER)
$(GORELEASER) release --rm-dist --skip-publish
.PHONY: clean
clean:
rm -rf $(DIST_DIR) $(TOOLS_BIN_DIR)