forked from ssvlabs/ssv-dkg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
103 lines (84 loc) · 3.04 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
# This Makefile is meant to be used by people that do not usually work
# with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make.
.PHONY: install clean build test docker-build-image docker-demo-operators docker-demo-initiator docker-demo-reshare
.PHONY: docker-operator docker-initiator docker-reshare mockgen-install lint-prepare lint critic-prepare critic
GOBIN = ./build/bin
GO ?= latest
GORUN = env GO111MODULE=on go run
GOINSTALL = env GO111MODULE=on go install -v
GOTEST = env GO111MODULE=on go test -v
# Name of the Go binary output
BINARY_NAME=./bin/ssv-dkg
# Docker image name
DOCKER_IMAGE=ssv-dkg
install:
$(GOINSTALL) cmd/ssv-dkg/ssv-dkg.go
@echo "Done building."
@echo "Run ssv-dkg to launch the tool."
clean:
env GO111MODULE=on go clean -cache
# Recipe to compile the Go program
build:
@echo "Building Go binary..."
go build -o $(BINARY_NAME) ./cmd/ssv-dkg/ssv-dkg.go
# Recipe to run tests
test:
@echo "running tests"
go install gotest.tools/gotestsum@latest
gotestsum --format testname
# Recipe to build the Docker image
docker-build-image:
@echo "Building Docker image..."
docker build -t $(DOCKER_IMAGE) .
docker-demo-operators:
@echo "Running operators in docker demo"
docker-compose up --build operator1 operator2 operator3 operator4 operator5 operator6 operator7 operator8
docker-demo-initiator:
@echo "Running initiator in docker demo"
docker-compose up --build initiator
docker-demo-reshare:
@echo "Running resharing in docker demo"
docker-compose up --build resharing
docker-demo-ping:
@echo "Running ping operators in docker demo"
docker-compose up --build ping
docker-operator:
@echo "Running operator docker, make sure to update ./examples/operator1/congig/config.yaml"
docker run \
--name svv-dkg-operator \
-p 3030:3030 \
-v $(shell pwd)/examples:/data \
$(DOCKER_IMAGE):latest \
start-operator --configPath /data/operator1/config
docker-initiator:
@echo "Running initiator docker, make sure to update ./examples/initiator/config/init.yaml"
docker run \
--name ssv-dkg-initiator \
-v $(shell pwd)/examples:/data \
$(DOCKER_IMAGE):latest \
init --configPath /data/initiator/config
docker-reshare:
@echo "Running initiator docker for key resharing to new operators, make sure to update ./examples/initiator/config/reshare.yaml"
docker run \
--name ssv-dkg-reshare \
-v $(shell pwd)/examples:/data \
$(DOCKER_IMAGE):latest \
reshare --configPath /data/initiator/config
mockgen-install:
go install github.com/golang/mock/[email protected]
@which mockgen || echo "Error: ensure `go env GOPATH` is added to PATH"
lint-prepare:
@echo "Preparing Linter"
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s latest
lint:
./bin/golangci-lint run -v ./...
@if [ ! -z "${UNFORMATTED}" ]; then \
echo "Some files requires formatting, please run 'go fmt ./...'"; \
exit 1; \
fi
critic-prepare:
@echo "Preparing GoCritic"
go install -v github.com/go-critic/go-critic/cmd/gocritic@latest
critic:
gocritic check -enableAll ./...