-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (57 loc) · 1.98 KB
/
Copy pathMakefile
File metadata and controls
76 lines (57 loc) · 1.98 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
# spm — common developer tasks.
# `make check` mirrors the CI gate (fmt + clippy + test).
CARGO ?= cargo
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
.DEFAULT_GOAL := build
.PHONY: build release test fmt fmt-check lint check run install uninstall clean bump bump-pr coverage coverage-check
# Minimum line coverage (%). CI fails if `cargo test` drops below this.
COVERAGE_MIN ?= 95
## build: debug build
build:
$(CARGO) build
## release: optimized (LTO, stripped) build
release:
$(CARGO) build --release
## test: run the integration suite
test:
$(CARGO) test --all
## fmt: format the code
fmt:
$(CARGO) fmt --all
## fmt-check: fail if code is not formatted
fmt-check:
$(CARGO) fmt --all --check
## lint: clippy with warnings as errors
lint:
$(CARGO) clippy --all-targets -- -D warnings
## check: full CI gate — fmt-check + lint + test
check: fmt-check lint test
## coverage: print a per-file line-coverage report (needs cargo-llvm-cov)
coverage:
$(CARGO) llvm-cov --all
## coverage-check: fail if line coverage drops below COVERAGE_MIN (default 90%)
coverage-check:
$(CARGO) llvm-cov --all --fail-under-lines $(COVERAGE_MIN)
## run: run spm, e.g. `make run ARGS="list"`
run:
$(CARGO) run -- $(ARGS)
## install: build release and copy binary to $(BINDIR)
install: release
install -d $(BINDIR)
install -m 0755 target/release/spm $(BINDIR)/spm
## uninstall: remove the installed binary
uninstall:
rm -f $(BINDIR)/spm
## clean: remove build artifacts
clean:
$(CARGO) clean
## bump: bump crate version in Cargo.toml + Cargo.lock (PART=patch|minor|major or VERSION=X.Y.Z)
bump:
@CARGO="$(CARGO)" scripts/bump-version.sh $(if $(VERSION),$(VERSION),$(or $(PART),patch))
## bump-pr: bump the version on a new branch and open a release PR (needs gh)
bump-pr:
@CARGO="$(CARGO)" scripts/bump-version-pr.sh $(if $(VERSION),$(VERSION),$(or $(PART),patch))
## help: list targets
help:
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //'