-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (52 loc) · 1.55 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
SHELL := /bin/bash
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: clean
clean: ## remove files created during build pipeline
$(call print-target)
rm -rf dist
rm -f coverage.*
rm -f '"$(shell go env GOCACHE)/../golangci-lint"'
go clean -i -cache -testcache -modcache -fuzzcache -x
.PHONY: mod
mod: ## go mod tidy
$(call print-target)
go mod tidy
cd tools && go mod tidy
.PHONY: inst
inst: ## go install tools
$(call print-target)
cd tools && go install $(shell cd tools && go list -f '{{ join .Imports " " }}' -tags=tools)
.PHONY: gen
gen: ## go generate
$(call print-target)
go generate ./...
LDFLAGS="-X main.version=$(shell git describe --tags --always --dirty)"
.PHONY: build
build: ## goreleaser build - no docker image, single target for local testing.
build:
$(call print-target)
goreleaser build --clean --single-target --snapshot
.PHONY: release
release: ## goreleaser release - build multi-arch, wrap in docker image.
release:
$(call print-target)
goreleaser release --clean --snapshot
.PHONY: lint
lint: ## golangci-lint
$(call print-target)
golangci-lint run
.PHONY: fix
fix: ## golangci-lint
$(call print-target)
golangci-lint run --fix
.PHONY: test
test: ## go test
$(call print-target)
go test -race -covermode=atomic -coverprofile=coverage.out -coverpkg=./... ./...
go tool cover -html=coverage.out -o coverage.html
define print-target
@printf "Executing target: \033[36m$@\033[0m\n"
endef