-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
51 lines (37 loc) · 1.56 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
.PHONY: help check audit build clean clippy doc fmt test test_release
# Where the project is mounted inside the container
podman_mount_dir = /rpick
# What tag to apply to the built container
podman_tag = rpick:dev
# podman flags to mount the code into the container
podman_volume = -v $(CURDIR):$(podman_mount_dir):z -v $(CURDIR)/.cache:/root/.cargo/registry:z
# podman flags to run the container
podman_run = podman run --network=host --rm -it $(podman_volume) -e RPICK_CONFIG="$(podman_mount_dir)/config.yml" -w $(podman_mount_dir) $(podman_tag)
help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
check: fmt audit test_release build clippy test doc ## Run the full set of CI checks
audit: container ## Run cargo audit
$(podman_run) cargo audit
build: ## Run cargo build
cargo build
clean: ## Clean build artifacts
cargo clean || rm -rf target
podman rmi $(podman_tag) || true
rm -rf $(CURDIR)/.cache
clippy: ## Run cargo clippy
cargo clippy --all-targets --all-features -- -D warnings
container: ## Build the container
mkdir -p $(CURDIR)/.cache
podman build --pull -t $(podman_tag) $(podman_volume) --force-rm=true $(CURDIR)
doc: ## Run cargo doc
cargo doc --no-deps
fmt: ## Run cargo fmt
cargo fmt -- --check -v
license: container ## Run cargo-license
$(podman_run) cargo license
shell: container ## Run bash inside the development container
$(podman_run) bash
test: ## Run cargo test
cargo test
test_release: # Run cargo test --release
cargo test --release