-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
69 lines (59 loc) · 1.46 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
# set makefile echo back
ifdef VERBOSE
V :=
else
V := @
endif
GRCOV := $(shell command -v grcov 2> /dev/null)
.PHONY: build
## build : Build binary
build:
$(V)cargo build
.PHONY: etcd
## etcd : Run etcd server
etcd:
cargo run --all-features -- start --db /tmp/store --addr '127.0.0.1:2379' --init
.PHONY: lint
## lint : Lint codespace
lint:
$(V)cargo clippy --workspace --exclude raft-engine \
--exclude raft \
--exclude raft-proto \
--tests --all-features -- -D warnings
.PHONY: fmt
## fmt : Format all code
fmt:
$(V)cargo fmt --all -- --check
.PHONY: test
## test : Run test
test:
$(V)cargo test --workspace -- $(FILTER)
.PHONY: clean
## clean : Clean build env
clean:
$(V)cargo clean
.PHONY: coverage
## coverage : Run test with coverage
coverage:
ifndef GRCOV
$(error "grcov is not avaiable, please install it by: cargo install grcov")
endif
# $(V)CARGO_INCREMENTAL=0
$(V)RUSTFLAGS="-Zprofile" \
cargo test --workspace -- $(FILTER)
$(V)grcov . -s . --binary-path ./target/debug/ \
-t lcov \
--branch \
--ignore-not-existing \
--ignore "/*" \
-o ./target/debug/coverage/lcov.info
$(V)genhtml -o ./target/debug/coverage/ \
--show-details \
--highlight \
--ignore-errors source \
--legend ./target/debug/coverage/lcov.info
$(V)echo "the coverage report is generated in: ./target/debug/coverage"
.PHONY: help
## help : Print help message
help: Makefile
@sed -n 's/^##//p' $< | awk 'BEGIN {FS = ":"} {printf "\033[36m%-13s\033[0m %s\n", $$1, $$2}'