justfile 2.5 KB

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