forked from pagu-project/pagu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (46 loc) · 1.36 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
PACKAGES=$(shell go list ./... | grep -v 'tests')
### Testing
unit_test:
go test $(PACKAGES)
test:
go test ./... -covermode=atomic
race_test:
go test ./... --race
### dev tools
devtools:
@echo "Installing devtools"
go install golang.org/x/tools/cmd/goimports@latest
go install mvdan.cc/gofumpt@latest
go install github.com/golangci/golangci-lint/cmd/[email protected]
go install go.uber.org/mock/mockgen@latest
go install github.com/bufbuild/buf/cmd/buf@latest
### mock
mock:
mockgen -source=./client/interface.go -destination=./client/mock.go -package=client
mockgen -source=./wallet/interface.go -destination=./wallet/mock.go -package=wallet
### proto file generate
proto:
rm -rf grpc/gen/go
cd grpc/buf && buf generate --template buf.gen.yaml ../proto
### Formatting, linting, and vetting
fmt:
gofumpt -l -w .
go mod tidy
check:
golangci-lint run --timeout=20m0s
### building
build: build-cli build-discord build-grpc build-telegram build-http
build-cli:
go build -o build/pagu-cli ./cmd/cli
build-discord:
go build -o build/pagu-discord ./cmd/discord
build-grpc:
go build -o build/pagu-grpc ./cmd/grpc
build-telegram:
go build -o build/pagu-telegram ./cmd/telegram
build-http:
go build -o build/pagu-http ./cmd/http
### pre commit
pre-commit: mock proto fmt check unit_test
@echo pre commit commands...
.PHONY: build