-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (60 loc) · 1.55 KB
/
Makefile
File metadata and controls
77 lines (60 loc) · 1.55 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
BUILD_DIR ?= ./dist
GOLANGCI_LINT_CONFIG_URL ?= https://raw.githubusercontent.com/maratori/golangci-lint-config/refs/heads/main/.golangci.yml
.PHONY: ensure-build-dir
ensure-build-dir:
mkdir -p $(BUILD_DIR)
.PHONY: pre-commit
pre-commit: build-multi lint check-deps verify-test-coverage
.PHONY: check
check: build-multi fmt lint check-deps verify-test-coverage
.PHONY: install-deps
install-deps:
go mod download
.PHONY: update-lint-config
update-lint-config:
@tmp=$$(mktemp); \
if curl -fsSL $(GOLANGCI_LINT_CONFIG_URL) -o "$$tmp"; then \
mv "$$tmp" .golangci.yaml && \
sed -i '' "s|github.com/my/project|github.com/hu553in/dockguard|g" .golangci.yaml; \
else \
rm -f "$$tmp"; \
exit 1; \
fi
.PHONY: fmt
fmt:
golangci-lint fmt
.PHONY: lint
lint:
golangci-lint run
.PHONY: check-deps
check-deps: install-deps
go tool govulncheck ./...
.PHONY: test
test: ensure-build-dir install-deps
go test \
-race \
-coverprofile="$(BUILD_DIR)/coverage.out" \
-covermode=atomic \
-coverpkg=./... \
./...
.PHONY: verify-test-coverage
verify-test-coverage: test
go run github.com/vladopajic/go-test-coverage/v2@latest --config=./.testcoverage.yml
.PHONY: build
build: install-deps
goreleaser build --single-target --snapshot --clean
.PHONY: build-multi
build-multi: install-deps
goreleaser build --snapshot --clean
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)
.PHONY: release-patch
release-patch: check
npx release-it patch
.PHONY: release-minor
release-minor: check
npx release-it minor
.PHONY: release-major
release-major: check
npx release-it major