22#
33# The recipes make heavy use of `rustup`'s toolchain syntax (e.g. `cargo +nightly`). `rustup` is
44# required on the system in order to intercept the `cargo` commands and to install and use the appropriate toolchain with components.
5- #
6- # The root directory of this workspace is "virtual", it has no source code itself, just a holder of crates. This means
7- # the cargo commands generally run on all the child crates by default without the `--workspace` flag.
85
96NIGHTLY_TOOLCHAIN := " nightly-2025-07-10"
107STABLE_TOOLCHAIN := " 1.88.0"
@@ -22,7 +19,7 @@ STABLE_TOOLCHAIN := "1.88.0"
2219# Verify check, fails if anything is off. Good for CI.
2320@_ check-verify :
2421 cargo + {{ NIGHTLY_TOOLCHAIN}} fmt --check
25- # Lint all workspace members. Enable all feature flags. Check all targets (tests, examples) along with library code. Turn warnings into errors.
22+ # Enable all feature flags. Check all targets (tests, examples) along with library code. Turn warnings into errors.
2623 cargo + {{ NIGHTLY_TOOLCHAIN}} clippy --all-features --all-targets -- -D warnings
2724 # Static analysis of types and lifetimes. Nightly toolchain required by benches target.
2825 cargo + {{ NIGHTLY_TOOLCHAIN}} check --all-features --all-targets
@@ -36,75 +33,23 @@ STABLE_TOOLCHAIN := "1.88.0"
3633 # Adding --fix flag to apply suggestions with --allow-dirty.
3734 cargo + {{ NIGHTLY_TOOLCHAIN}} clippy --all-features --all-targets --fix --allow-dirty -- -D warnings
3835
39- # Run a test suite: features, msrv, constraints, no-std, or all .
36+ # Run the test suite.
4037@ test suite = " features":
41- just _test-{{ suite}}
42-
43- # Run all test suites.
44- @_ test-all : _test-features _test-msrv _test-constraints _test-no-std
45-
46- # Test library with feature flag matrix compatability.
47- @_ test-features :
48- # Test the extremes: all features enabled as well as none. If features are additive, this should expose conflicts.
49- # If non-additive features (mutually exclusive) are defined, more specific commands are required.
50- # Run all targets except benches which needs the nightly toolchain.
51- cargo + {{ STABLE_TOOLCHAIN}} test --no-default-features --lib --bins --tests --examples
5238 cargo + {{ STABLE_TOOLCHAIN}} test --all-features --lib --bins --tests --examples
5339 cargo + {{ STABLE_TOOLCHAIN}} test --all-features --doc
5440
55- # Check code with MSRV compiler.
56- @_ test-msrv :
57- # Handles creating sandboxed environments to ensure no newer binaries sneak in.
58- cargo install cargo-msrv@0.18.4
59- cargo msrv --manifest-path protocol/ Cargo.toml verify --all-features
60- cargo msrv --manifest-path traffic/ Cargo.toml verify --all-features
61-
62- # Check minimum and maximum dependency contraints.
63- @_ test-constraints :
64- # Ensure that the workspace code works with dependency versions at both extremes. This checks
65- # that we are not unintentionally using new feautures of a dependency or removed ones.
66- # Skipping "--all-targets" for these checks since tests and examples are not relevant for a library consumer.
67- # Enabling "--all-features" so all dependencies are checked.
68- # Clear any previously resolved versions and re-resolve to the minimums.
69- rm -f Cargo.lock
70- cargo + {{ NIGHTLY_TOOLCHAIN}} check --all-features -Z direct-minimal-versions
71- # Clear again and check the maximums by ignoring any rust-version caps.
72- rm -f Cargo.lock
73- cargo + {{ NIGHTLY_TOOLCHAIN}} check --all-features --ignore-rust-version
74- rm -f Cargo.lock
75-
76- # Test no standard library support.
77- @_ test-no-std :
78- cargo install cross@0.2.5
79- $HOME/ .cargo/ bin/ cross build --package bip324 --target thumbv7m-none-eabi --no-default-features
80-
81- # Run benchmarks.
82- @ bench :
83- cargo + {{ NIGHTLY_TOOLCHAIN}} bench --package bip324 --bench cipher_session
84-
85- # Run fuzz target: receive_key or receive_garbage.
86- @ fuzz target seconds :
87- rustup component add --toolchain {{ NIGHTLY_TOOLCHAIN}} llvm-tools-preview
88- cargo install cargo-fuzz@0.12.0
89- # Generate new test cases and add to corpus. Bumping length for garbage.
90- cd protocol && cargo + {{ NIGHTLY_TOOLCHAIN}} fuzz run {{ target}} -- -max_len=5120 -max_total_time={{ seconds}}
91- # Measure coverage of corpus against code.
92- cd protocol && cargo + {{ NIGHTLY_TOOLCHAIN}} fuzz coverage {{ target}}
93- # Generate HTML coverage report.
94- protocol/ fuzz/ coverage.sh {{ NIGHTLY_TOOLCHAIN}} {{ target}}
95-
9641# Add a release tag and publish to the upstream remote. Requires write privileges.
97- @ tag crate version remote = " upstream ":
42+ @ tag crate version remote = " origin ":
9843 # Guardrails: on a clean main with updated changelog and manifest.
9944 if ! git diff --quiet || ! git diff --cached --quiet; then \
10045 echo " tag: Uncommitted changes" ; exit 1 ; fi
10146 if [ " `git rev-parse --abbrev-ref HEAD`" != " main" ]; then \
10247 echo " tag: Not on main branch" ; exit 1 ; fi
103- if ! grep -q " ## v{{ version}} " {{ crate }} / CHANGELOG.md; then \
48+ if ! grep -q " ## v{{ version}} " CHANGELOG.md; then \
10449 echo " tag: CHANGELOG.md entry missing for v{{ version}} " ; exit 1 ; fi
105- if ! grep -q ' ^version = "{{ version}} "' {{ crate }} / Cargo.toml; then \
50+ if ! grep -q ' ^version = "{{ version}} "' Cargo.toml; then \
10651 echo " tag: Cargo.toml version mismatch" ; exit 1 ; fi
10752 # An annotated release tag is specific to a crate following the convention crate-version.
108- echo " Adding release tag {{ crate }} - v{{ version}} and pushing to {{ remote}} ..."
109- git tag -a {{ crate }} - v{{ version}} -m " Release v{{ version}} for {{ crate }} "
110- git push {{ remote}} {{ crate }} - v{{ version}}
53+ echo " Adding release tag v{{ version}} and pushing to {{ remote}} ..."
54+ git tag -a v{{ version}} -m " Release v{{ version}} "
55+ git push {{ remote}} v{{ version}}
0 commit comments