-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (60 loc) · 2.14 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
# define executable
EXECUTABLE=uArt
# source dir
SRC_DIR=./cmd/app
# flags for compilation
BUILD_FLAGS=
# domain dirs in internal/pkg
DOMAINS=applicant cvs employer portfolio session vacancies file_loading
MICROSERVICE_DOMAINS = notifications
.PHONY: mock-gen api
all: install build
build:
go build $(BUILD_FLAGS) -o $(EXECUTABLE) $(SRC_DIR)
install:
go mod tidy
tests:
go test ./... -coverprofile=coverage.out.tmp
cat coverage.out.tmp | grep -v -E 'docs|mock|pb.go|_easyjson.go' > coverage.out
go tool cover -func=coverage.out
go tool cover -html=coverage.out -o index.html
clean:
go clean
lint:
revive -config reviveconfig.toml -formatter friendly ./...
api:
swag init --generalInfo ./cmd/app/main.go --output api/ --pd
node ./api/server.js
mock-gen:
@echo "Generating mocks..."
@for domain in $(DOMAINS); do \
echo "Generating mocks for domain: $$domain"; \
rm -rf internal/pkg/$$domain/mock; \
mockgen -source=internal/pkg/$$domain/$$domain.go \
-destination=internal/pkg/$$domain/mock/$$domain.go \
-package=mock; \
done
@for domain in $(MICROSERVICE_DOMAINS); do \
echo "Generating mocks for domain: $$domain"; \
rm -rf microservice/$$domain/mock; \
mockgen -source=microservices/$$domain/$$domain/$$domain.go \
-destination=microservices/$$domain/$$domain/mock/$$domain.go \
-package=mock; \
done
@echo "Generating mocks for auth microservice"
@rm -rf microservices/auth/mock
@mockgen -source=microservices/auth/gen/auth_grpc.pb.go -destination=microservices/auth/mock/mock_grpc.go -package=mock
@mockgen -source=microservices/auth/auth.go -destination=microservices/auth/mock/mock_delivery.go -package=mock
@echo "Generating gRPC mocks for notifications microservice"
@rm -rf microservices/notifications/mock
@mockgen -source=microservices/notifications/generated/notifications_grpc.pb.go -destination=microservices/notifications/mock/mock_grpc.go -package=mock
@echo "OK!"
redis-start:
redis-server .\configs\redis.conf
auth-microservice:
go run ./cmd/auth/main.go
run:
go run $(SRC_DIR)/main.go
easyjson-gen:
easyjson -all ./internal/pkg/dto
easyjson -all ./microservices/notifications/notifications/dto