-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (69 loc) · 2.29 KB
/
Makefile
File metadata and controls
92 lines (69 loc) · 2.29 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
92
.PHONY: proto proto-install test test-cover test-integration test-e2e bench build build-tracker build-analytics build-auth build-saga docker-build docker-up docker-down docker-logs certs clean lint lint-install
# Proto generation
PROTO_DIR := shared/proto
GEN_DIR := gen/proto
proto-install:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
proto: proto-install
mkdir -p $(GEN_DIR)/tracker/v1 $(GEN_DIR)/analytics/v1 $(GEN_DIR)/auth/v1
protoc --go_out=$(GEN_DIR)/tracker/v1 --go_opt=paths=source_relative \
--go-grpc_out=$(GEN_DIR)/tracker/v1 --go-grpc_opt=paths=source_relative \
--proto_path=$(PROTO_DIR)/tracker/v1 \
tracker.proto
protoc --go_out=$(GEN_DIR)/analytics/v1 --go_opt=paths=source_relative \
--go-grpc_out=$(GEN_DIR)/analytics/v1 --go-grpc_opt=paths=source_relative \
--proto_path=$(PROTO_DIR)/analytics/v1 \
analytics.proto
protoc --go_out=$(GEN_DIR)/auth/v1 --go_opt=paths=source_relative \
--go-grpc_out=$(GEN_DIR)/auth/v1 --go-grpc_opt=paths=source_relative \
--proto_path=$(PROTO_DIR)/auth/v1 \
auth.proto
# Testing
test:
go test ./... -v
test-cover:
go test ./... -coverprofile=coverage.out
go tool cover -func=coverage.out
bench:
go test -bench=. -benchmem ./benchmark/...
test-integration:
go test -v -tags=integration ./integration/...
test-e2e:
go test -v -tags=e2e ./e2e/...
# Build
build: build-tracker build-tracker-http build-analytics build-analytics-http build-auth build-saga
build-tracker:
go build -o bin/tracker ./services/tracker/cmd
build-analytics:
go build -o bin/analytics ./services/analytics/cmd
build-analytics-http:
go build -o bin/analytics-http ./services/analytics/cmd/http
build-tracker-http:
go build -o bin/tracker-http ./services/tracker/cmd/http
build-auth:
go build -o bin/auth ./services/auth/cmd
build-saga:
go build -o bin/saga ./services/saga/cmd
# Docker
docker-build:
docker compose build
docker-up:
docker compose up -d
docker-down:
docker compose down
docker-logs:
docker compose logs -f
# Certificates
certs:
cd gateway/certs && ./generate.sh
# Linting
lint-install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
lint:
golangci-lint run ./...
# Clean
clean:
rm -f bin/*
rm -rf gen/proto
rm -f coverage.out