justfile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
  2. alias b := build
  3. alias c := check
  4. alias t := test
  5. [private]
  6. default:
  7. @just --list
  8. # run `cargo build` on everything
  9. build *ARGS="--workspace --all-targets":
  10. #!/usr/bin/env bash
  11. set -euo pipefail
  12. if [ ! -f Cargo.toml ]; then
  13. cd {{invocation_directory()}}
  14. fi
  15. cargo build {{ARGS}}
  16. # run `cargo check` on everything
  17. check *ARGS="--workspace --all-targets":
  18. #!/usr/bin/env bash
  19. set -euo pipefail
  20. if [ ! -f Cargo.toml ]; then
  21. cd {{invocation_directory()}}
  22. fi
  23. cargo check {{ARGS}}
  24. # run all checks recommended before opening a PR
  25. final-check: lint clippy
  26. #!/usr/bin/env bash
  27. set -euo pipefail
  28. if [ ! -f Cargo.toml ]; then
  29. cd {{invocation_directory()}}
  30. fi
  31. cargo test --doc
  32. just test
  33. # run code formatters
  34. format:
  35. #!/usr/bin/env bash
  36. set -euo pipefail
  37. if [ ! -f Cargo.toml ]; then
  38. cd {{invocation_directory()}}
  39. fi
  40. cargo fmt --all
  41. nixpkgs-fmt $(echo **.nix)
  42. # run lints (git pre-commit hook)
  43. lint:
  44. #!/usr/bin/env bash
  45. set -euo pipefail
  46. env NO_STASH=true $(git rev-parse --git-common-dir)/hooks/pre-commit
  47. # run tests
  48. test: build
  49. #!/usr/bin/env bash
  50. set -euo pipefail
  51. if [ ! -f Cargo.toml ]; then
  52. cd {{invocation_directory()}}
  53. fi
  54. cargo test
  55. # run and restart on changes
  56. watch *ARGS="-x run":
  57. #!/usr/bin/env bash
  58. set -euo pipefail
  59. if [ ! -f Cargo.toml ]; then
  60. cd {{invocation_directory()}}
  61. fi
  62. env RUST_LOG=${RUST_LOG:-debug} cargo watch {{ARGS}}
  63. # run `cargo clippy` on everything
  64. clippy *ARGS="--locked --offline --workspace --all-targets":
  65. cargo clippy {{ARGS}} -- --deny warnings --allow deprecated
  66. # run `cargo clippy --fix` on everything
  67. clippy-fix *ARGS="--locked --offline --workspace --all-targets":
  68. cargo clippy {{ARGS}} --fix
  69. # run `semgrep`
  70. semgrep:
  71. env SEMGREP_ENABLE_VERSION_CHECK=0 \
  72. semgrep --error --no-rewrite-rule-ids --config .config/semgrep.yaml
  73. # check typos
  74. [no-exit-message]
  75. typos *PARAMS:
  76. #!/usr/bin/env bash
  77. set -eo pipefail
  78. export FLAKEBOX_GIT_LS
  79. FLAKEBOX_GIT_LS="$(git ls-files)"
  80. export FLAKEBOX_GIT_LS_TEXT
  81. FLAKEBOX_GIT_LS_TEXT="$(echo "$FLAKEBOX_GIT_LS" | grep -v -E "^db/|\.(png|ods|jpg|jpeg|woff2|keystore|wasm|ttf|jar|ico)\$")"
  82. if ! echo "$FLAKEBOX_GIT_LS_TEXT" | typos {{PARAMS}} --file-list - --force-exclude ; then
  83. >&2 echo "Typos found: Valid new words can be added to '.typos.toml'"
  84. return 1
  85. fi
  86. # fix all typos
  87. [no-exit-message]
  88. typos-fix-all:
  89. just typos -w
  90. # THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION