version: "3"
vars:
CARGO: cargo
FUZZ_CARGO: cargo +nightly
tasks:
default:
desc: List available tasks
cmds:
- task --list-all
fmt:
desc: Apply Rust formatting
aliases:
- fmt:fix
cmds:
- "{{.CARGO}} fmt"
fmt:check:
desc: Check Rust formatting
cmds:
- "{{.CARGO}} fmt -- --check"
check:
desc: Check the crate with default features
cmds:
- "{{.CARGO}} check"
check:all-features:
desc: Check the crate with all features
cmds:
- "{{.CARGO}} check --all-features --all-targets"
check:no-features:
desc: Check the crate without default features
cmds:
- "{{.CARGO}} check --no-default-features"
lint:
desc: Check clippy lints for all targets and features
aliases:
- lint:check
cmds:
- "{{.CARGO}} clippy --all-features --all-targets"
lint:fix:
desc: Apply clippy fixes for all targets and features
aliases:
- clippy
cmds:
- "{{.CARGO}} clippy --fix --allow-dirty --all-features --all-targets"
build:
desc: Build the crate with default features
cmds:
- "{{.CARGO}} build"
test:
desc: Run all test suites
cmds:
- task: test:all-features
- task: test:default-features
- task: test:no-features
- task: test:docs
test:all-features:
desc: Test the crate with all features
aliases:
- test:all
cmds:
- |
if command -v cargo-nextest > /dev/null 2>&1; then
{{.CARGO}} nextest run --all-features
else
{{.CARGO}} test --all-features
fi
test:default-features:
desc: Test the crate with default features
aliases:
- test:default
cmds:
- |
if command -v cargo-nextest > /dev/null 2>&1; then
{{.CARGO}} nextest run
else
{{.CARGO}} test
fi
test:no-features:
desc: Test the crate without default features
aliases:
- test:no-default-features
cmds:
- |
if command -v cargo-nextest > /dev/null 2>&1; then
{{.CARGO}} nextest run --no-default-features
else
{{.CARGO}} test --no-default-features
fi
test:docs:
desc: Run doctests
aliases:
- test:doc
cmds:
- "{{.CARGO}} test --doc"
example:pretty:
desc: Run the pretty_print example
aliases:
- example
cmds:
- "{{.CARGO}} run --example pretty_print --features pretty"
fuzz:build:
desc: Build fuzz targets with default fuzz features
cmds:
- "{{.FUZZ_CARGO}} fuzz build"
fuzz:build:all-features:
desc: Build fuzz targets with all fuzz feature forwards enabled
cmds:
- "{{.FUZZ_CARGO}} fuzz build --features assertions,unsafe,bytemuck,num-traits,rand_distr,rkyv,serde"
fuzz:
desc: Run the invariants fuzz target
cmds:
- "{{.FUZZ_CARGO}} fuzz run invariants --features assertions,unsafe,bytemuck,num-traits,rand_distr,rkyv,serde"
fuzz:smoke:
desc: Run the invariants fuzz target briefly
env:
LSAN_OPTIONS: detect_leaks=0
cmds:
- "{{.FUZZ_CARGO}} fuzz run invariants -- -runs=256"
verify:
desc: Run formatting checks, static checks, clippy, and the test matrix
deps:
- fmt:check
- check:all-features
- check:no-features
- lint:check
- test
- test:all-features
- test:no-features
doc:
desc: Build Rust documentation
aliases:
- docs
cmds:
- "{{.CARGO}} doc --no-deps --all-features"
doc:open:
desc: Build and open Rust documentation
aliases:
- docs:open
cmds:
- "{{.CARGO}} doc --no-deps --all-features --open"
clean:
desc: Remove Cargo build artifacts
cmds:
- "{{.CARGO}} clean"
coverage:
desc: Generate code coverage report (HTML)
cmds:
- cargo llvm-cov nextest --all-features --workspace --html
coverage:text:
desc: Generate code coverage report (text)
cmds:
- cargo llvm-cov nextest --all-features --workspace
coverage:lcov:
desc: Generate LCOV coverage file for upload
cmds:
- cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info
coverage:lib:
desc: Generate code coverage for lib tests only
cmds:
- cargo llvm-cov nextest --all-features --workspace --lib