-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·86 lines (69 loc) · 1.87 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
VERSION ?= $(shell git describe --tags --always --dirty="-dev")
DOCKER_REPO := flashbots/mev-boost
# Set linker flags to:
# -w: disables DWARF debugging information.
GO_BUILD_LDFLAGS += -w
# -s: disables symbol table information.
GO_BUILD_LDFLAGS += -s
# -X: sets the value of the symbol.
GO_BUILD_LDFLAGS += -X 'github.com/flashbots/mev-boost/config.Version=$(VERSION)'
# Remove all file system paths from the executable.
GO_BUILD_FLAGS += -trimpath
# Add linker flags to build flags.
GO_BUILD_FLAGS += -ldflags "$(GO_BUILD_LDFLAGS)"
.PHONY: all
all: build
.PHONY: v
v:
@echo "${VERSION}"
.PHONY: build
build:
CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o mev-boost
.PHONY: build-testcli
build-testcli:
CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o test-cli ./cmd/test-cli
.PHONY: test
test:
CGO_ENABLED=0 go test ./...
.PHONY: test-race
test-race:
CGO_ENABLED=1 go test -race ./...
.PHONY: lint
lint:
gofmt -d -s .
gofumpt -d -extra .
staticcheck ./...
golangci-lint run
.PHONY: lt
lt: lint test
.PHONY: fmt
fmt:
gofmt -s -w .
gofumpt -extra -w .
gci write .
go mod tidy
.PHONY: test-coverage
test-coverage:
CGO_ENABLED=0 go test -v -covermode=atomic -coverprofile=coverage.out ./...
go tool cover -func coverage.out
.PHONY: cover
cover:
CGO_ENABLED=0 go test -coverprofile=coverage.out ./...
go tool cover -func coverage.out
unlink coverage.out
.PHONY: cover-html
cover-html:
CGO_ENABLED=0 go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
unlink coverage.out
.PHONY: run-mergemock-integration
run-mergemock-integration: build
./scripts/run_mergemock_integration.sh
.PHONY: docker-image
docker-image:
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 --build-arg VERSION=${VERSION} . -t mev-boost
docker tag mev-boost:latest ${DOCKER_REPO}:${VERSION}
docker tag mev-boost:latest ${DOCKER_REPO}:latest
.PHONY: clean
clean:
git clean -fdx