-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (63 loc) · 1.86 KB
/
Makefile
File metadata and controls
81 lines (63 loc) · 1.86 KB
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
SHELL := /bin/bash
.DEFAULT_GOAL := all
# renovate: datasource=docker depName=ghcr.io/igorshubovych/markdownlint-cli versioning=docker
MARKDOWNLINT_VERSION = sha256:c97f19b52cf7371ff767c080e3e15c15f1cbd3336fc41aeca7a93bb2cdb9843c # v0.48.0
.PHONY: all
all: ## build pipeline
all: mdlint mod gen build spell lint test
.PHONY: precommit
precommit: ## validate the branch before commit
precommit: all vuln
.PHONY: ci
ci: ## CI build pipeline
ci: precommit diff
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: mdlint
mdlint: ## markdownlint
ifneq ($(filter 1 true,$(SKIP_DOCKER)),)
@echo "Skipping $(@) per SKIP_DOCKER=$(SKIP_DOCKER)"
else
docker run --rm -v "$(PWD):/workdir" ghcr.io/igorshubovych/markdownlint-cli@$(MARKDOWNLINT_VERSION) "**/*.md"
endif
.PHONY: clean
clean: ## remove files created during build pipeline
rm -rf dist
rm -f coverage.*
rm -f '"$(shell go env GOCACHE)/../golangci-lint"'
go clean -i -cache -testcache -modcache -fuzzcache -x
.PHONY: run
run: ## go run
go run .
.PHONY: mod
mod: ## go mod tidy
go mod tidy
.PHONY: gen
gen: ## go generate
go generate ./...
.PHONY: build
build: ## goreleaser build
go tool goreleaser build --clean --single-target --snapshot
.PHONY: spell
spell: ## misspell
go tool misspell -error -locale=US -w **.md
.PHONY: lint
lint: ## golangci-lint
go tool golangci-lint run --fix
.PHONY: vuln
vuln: ## govulncheck
go tool govulncheck ./...
ifeq ($(CGO_ENABLED),0)
RACE_OPT =
else
RACE_OPT = -race
endif
.PHONY: test
test: ## go test
go test $(RACE_OPT) -covermode=atomic -coverprofile=coverage.out -coverpkg=./... ./...
go tool cover -html=coverage.out -o coverage.html
.PHONY: diff
diff: ## git diff
git diff --exit-code
RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi