generated from mythrnr/template-lib-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (72 loc) · 1.71 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ifndef VERBOSE
MAKEFLAGS += --silent
endif
pkg ?= ./...
pwd = $(shell pwd)
.PHONY: clean
clean:
rm -rf .cache/*
.PHONY: fmt
fmt:
go fmt $(pkg)
.PHONY: lint
lint:
docker pull golangci/golangci-lint:latest > /dev/null \
&& mkdir -p .cache/golangci-lint .cache/go-build \
&& docker run --rm \
-v $(pwd):/app \
-v $(pwd)/.cache:/root/.cache \
-w /app \
golangci/golangci-lint:latest golangci-lint run $(pkg)
.PHONY: mock
mock:
docker pull vektra/mockery:latest > /dev/null
docker run --rm \
-v $(pwd):/src \
-w /src vektra/mockery \
--case=underscore \
--dir=/usr/local/go/src/net/http \
--name=RoundTripper \
--output=internal/mocks
docker run --rm \
-v $(pwd):/src \
-w /src vektra/mockery \
--case=underscore \
--dir=/usr/local/go/src/io \
--name=ReadCloser \
--output=internal/mocks
docker run --rm \
-v $(pwd):/src \
-w /src vektra/mockery \
--case=underscore \
--dir=/usr/local/go/src/encoding/json \
--name=Marshaler \
--output=internal/mocks
.PHONY: nancy
nancy:
docker pull sonatypecommunity/nancy:latest > /dev/null \
&& go list -buildvcs=false -deps -json $(pkg) \
| docker run --rm -i sonatypecommunity/nancy:latest sleuth
.PHONY: spell-check
spell-check:
docker pull ghcr.io/streetsidesoftware/cspell:latest > /dev/null \
&& docker run --rm \
-v $(pwd):/workdir \
ghcr.io/streetsidesoftware/cspell:latest \
--config /workdir/.vscode/cspell.json "**"
.PHONY: release
release:
if [ "$(version)" = "" ]; then \
echo "version is required."; \
exit 1; \
fi \
&& gh release create $(version) --generate-notes --target master
.PHONY: test
test:
go test -cover $(pkg)
.PHONY: test-json
test-json:
go test -cover -json $(pkg)
.PHONY: tidy
tidy:
go mod tidy