-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
56 lines (46 loc) · 1.42 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
version = $(shell bash ./version.sh)
ext = $(shell bash ./extension.sh)
# Note: be careful with values for `binary_prefix`, because of how it is used
# in the "clean" task--it will delete any files with this prefix
binary_prefix = leifdb-
tag ?= 0
.PHONY: test
test: app
go test -v -tags=unit -coverprofile=coverage.out ./...
go test -v -tags=mgmttest -coverprofile=mgmttest_coverage.out ./...
.PHONY: viewcoverage
viewcoverage: coverage.out
go tool cover -html=coverage.out
go tool cover -html=mgmttest_coverage.out
.PHONY: benchmark
benchmark:
go test -v -tags=bench -bench=. ./...
.PHONY: clean
clean:
go clean
rm -rf ./build || true
rm ./$(binary_prefix)* || true
.PHONY: install
install:
go install github.com/swaggo/swag/cmd/swag
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
.PHONY: app
app: clean
swag init
gofmt -w -s .
go vet
go build -ldflags "-X 'main.LeifDBVersion=$(version)'" -tags=unit,mgmttest -o $(binary_prefix)$(version)$(ext)
.PHONY: protobuf
protobuf:
protoc -I=./api ./api/raft.proto --go_out=. --go-grpc_out=.
mkdir -p ./internal/raft
cp ./github.com/btmorr/leifdb/internal/raft/* ./internal/raft/
rm -rf ./github.com
.PHONY: linuxbin
linuxbin:
env GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.LeifDBVersion=$(version)'" -o build/leifdb
.PHONY: testcluster
testcluster: linuxbin
make -C ui build
docker-compose up --build