-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
120 lines (91 loc) · 3.91 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
113
114
115
116
117
118
119
120
# List the available commands.
help:
@just --list --justfile {{justfile()}}
# Run all of our unit tests.
test:
cargo nextest run --all-features --no-fail-fast
test-doc:
cargo test --doc --all-features --no-fail-fast
test-examples:
for dir in ./examples/*/; do cd $dir && pwd && cargo test --all-features --no-fail-fast && cd ../.. && pwd; done
test-private:
for dir in ./private/*/; do cd $dir && pwd && cargo test --all-features --no-fail-fast && cd ../.. && pwd; done
# Run all of our unit tests.
test-unit: test test-doc
test-book:
mdbook test book
test-book-examples:
for dir in ./book/examples/*/; do cd $dir && pwd && cargo test --all-features --no-fail-fast && cd ../../.. && pwd; done
test-book-all: test-book test-book-examples
# Run all of our tests
test-all: test-unit test-book-all
# Run all of our unit tests whenever files in the repo change.
test-watch:
cargo watch -s 'just test'
insta:
cargo insta review --workspace
serve-book:
mdbook serve book
# Install dependencies required to generate code coverage.
coverage-dependencies:
cargo binstall cargo-llvm-cov
# Nightly is required for doctests, as well as the `coverage(off)` attribute
rustup toolchain install nightly
rustup component add llvm-tools
nix-env -iA nixpkgs.lcov
# Remove previously generated code coverage data in order to get an accurate report.
coverage-clean:
cargo +nightly llvm-cov clean
# Run tests with coverage.
coverage-tests: coverage-clean
cargo +nightly llvm-cov --no-report nextest --all-features
cargo +nightly llvm-cov --no-report --doc --all-features
# Run tests with coverage and generate an html report.
coverage: coverage-tests
# Generate and open an HTML coverage report
cargo +nightly llvm-cov report --lcov --output-path ./target/llvm-cov-target/debug/lcov.info
genhtml -o ./target/llvm-cov-target/debug/coverage/ --show-details --highlight --ignore-errors source --legend ./target/llvm-cov-target/debug/lcov.info
open_cmd := if os() == "macos" { "open" } else { "xdg-open" }
# Run tests with coverage and open the generated HTML report.
coverage-open: coverage
{{ open_cmd }} target/llvm-cov-target/debug/coverage/index.html
alias fmt := format
# Format the project
format:
cargo fmt
check-fmt:
cargo fmt --all --check
pre-commit: check-fmt
pre-push: check-fmt
check-no-features:
cargo nextest run --no-default-features --no-fail-fast
# Nextest doesn't support doc tests, run those separately
cargo test --doc --no-default-features --no-fail-fast
cargo check --no-default-features
cargo clippy --all-targets --no-default-features -- -D warnings
check-default-features:
# With default features
cargo nextest run --no-fail-fast
# Nextest doesn't support doc tests, run those separately
cargo test --doc --no-fail-fast
cargo check
cargo clippy --all-targets -- -D warnings
check-all-features:
# With all features
cargo nextest run --all-features --no-fail-fast
# Nextest doesn't support doc tests, run those separately
cargo test --doc --all-features --no-fail-fast
cargo check --all-features
cargo clippy --all-targets --all-features -- -D warnings
check-docs:
RUSTDOCFLAGS="-D rustdoc::all -A rustdoc::private_intra_doc_links" cargo doc --all-features --no-deps
check-msrv:
cargo minimal-versions check --direct --all-features
# Run a suite of checks. These checks are fairly comprehensive and will catch most issues. However, they are still less than what is run in CI.
check: check-fmt check-no-features check-default-features check-all-features check-docs check-msrv
# Check if the Codecov config is valid
validate-codecov-config:
curl -X POST --data-binary @codecov.yml https://codecov.io/validate
# Initialize a new installation of the repo (e.g., install deps)
init:
cargo binstall cargo-nextest cargo-llvm-cov sea-orm-cli cargo-insta cargo-minimal-versions cargo-hack mdbook cargo-deny