-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (49 loc) · 1.72 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
.PHONY: build run test test_with_coverage cleantest retest doc generate cover_all currcover
.PHONY: build_auth build_realtime build_messenger build_all
.PHONY: .install-linter lint lint-fast
ENTRYPOINT=cmd/app/main.go
DOC_DIR=./docs
COV_OUT=coverage.out
COV_HTML=coverage.html
CURRCOVER=github.com/go-park-mail-ru/2023_2_OND_team/internal/pkg/delivery/http/v1
PROJECT_BIN = $(CURDIR)/bin
$(shell [ -f bin ] || mkdir -p $(PROJECT_BIN))
GOLANGCI_LINT = $(PROJECT_BIN)/golangci-lint
build:
go build -o bin/app cmd/app/*.go
build_auth:
go build -o bin/auth cmd/auth/*.go
build_realtime:
go build -o bin/realtime cmd/realtime/*.go
build_messenger:
go build -o bin/messenger cmd/messenger/*.go
build_all: build build_auth build_realtime build_messenger
run: build
./bin/app
test:
go test ./... -race -covermode=atomic -coverpkg ./... -coverprofile=$(COV_OUT)
test_with_coverage: test
go tool cover -html $(COV_OUT) -o $(COV_HTML)
cleantest:
rm coverage*
retest:
make cleantest
make test
doc:
swag fmt
swag init -g $(ENTRYPOINT) --pd -o $(DOC_DIR)
generate:
go generate ./...
cover_all:
go test -coverpkg=./... -coverprofile=cover ./...
cat cover | grep -v "mock" | grep -v "easyjson" | grep -v "proto" | grep -v "ramrepo" > cover.out
go tool cover -func=cover.out
currcover:
go test -cover -v -coverprofile=cover.out ${CURRCOVER}
go tool cover -html=cover.out -o cover.html
.install-linter:
[ -f $(PROJECT_BIN)/golangci-lint ] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_BIN) v1.55.2
lint: .install-linter
$(GOLANGCI_LINT) run ./... --config=configs/.golangci.yml
lint-fast: .install-linter
$(GOLANGCI_LINT) run ./... --fast --config=configs/.golangci.yml