forked from jacexh/ultron
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
58 lines (51 loc) · 1.7 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
.PHONY: proto
proto: tools
@protoc --proto_path=api/protobuf/ api/protobuf/ultron.proto \
--go_out=pkg/genproto \
--go_opt=paths=source_relative \
--go-grpc_opt=require_unimplemented_servers=false \
--go-grpc_out=pkg/genproto \
--go-grpc_opt=paths=source_relative
@protoc --proto_path=api/protobuf/ api/protobuf/statistics.proto \
--go_out=pkg/statistics \
--go_opt=paths=source_relative \
--go-grpc_opt=require_unimplemented_servers=false \
--go-grpc_out=pkg/statistics \
--go-grpc_opt=paths=source_relative
.PHONY: test
test:
go test -race -covermode=atomic -v -coverprofile=coverage.txt ./... || exit 1;
for dir in `find . -type f -name "go.mod" -exec dirname {} \;`; do \
if [ $$dir != "." ]; then \
cd $$dir; \
go test -race -covermode=atomic -v -coverprofile=coverage.txt ./... || exit 1; \
cd - > /dev/null ;\
lines=`cat $$dir/coverage.txt | wc -l`; \
lines=`expr $$lines - 1`; \
tail -n $$lines $$dir/coverage.txt >> coverage.txt; \
fi; \
done
.PHONY: benchmark
benchmark:
for dir in `find . -type f -name "go.mod" -exec dirname {} \;`; do \
cd $$dir; \
go test -bench=. -run=^Benchmark ./...; \
cd - > /dev/null; \
done
.PHONY: tools
tools:
@go install google.golang.org/protobuf/cmd/[email protected]
@go install google.golang.org/grpc/cmd/[email protected]
@go install github.com/cweill/gotests/[email protected]
.PHONY: ultron
ultron:
@go run cmd/ultron/main.go
.PHOY: sync-module-version
sync-module-version:
for dir in `find . -type f -name "go.mod" -exec dirname {} \;`; do \
head -n 1 $$dir/go.mod | grep github.com/wosai/ultron/v2$ && continue; \
cd $$dir; \
go get github.com/wosai/ultron/v2@${version}; \
go mod tidy; \
cd - > /dev/null; \
done