-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
94 lines (71 loc) · 2.69 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
MODULE = github.com/binance-chain/tss-lib
PACKAGES = $(shell go list ./... | grep -v '/vendor/')
UT_TIMEOUT = -timeout 60m
UT_COVER = -covermode=atomic -cover
UT_PACKAGES_LEVEL_0 = $(shell go list ./... | grep -v '/vendor/' | grep 'keygen' )
UT_PACKAGES_LEVEL_1 = $(shell go list ./... | grep -v '/vendor/' | grep -v 'keygen' )
all: protob test
########################################
### Protocol Buffers
protob:
@echo "--> Building Protocol Buffers"
@for protocol in message signature ecdsa-keygen ecdsa-signing ecdsa-resharing eddsa-keygen eddsa-signing eddsa-resharing; do \
echo "Generating $$protocol.pb.go" ; \
protoc --go_out=. ./protob/$$protocol.proto ; \
done
########################################
### Format
fmt:
@go fmt ./...
lint:
@golangci-lint run
build: protob
go fmt ./...
########################################
### Benchmarking
benchgen: fmt
cd cmd && go run ./tss-benchgen benchdata
benchsign: fmt
cd cmd && go run ./tss-benchsign benchdata
########################################
### Testing
test_unit_level0:
@echo "--> Running Unit Tests - Level 0"
@echo "!!! WARNING: This will take a long time :|"
@echo "!!! WARNING: This will delete fixtures :("
go clean -testcache
rm -f ./test/_ecdsa_fixtures/*json
rm -f ./test/_eddsa_fixtures/*json
go test ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_0)
test_unit: test_unit_level0
@echo "--> Running Unit Tests - Level 1"
@echo "!!! WARNING: This will take a long time :|"
go test ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_1)
test_unit_race_level0:
@echo "--> Running Unit Tests (with Race Detection) - Level 0"
@echo "!!! WARNING: This will take a long time :|"
@echo "!!! WARNING: This will delete fixtures :("
go clean -testcache
rm -f ./test/_ecdsa_fixtures/*json
rm -f ./test/_eddsa_fixtures/*json
go test -race ${UT_TIMEOUT} $(UT_PACKAGES_LEVEL_0)
test_unit_race: test_unit_race_level0
@echo "--> Running Unit Tests (with Race Detection) - Level 1"
@echo "!!! WARNING: This will take a long time :|"
go test -race ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_1)
test_unit_race_ci: test_unit_race_level0
@echo "--> Running Unit Tests (with Race Detection) - Level 1"
@echo "!!! WARNING: This will take a long time :|"
go test -race ${UT_TIMEOUT} $(UT_PACKAGES_LEVEL_1)
test:
make test_unit_race
test_ci:
make test_unit_race_ci
########################################
### Pre Commit
pre_commit: build test
########################################
# To avoid unintended conflicts with file names, always add to .PHONY
# # unless there is a reason not to.
# # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: protob build test test_ci test_unit test_unit_race benchgen benchsign