-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJustfile
88 lines (73 loc) · 2.11 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
# Show available recipes
@default:
just --list --unsorted
# Development workflow (format, build, clippy, test, docs)
dev: format build clippy test docs
# Docs development workflow
dev-docs:
#!/usr/bin/env -S sh -eux
mdbook serve --open &
cargo watch ---ignore docs -- just docs &
trap 'kill $(jobs -pr)' EXIT
wait
# Run `rew` with args
run *ARGS:
cargo run -- {{ARGS}}
# Run `rew x` with a pattern
x PATTERN:
cargo run -- x "{{PATTERN}}"
# Build
build:
cargo build --workspace --exclude fuzz
# Install release build to ~/.local/bin/
install:
cargo build --release
mkdir -p ~/.local/bin/
cp target/release/rew ~/.local/bin/
# Format code
format *ARGS:
cargo +nightly fmt --all {{ARGS}}
# Run clippy
clippy:
cargo clippy --workspace -- \
-D clippy::all \
-D clippy::pedantic \
-A clippy::module_name_repetitions \
-A clippy::must_use_candidate
# Run tests
test:
cargo nextest run --status-level leak
# Generate docs
docs:
cargo run --package xtask -- docs
# Run fuzzer
fuzz:
cargo +nightly fuzz run --jobs {{num_cpus()}} pattern
# Generate code coverage
coverage format:
cargo tarpaulin \
--engine llvm \
--exclude-files 'tests/*' \
--exclude-files 'fuzz/*' \
--exclude-files 'xtask/*' \
--out {{format}}
# Preview code coverage as HTML
coverage-preview:
just coverage html
xdg-open tarpaulin-report.html
# Clean generated files
clean:
cargo clean
rm -rf book cobertura.xml tarpaulin-report.html
# Set up development environment
[confirm("This might break your environment!\nRun `just --show setup` first to check what it does.\nContinue? [y/n]:")]
setup:
rustup self update
rustup install stable
rustup install nightly
if [ ! -x "$(command -v cargo-binstall)" ]; then \
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash; \
else \
cargo binstall cargo-binstall; \
fi
cargo binstall cargo-fuzz cargo-nextest cargo-tarpaulin cargo-watch coreutils mdbook