-
-
Notifications
You must be signed in to change notification settings - Fork 162
Expand file tree
/
Copy pathjustfile
More file actions
executable file
·93 lines (74 loc) · 2.51 KB
/
Copy pathjustfile
File metadata and controls
executable file
·93 lines (74 loc) · 2.51 KB
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
#!/usr/bin/env just --justfile
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
[private]
default:
@just --list
# Execute the pre-commit checks
precommit: fmt check-crates check-docs
# Execute continuous integration (CI) checks
ci: check-fmt check-crates check-docs
# Format the entire Rust code
fmt:
@bash contrib/scripts/fmt.sh
# Check if the Rust code is formatted
[private]
check-fmt:
@bash contrib/scripts/fmt.sh check
# Check all the crates
[private]
check-crates:
@bash contrib/scripts/check-crates.sh
# Check Rust docs
[private]
check-docs:
@bash contrib/scripts/check-docs.sh
# Release rust crates
[confirm]
release:
cargo +stable publish --workspace
# Run code coverage using cargo-llvm-cov.
#
# Requires:
# - cargo-llvm-cov (install via: cargo install cargo-llvm-cov)
# - llvm-tools-preview component (install via: rustup component add llvm-tools-preview)
coverage package='none':
cargo llvm-cov clean --workspace
cargo llvm-cov --html {{ if package == 'none' { '--workspace' } else { '--package ' + package } }}
@echo
@echo 'open {{ justfile_directory() }}/target/llvm-cov/html/index.html'
# Generate an HTML diff‑coverage report for the current branch (compared to master).
# Requires: cargo-llvm-cov, diff-cover, Git.
# Examples:
# just diff-coverage # full workspace
# just diff-coverage package=my-crate # single crate
# just diff-coverage features="feat1,feat2" # with features
diff-coverage package='none' features='none':
#!/usr/bin/env bash
set -euo pipefail
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" == "master" ]]; then
echo "Error: This recipe cannot run on the master branch." >&2
exit 1
fi
cargo llvm-cov clean --workspace
# Pick workspace or package
if [[ "{{ package }}" == "none" ]]; then
PKG="--workspace"
else
PKG="--package {{ package }}"
fi
# Only add --features if needed
FEAT=""
if [[ "{{ features }}" != "none" ]]; then
FEAT="--features {{ features }}"
fi
cargo llvm-cov --cobertura $PKG $FEAT --output-path coverage.xml
mkdir -p "{{ justfile_directory() }}/target/diff-cover/"
diff-cover coverage.xml \
--compare-branch master \
--format "html:{{ justfile_directory() }}/target/diff-cover/report.html"
rm coverage.xml
echo "Report: file://{{ justfile_directory() }}/target/diff-cover/report.html"
# Run benches (unstable)
bench:
RUSTFLAGS='--cfg=bench' cargo +nightly bench