forked from Fantom-foundation/Sonic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (58 loc) · 1.93 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
.PHONY: all
all: sonicd sonictool
GOPROXY ?= "https://proxy.golang.org,direct"
.PHONY: sonicd sonictool
sonicd:
GIT_COMMIT=`git rev-list -1 HEAD 2>/dev/null || echo ""` && \
GIT_DATE=`git log -1 --date=short --pretty=format:%ct 2>/dev/null || echo ""` && \
GOPROXY=$(GOPROXY) \
go build \
-ldflags "-s -w -X github.com/Fantom-foundation/go-opera/config.GitCommit=$${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/config.GitDate=$${GIT_DATE}" \
-o build/sonicd \
./cmd/sonicd
sonictool:
GIT_COMMIT=`git rev-list -1 HEAD 2>/dev/null || echo ""` && \
GIT_DATE=`git log -1 --date=short --pretty=format:%ct 2>/dev/null || echo ""` && \
GOPROXY=$(GOPROXY) \
go build \
-ldflags "-s -w -X github.com/Fantom-foundation/go-opera/config.GitCommit=$${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/config.GitDate=$${GIT_DATE}" \
-o build/sonictool \
./cmd/sonictool
TAG ?= "latest"
.PHONY: sonic-image
sonic-image:
docker build \
--network=host \
-f ./docker/Dockerfile.opera -t "sonic:$(TAG)" .
.PHONY: test
test:
go test -cover ./...
.PHONY: coverage
coverage:
go test -coverprofile=cover.prof $$(go list ./... | grep -v '/gossip/contract/' | grep -v '/gossip/emitter/mock' | xargs)
go tool cover -func cover.prof | grep -e "^total:"
.PHONY: fuzz
fuzz:
CGO_ENABLED=1 \
mkdir -p ./fuzzing && \
go run github.com/dvyukov/go-fuzz/go-fuzz-build -o=./fuzzing/gossip-fuzz.zip ./gossip && \
go run github.com/dvyukov/go-fuzz/go-fuzz -workdir=./fuzzing -bin=./fuzzing/gossip-fuzz.zip
.PHONY: clean
clean:
rm -fr ./build/*
# Linting
.PHONY: vet
vet:
go vet ./...
STATICCHECK_VERSION = 2024.1.1
.PHONY: staticcheck
staticcheck:
@go install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
staticcheck ./...
ERRCHECK_VERSION = v1.7.0
.PHONY: errcheck
errorcheck:
@go install github.com/kisielk/errcheck@$(ERRCHECK_VERSION)
errcheck ./...
.PHONY: lint
lint: vet staticcheck # errorcheck