-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (75 loc) · 1.83 KB
/
Makefile
File metadata and controls
92 lines (75 loc) · 1.83 KB
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
VERSION := $(shell git describe --tags --always --dirty="-dev")
.PHONY: all
all: clean build
.PHONY: v
v:
@echo "Version: ${VERSION}"
.PHONY: clean
clean:
rm -rf build/
.PHONY: build-cli
build-cli:
@mkdir -p ./build
go build -trimpath -ldflags "-X github.com/flashbots/go-template/common.Version=${VERSION}" -v -o ./build/cli cmd/cli/main.go
.PHONY: build-httpserver
build-httpserver:
@mkdir -p ./build
go build -trimpath -ldflags "-X github.com/flashbots/go-template/common.Version=${VERSION}" -v -o ./build/httpserver cmd/httpserver/main.go
.PHONY: test
test:
go test ./...
.PHONY: test-race
test-race:
go test -race ./...
FUZZTIME ?= 2s
.PHONY: test-fuzz
test-fuzz:
@for fuzz in $$(grep -r "^func Fuzz" ./crypto/*_test.go | sed 's/.*\(Fuzz[a-zA-Z]*\).*/\1/'); do \
echo "Running $$fuzz..."; \
go test -fuzz=$$fuzz -fuzztime=$(FUZZTIME) ./crypto || exit 1; \
done
.PHONY: lint
lint:
gofmt -d -s .
gofumpt -d -extra .
go vet ./...
staticcheck ./...
golangci-lint run
nilaway ./...
.PHONY: fmt
fmt:
gofmt -s -w .
gci write .
gofumpt -w -extra .
go mod tidy
.PHONY: gofumpt
gofumpt:
gofumpt -l -w -extra .
.PHONY: lt
lt: lint test
.PHONY: cover
cover:
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -func /tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp
.PHONY: cover-html
cover-html:
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -html=/tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp
.PHONY: docker-cli
docker-cli:
DOCKER_BUILDKIT=1 docker build \
--platform linux/amd64 \
--build-arg VERSION=${VERSION} \
--file cli.dockerfile \
--tag your-project \
.
.PHONY: docker-httpserver
docker-httpserver:
DOCKER_BUILDKIT=1 docker build \
--platform linux/amd64 \
--build-arg VERSION=${VERSION} \
--file httpserver.dockerfile \
--tag your-project \
.