-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
112 lines (96 loc) · 3.32 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env just --justfile
# Output this list.
list:
@just --list
# Output this list.
help:
@just list
# Apply strict formatting.
fmt *FLAGS:
cargo +nightly fmt --all {{FLAGS}}
# Run clippy on codesbase, tests, examples, while testing all features.
check *FLAGS:
cargo clippy --tests --examples --all-targets --all-features --workspace {{FLAGS}}
# Run tests.
test *FLAGS:
cargo nextest run --all-features --workspace {{FLAGS}}
# Build and run.
run *FLAGS:
cargo run {{FLAGS}}
# Generate documentation. Add '-- open' to open the docs in a web page.
doc *FLAGS:
cargo doc --no-deps --all-features --document-private-items --workspace
# Calculate coverage and open page with the results.
coverage *FLAGS:
cargo llvm-cov {{FLAGS}}
# Benchmark codebase with criterion.
benchmark *FLAGS:
cargo criterion {{FLAGS}}
# Check for unused dependencies, audit for vulnerabilities,
# and check if newer version of depenedencies is available.
thorough-check:
cargo +nightly udeps --all-targets
cargo audit
cargo upgrades
# Check for unusead features. Opens results in a browser.
unused-features:
unused-features analyze
unused-features build-report --input report.json
rm report.json
mv report.html /tmp
xdg-open /tmp/report.html
# Check build timings.
build-timings:
cargo clean
cargo build --release --quiet --timings
xdg-open /target/cargo-timings/cargo-timing.html
# Runs all checks necessary before commit.
# Checks formating, code quality, tests, documentation, spellcheck and more.
pre-commit:
cargo clean
@just fmt
@just check -- -D warnings
@just test
@just doc
@just thorough-check
@just unused-features
cargo spellcheck fix
cargo spellcheck reflow
# Similar to `pre-commit` command, but is not interactive and doesn't modify the codebase.
# Suitable for automated CI pipelines.
ci:
@just fmt --check
@just check -- -D warnings
@just test
@just doc
@just thorough-check
cargo spellcheck check
# Installs the release binary to the $USERS ~/.local/bin
install:
cargo build --release
cp -v target/release/vsm ~/.local/bin
# Initializes the project, installing all tools necessary. Should be run once before begining of development.
init:
echo # installing git hooks
pre-commit --version || pip install pre-commit
pre-commit install || echo "failed to install git hooks!" 1>&2
echo # installing nightly used by `just fmt` and `cargo udeps`
rustup install nightly
echo # installing cargo-binstall for faster setup time
cargo binstall -V || cargo install cargo-binstall
echo # things required by `just test`
cargo binstall cargo-nextest --no-confirm
echo # things required by `just watch`
cargo binstall cargo-watch --no-confirm
echo # things required by `just pre-commit`
cargo binstall cargo-spellcheck --no-confirm
echo # things required by `just coverage`
rustup component add llvm-tools-preview
cargo binstall cargo-llvm-cov --no-confirm
echo # things required by `just benchmark`
cargo binstall cargo-criterion --no-confirm
echo # things required by `just thorough-check`
cargo binstall cargo-udeps --no-confirm
cargo binstall cargo-audit --no-confirm
cargo binstall cargo-upgrades --no-confirm
cargo binstall cargo-unused-features --no-confirm