-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (77 loc) · 2.01 KB
/
Copy pathMakefile
File metadata and controls
91 lines (77 loc) · 2.01 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
82
83
84
85
86
87
88
89
90
91
PACKAGE ?= ./internal/...
.PHONY: all
all: build
.PHONY: generate
generate:
scripts/generate.sh
.PHONY: prepare
prepare: generate
go mod tidy
go fmt $(PACKAGE)
go vet $(PACKAGE)
docker run \
--tty \
--rm \
--volume ${PWD}:/app \
--workdir /app \
--user $$(id -u):$$(id -g) \
--volume $$(go env GOCACHE):/.cache/go-build \
--env GOCACHE=/.cache/go-build \
--volume $$(go env GOMODCACHE):/.cache/mod \
--env GOMODCACHE=/.cache/mod \
--volume ~/.cache/golangci-lint:/.cache/golangci-lint \
--env GOLANGCI_LINT_CACHE=/.cache/golangci-lint \
golangci/golangci-lint:v2.12.2 \
golangci-lint run --fix $(PACKAGE)
.PHONY: build-examples
build-examples: prepare
$(MAKE) -C examples build
.PHONY: build
build: build-examples
go build ./cmd/golr
.PHONY: run
run: prepare
go run ./cmd/golr
.PHONY: test
test: test-examples
go test --race $(PACKAGE)
.PHONY: test-coverage
test-coverage: test-examples
mkdir -p tmp
rm -rf tmp/coverage
mkdir -p tmp/coverage
go test --race -coverpkg=./... -cover $(PACKAGE) -args -test.gocoverdir=$(CURDIR)/tmp/coverage
@echo
@echo "========== Correct coverage over all packages =========="
go tool covdata percent -i=tmp/coverage
go tool covdata textfmt -i=tmp/coverage -o tmp/cover.out
go tool cover -html=tmp/cover.out -o tmp/cover.html
.PHONY: test-examples
test-examples: prepare
$(MAKE) -C examples test
.PHONY: benchmark
benchmark: prepare
go test -bench=. -benchmem -run=^$$ $(PACKAGE)
.PHONY: clean
clean:
$(MAKE) -C examples clean
rm -rf tmp
rm -f golr
.PHONY: release-test
release-test:
goreleaser check
goreleaser healthcheck
goreleaser build --snapshot --clean
goreleaser release --snapshot --clean --skip=publish
.PHONY: release-notes
release-notes:
mkdir -p tmp
scripts/release-notes.sh > tmp/release-notes.md
@echo
@echo "========== Release notes =========="
@cat tmp/release-notes.md
.PHONY: release
release: release-test release-notes
release: export GITHUB_TOKEN ?= unknown
release:
goreleaser release --clean --release-notes tmp/release-notes.md