$schema: "https://moonrepo.dev/schemas/tasks.json"
fileGroups:
cargo:
- "Cargo.toml"
- "src/**/*"
- "/.cargo/config.toml"
- "/rust-toolchain.toml"
sources: []
tests:
- "benches/**/*"
- "tests/**/*"
tasks:
cargo:
command: "cargo"
options:
runInCI: false
build: &build
command: "cargo build"
inputs:
- "@group(cargo)"
- "@group(sources)"
env: &env
CARGO_TERM_COLOR: "always"
build-release:
<<: *build
command: "cargo build --release"
options:
runInCI: false
check:
command: "cargo check --all-targets"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
env: *env
dev:
command: "cargo run"
inputs:
- "@group(cargo)"
- "@group(sources)"
preset: "server"
env: *env
format: &format
command: "cargo fmt --all --check"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
- "/rustfmt.toml"
env: *env
format-write:
<<: *format
command: "cargo fmt --all -- --emit=files"
options:
runInCI: false
lint:
command: "cargo clippy --all-targets"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
- "/clippy.toml"
env: *env
lint-fix:
extends: "lint"
args: "--fix --allow-dirty --allow-staged"
options:
runInCI: false
test:
command: "cargo nextest run"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
- "/.config/nextest.*"
env: *env