-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
49 lines (36 loc) · 1.68 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
.PHONY: help check audit build clean clippy doc fmt test
# Where the project is mounted inside the container
podman_mount_dir = /rems
# What tag to apply to the built container
podman_tag = rems: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) -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 build clippy test doc ## Run the full set of CI checks
audit: container ## Run cargo audit
# Neither of these has a fix available, so we will ignore them for now.
$(podman_run) cargo audit --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0159
build: container ## Run cargo build
$(podman_run) cargo build
clean: ## Clean build artifacts
$(podman_run) cargo clean || rm -rf target
podman rmi $(podman_tag) || true
rm -rf $(CURDIR)/.cache
clippy: container ## Run cargo clippy
$(podman_run) 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: container ## Run cargo doc
$(podman_run) cargo doc --no-deps
fmt: container ## Run cargo fmt
$(podman_run) 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: container ## Run cargo test
$(podman_run) cargo test