-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
140 lines (108 loc) · 3.86 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
VERSION := $(shell git describe --tags --always)
GITREV := $(shell git rev-parse --short HEAD)
GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD)
DATE := $(shell LANG=US date +"%a, %d %b %Y %X %z")
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/dist
GOARCH := $(ARCH)
GOENVVARS := GOBIN=$(GOBIN) CGO_ENABLED=1 GOOS=$(OS) GOARCH=$(GOARCH)
GOBINARY := lagrange-node
GOCMD := $(GOBASE)/cmd/baseapp/
SCRIPTS_FOLDER=$(GOBASE)/scripts
LDFLAGS += -X 'github.com/Lagrange-Labs/lsc-node.Version=$(VERSION)'
LDFLAGS += -X 'github.com/Lagrange-Labs/lsc-node.GitRev=$(GITREV)'
LDFLAGS += -X 'github.com/Lagrange-Labs/lsc-node.GitBranch=$(GITBRANCH)'
LDFLAGS += -X 'github.com/Lagrange-Labs/lsc-node.BuildDate=$(DATE)'
STOP := docker compose down --remove-orphans
# Building the docker image and the binary
build: ## Builds the binary locally into ./dist
$(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD)
.PHONY: build
docker-build: ## Builds a docker image with the node binary
docker build -t lagrange-node -f ./Dockerfile .
.PHONY: docker-build
# Protobuf
proto-gen:
@ sh $(SCRIPTS_FOLDER)/proto-gen.sh
.PHONY: proto-gen
# Linting, Teseting, Benchmarking
golangci_lint_cmd=github.com/golangci/golangci-lint/cmd/[email protected]
install-linter:
@echo "--> Installing linter"
@go install $(golangci_lint_cmd)
lint:
@echo "--> Running linter"
@ $$(go env GOPATH)/bin/golangci-lint run --timeout=10m
.PHONY: lint install-linter
test: stop
docker compose -f docker-compose.yml up -d mongo
docker compose -f docker-compose.yml up -d lagrangesc
sleep 3
docker compose -f docker-compose.yml up -d simavs-sync
sleep 3
docker ps -a
trap '$(STOP)' EXIT; go test ./... --timeout=10m --race
signer-test:
cd signer && go test ./... --timeout=10m --race
core-test:
cd core && go test ./... --timeout=10m --race
.PHONY: test
run-db-mongo:
docker compose -f docker-compose.yml up -d mongo
.PHONY: run-db-mongo
run-lagrange-sc:
docker compose -f docker-compose.yml up -d lagrangesc
.PHONY: run-lagrange-sc
run-avs-sync:
docker compose -f docker-compose.yml up -d simavs-sync
.PHONY: run-avs-sync
run-prometheus:
docker compose -f docker-compose.yml up -d prometheus
.PHONY: run-prometheus
run-grafana:
docker compose -f docker-compose.yml up -d grafana
.PHONY: run-grafana
benchmark:
go test -run=NOTEST -timeout=30m -benchmem -bench=. ./...
.PHONY: benchmark
# Local testnet
create-keystore:
sh ./testutil/vector/generator.sh
go run ./testutil/chainconfig/cmd/...
localnet-start: stop create-keystore
docker compose -f docker-compose.yml up -d mongo
docker compose -f docker-compose.yml up -d lagrangesc
docker compose -f docker-compose.yml up -d simsigner
sleep 3
docker compose -f docker-compose.yml up -d simserver
docker compose -f docker-compose.yml up -d simserver1
docker compose -f docker-compose.yml up -d simsequencer
docker compose -f docker-compose.yml up -d simavs-sync
sleep 10
docker compose -f docker-compose.yml up -d simnode1
docker compose -f docker-compose.yml up -d simnode2
docker compose -f docker-compose.yml up -d simnode3
docker compose -f docker-compose.yml up -d simnode4
docker compose -f docker-compose.yml up -d simnode5
docker compose -f docker-compose.yml up -d simnode6
docker compose -f docker-compose.yml up -d simnode7
sleep 3
docker compose -f docker-compose.yml up -d prometheus
docker compose -f docker-compose.yml up -d grafana
stop:
$(STOP)
.PHONY: create-keystore localnet-start stop
# Useful and Test Scripts
scgen: # Generate the go bindings for the smart contracts
@ cd scinterface && sh generator.sh
register-operator: # Register an operator
go run ./testutil/registerops/
.PHONY: scgen register-operator
# Run Components
run-server:
go run ./cmd/baseapp/... run-server
run-client:
go run ./cmd/baseapp/... run-client
run-sequencer:
go run ./cmd/baseapp/... run-sequencer
.PHONY: run-server run-client run-sequencer