forked from irisnet/irishub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (87 loc) · 4.17 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation' | grep -v '/prometheus' | grep -v '/clitest' | grep -v '/lcd' | grep -v '/protobuf')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
all: get_vendor_deps install
COMMIT_HASH := $(shell git rev-parse --short HEAD)
BUILD_FLAGS = -ldflags "-X github.com/irisnet/irishub/version.GitCommit=${COMMIT_HASH}"
########################################
### Tools & dependencies
check_tools:
cd deps_tools && $(MAKE) check_tools
check_dev_tools:
cd deps_tools && $(MAKE) check_dev_tools
update_tools:
cd deps_tools && $(MAKE) update_tools
update_dev_tools:
cd deps_tools && $(MAKE) update_dev_tools
get_tools:
cd deps_tools && $(MAKE) get_tools
get_dev_tools:
cd deps_tools && $(MAKE) get_dev_tools
get_vendor_deps:
@rm -rf vendor/
@echo "--> Running dep ensure"
@dep ensure -v
draw_deps:
@# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/irisnet/irishub/cmd/iris -d 2 | dot -Tpng -o dependency-graph.png
########################################
### Generate swagger docs for irislcd
update_irislcd_swagger_docs:
@statik -src=client/lcd/swaggerui -dest=client/lcd
########################################
### Compile and Install
install: update_irislcd_swagger_docs
go install $(BUILD_FLAGS) ./cmd/iris
go install $(BUILD_FLAGS) ./cmd/iriscli
go install $(BUILD_FLAGS) ./cmd/irislcd
go install $(BUILD_FLAGS) ./cmd/irismon
install_debug:
go install ./cmd/irisdebug
build_linux: update_irislcd_swagger_docs
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/iris ./cmd/iris && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/iriscli ./cmd/iriscli && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/irislcd ./cmd/irislcd && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/irismon ./cmd/irismon
build_cur: update_irislcd_swagger_docs
go build -o build/iris ./cmd/iris && \
go build -o build/iriscli ./cmd/iriscli && \
go build -o build/irislcd ./cmd/irislcd && \
go build -o build/irismon ./cmd/irismon
build_examples: update_irislcd_swagger_docs
go build -o build/iris1 ./examples/irishub1/cmd/iris1
go build -o build/iriscli1 ./examples/irishub1/cmd/iriscli1
go build -o build/iris2-bugfix ./examples/irishub-bugfix-2/cmd/iris2-bugfix
go build -o build/iriscli2-bugfix ./examples/irishub-bugfix-2/cmd/iriscli2-bugfix
install_examples: update_irislcd_swagger_docs
go install ./examples/irishub1/cmd/iris1
go install ./examples/irishub1/cmd/iriscli1
go install ./examples/irishub-bugfix-2/cmd/iris2-bugfix
go install ./examples/irishub-bugfix-2/cmd/iriscli2-bugfix
build_example_linux: update_irislcd_swagger_docs
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/iris1 ./examples/irishub1/cmd/iris1
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/iriscli1 ./examples/irishub1/cmd/iriscli1
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/iris2-bugfix ./examples/irishub-bugfix-2/cmd/iris2-bugfix
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/iriscli2-bugfix ./examples/irishub-bugfix-2/cmd/iriscli2-bugfix
########################################
### Testing
test: test_unit test_cli test_lcd test_sim
test_sim: test_sim_modules test_sim_iris_nondeterminism test_sim_iris_fast
test_unit:
@go test $(PACKAGES_NOSIMULATION)
test_cli:
@go test -timeout 20m -count 1 -p 1 `go list github.com/irisnet/irishub/client/clitest` -tags=cli_test
test_lcd:
@go test `go list github.com/irisnet/irishub/client/lcd`
test_sim_modules:
@echo "Running individual module simulations..."
@go test $(PACKAGES_SIMTEST)
test_sim_iris_nondeterminism:
@echo "Running nondeterminism test..."
@go test ./app -run TestAppStateDeterminism -SimulationEnabled=true -v -timeout 10m
test_sim_iris_fast:
@echo "Running quick Iris simulation. This may take several minutes..."
@go test ./app -run TestFullIrisSimulation -SimulationEnabled=true -SimulationNumBlocks=100 -timeout 24h
test_sim_iris_slow:
@echo "Running full Iris simulation. This may take awhile!"
@go test ./app -run TestFullIrisSimulation -SimulationEnabled=true -SimulationNumBlocks=1000 -SimulationVerbose=true -v -timeout 24h