forked from Layr-Labs/eigensdk-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
51 lines (42 loc) · 2.23 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
############################# HELP MESSAGE #############################
# Make sure the help command stays first, so that it's printed by default when `make` is called without arguments
.PHONY: help bindings mocks tests tests-cover fmt format-lines lint
GO_LINES_IGNORED_DIRS=contracts
GO_PACKAGES=./chainio/... ./crypto/... ./logging/... \
./types/... ./utils/... ./signer/... ./cmd/... \
./signerv2/...
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
bindings: ## generates contract bindings
cd contracts && rm -rf bindings/* && ./generate-bindings.sh
mocks: ## generates mocks
go install go.uber.org/mock/mockgen@v0.4.0
go generate ./...
tests: ## runs all tests
go test ./... -timeout=30s
tests-cover: ## run all tests with test coverge
go test ./... -coverprofile=coverage.out -covermode=atomic -v -count=1
go tool cover -html=coverage.out -o coverage.html
open coverage.html
godoc-port = 6060
godoc: ## runs godoc server and opens in browser
@echo "Starting godoc server on port $(godoc-port)..."
@-godoc -http=:$(godoc-port) & echo $$! > godoc.pid
@echo "Godoc server started!"
@echo "Opening localhost page..."
@sleep 1 # wait for godoc to start
@open http://localhost:$(godoc-port)/pkg/github.com/Layr-Labs/eigensdk-go/ || xdg-open http://localhost:$(godoc-port)/pkg/github.com/Layr-Labs/eigensdk-go/
@echo "Press CTRL+C to stop the godoc server..."
@# The trap command ensures that, when the script exits (e.g., due to CTRL+C), it will kill the godoc process using the PID saved in the godoc.pid file.
@# The read varname command will keep the make command running (waiting for input) until you press CTRL+C.
@trap 'kill `cat godoc.pid` && rm -f godoc.pid' EXIT; read varname
fmt: ## formats all go files
go fmt ./...
make format-lines
format-lines: ## formats all go files with golines
go install github.com/segmentio/golines@latest
golines -w -m 120 --ignore-generated --shorten-comments --ignored-dirs=${GO_LINES_IGNORED_DIRS} ${GO_FOLDERS}
lint: ## runs all linters
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run ./...