forked from Fantom-foundation/go-opera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (34 loc) · 1.15 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
.PHONY: all
all: opera
GOPROXY ?= "https://proxy.golang.org,direct"
.PHONY: opera
opera:
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/cmd/opera/launcher.gitCommit=$${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitDate=$${GIT_DATE}" \
-o build/opera \
./cmd/opera
TAG ?= "latest"
.PHONY: opera-image
opera-image:
docker build \
--network=host \
-f ./docker/Dockerfile.opera -t "opera:$(TAG)" .
.PHONY: test
test:
go test ./...
.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/*