-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
66 lines (52 loc) · 1.49 KB
/
justfile
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
target_dir := "target"
doc_dir := "doc"
doc_assets_dir := doc_dir + "/assets"
project_name := "qmi8658"
#----------
# Building
#----------
build: check-formatting check-clippy build-without-fmt-check
build-without-fmt-check: test check-readme generate-docs
# Run cargo test
test:
cargo test
# Run cargo test with all features enabled
test-all:
cargo test --all-features
# Check the formatting
check-formatting:
cargo fmt --all -- --check --color always
# Check clippy
check-clippy:
cargo clippy --all-targets --all-features --workspace -- -D warnings
#------
# Docs
#------
# Generates the docs
generate-docs:
cargo clean --doc
cargo doc --all-features --no-deps
#----------------------
# README.md generation
#----------------------
# Generate README.md for a single crate
generate-readme: _build-readme
#!/usr/bin/env bash
set -euo pipefail
cp "{{target_dir}}/README.md" "README.md"
# Check README.md for a single crate
check-readme: _build-readme
#!/usr/bin/env bash
set -euo pipefail
diff -q "{{target_dir}}/README.md" "README.md" || ( \
echo -e "\033[1;31mError:\033[0m README.md for {{project_name}} needs to be regenerated."; \
echo -e " Run 'just generate-readme' to regenerate.\n"; \
exit 1 \
)
# Builds README.md for a single crate
_build-readme:
#!/usr/bin/env bash
set -e -o pipefail
mkdir -p {{target_dir}}
echo "Building README.md for {{project_name}}"
cargo readme > {{target_dir}}/README.md