justfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import "./misc/justfile.custom.just"
  2. import "./misc/test.just"
  3. alias b := build
  4. alias c := check
  5. alias t := test
  6. default:
  7. @just --list
  8. final-check: typos format clippy test
  9. # run `cargo build` on everything
  10. build *ARGS="--workspace --all-targets":
  11. #!/usr/bin/env bash
  12. set -euo pipefail
  13. if [ ! -f Cargo.toml ]; then
  14. cd {{invocation_directory()}}
  15. fi
  16. cargo build {{ARGS}}
  17. # run `cargo check` on everything
  18. check *ARGS="--workspace --all-targets":
  19. #!/usr/bin/env bash
  20. set -euo pipefail
  21. if [ ! -f Cargo.toml ]; then
  22. cd {{invocation_directory()}}
  23. fi
  24. cargo check {{ARGS}}
  25. # run code formatters
  26. format:
  27. #!/usr/bin/env bash
  28. set -euo pipefail
  29. if [ ! -f Cargo.toml ]; then
  30. cd {{invocation_directory()}}
  31. fi
  32. cargo fmt --all
  33. nixpkgs-fmt $(echo **.nix)
  34. # run tests
  35. test: build
  36. #!/usr/bin/env bash
  37. set -euo pipefail
  38. if [ ! -f Cargo.toml ]; then
  39. cd {{invocation_directory()}}
  40. fi
  41. cargo test --lib
  42. # run `cargo clippy` on everything
  43. clippy *ARGS="--locked --offline --workspace --all-targets":
  44. cargo clippy {{ARGS}}
  45. # run `cargo clippy --fix` on everything
  46. clippy-fix *ARGS="--locked --offline --workspace --all-targets":
  47. cargo clippy {{ARGS}} --fix
  48. typos:
  49. typos
  50. # fix all typos
  51. [no-exit-message]
  52. typos-fix:
  53. just typos -w