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
121
122
123
124
# mediation โ task runner (https://just.systems)
#
# `just` with no arguments lists every recipe.
set shell := ["bash", "-uc"]
# MSRV โ keep in sync with `rust-version` in Cargo.toml and rust-toolchain.toml.
msrv := "1.94"
# ๐ List all recipes
default:
@just --list
# โ
Everything CI runs, in CI order
ci: fmt-check lint purity test doc package
@echo "โ
all checks passed"
# ๐ง Enforce the "zero I/O, no clock" guarantee over non-comment source lines
purity:
#!/usr/bin/env bash
set -uo pipefail
hits="$(grep -rn --include='*.rs' -E \
'now_utc|SystemTime::now|Instant::now|std::(fs|env|process)|std::net::(Tcp|Udp|SocketAddr|ToSocketAddrs)|\bunsafe\b' \
src/ | grep -vE ':[[:space:]]*(///|//!|//)' || true)"
if [ -n "$hits" ]; then
echo "โ ambient state or unsafe reached the source:" >&2
echo "$hits" >&2
echo "" >&2
echo "This crate promises equal inputs give equal outputs. Take the" >&2
echo "evaluation instant as a parameter instead." >&2
exit 1
fi
echo "๐ง pure: no clock, no I/O, no unsafe"
# ๐ข Enforce that no float type reaches a metered quantity
no-floats:
#!/usr/bin/env bash
set -uo pipefail
hits="$(grep -rn --include='*.rs' -E '\bf(32|64)\b' src/ \
| grep -vE ':[[:space:]]*(///|//!|//)' || true)"
if [ -n "$hits" ]; then
echo "โ a float reached the source:" >&2
echo "$hits" >&2
echo "" >&2
echo "Volumes are integer octets and durations integer seconds." >&2
echo "Floats belong only in ratios and scores โ add an allowance here" >&2
echo "deliberately if one is genuinely needed." >&2
exit 1
fi
echo "๐ข exact: no floats in quantities"
# ๐จ Format the workspace
fmt:
cargo fmt --all
# ๐จ Fail if anything is unformatted
fmt-check:
cargo fmt --all -- --check
# ๐ Clippy with warnings denied (default + all features)
lint:
cargo clippy --all-targets -- -D warnings
cargo clippy --all-targets --all-features -- -D warnings
# ๐ Fast type-check, all features
check:
cargo check --all-targets --all-features
# ๐งช Full test suite (all features, incl. doctests)
test:
cargo test --all-features
# ๐งช Run tests matching a filter, e.g. `just test-one luhn`
test-one filter:
cargo test --all-features {{ filter }} -- --nocapture
# ๐๏ธ Build every feature combination
features:
cargo build --no-default-features
cargo build --no-default-features --features serde
cargo build --all-features
# ๐ฆ Compile on the pinned MSRV
msrv:
RUSTUP_TOOLCHAIN={{ msrv }} cargo check --all-features --all-targets
# ๐ Build the docs with warnings denied
doc:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
# ๐ Build and open the docs
doc-open:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --open
# ๐ฆ Dry-run the crates.io package (catches bad metadata before tagging)
# `--allow-dirty` is local-only convenience; CI runs this on a clean checkout.
package:
cargo publish --dry-run --all-features --allow-dirty
# ๐ก๏ธ Audit dependencies for advisories (needs `cargo install cargo-audit`)
audit:
cargo audit
# โฌ๏ธ Show outdated dependencies (needs `cargo install cargo-outdated`)
outdated:
cargo outdated --root-deps-only
# ๐ท๏ธ Tag the current Cargo.toml version โ pushing the tag triggers release.yml
tag:
#!/usr/bin/env bash
set -euo pipefail
version="$(cargo metadata --no-deps --format-version 1 \
| grep -o '"version":"[^"]*"' | head -1 | cut -d'"' -f4)"
if [ -n "$(git status --porcelain)" ]; then
echo "โ working tree is dirty โ commit first" >&2
exit 1
fi
just ci
git tag -a "v${version}" -m "v${version}"
echo "๐ท๏ธ tagged v${version} โ push with: git push origin v${version}"
# ๐งน Remove build artifacts
clean:
cargo clean