justfile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. alias b := build
  2. alias c := check
  3. alias t := test
  4. default:
  5. @just --list
  6. final-check: typos format clippy test
  7. # run `cargo build` on everything
  8. build *ARGS="--workspace --all-targets":
  9. #!/usr/bin/env bash
  10. set -euo pipefail
  11. if [ ! -f Cargo.toml ]; then
  12. cd {{invocation_directory()}}
  13. fi
  14. cargo build {{ARGS}}
  15. # run `cargo check` on everything
  16. check *ARGS="--workspace --all-targets":
  17. #!/usr/bin/env bash
  18. set -euo pipefail
  19. if [ ! -f Cargo.toml ]; then
  20. cd {{invocation_directory()}}
  21. fi
  22. cargo check {{ARGS}}
  23. # run code formatters
  24. format:
  25. #!/usr/bin/env bash
  26. set -euo pipefail
  27. if [ ! -f Cargo.toml ]; then
  28. cd {{invocation_directory()}}
  29. fi
  30. cargo fmt --all
  31. nixpkgs-fmt $(echo **.nix)
  32. # run tests
  33. test: build
  34. #!/usr/bin/env bash
  35. set -euo pipefail
  36. if [ ! -f Cargo.toml ]; then
  37. cd {{invocation_directory()}}
  38. fi
  39. cargo test --lib
  40. # Run pure integration tests
  41. cargo test -p cdk-integration-tests --test integration_tests_pure
  42. cargo test -p cdk-integration-tests --test mint
  43. # run `cargo clippy` on everything
  44. clippy *ARGS="--locked --offline --workspace --all-targets":
  45. cargo clippy {{ARGS}}
  46. # run `cargo clippy --fix` on everything
  47. clippy-fix *ARGS="--locked --offline --workspace --all-targets":
  48. cargo clippy {{ARGS}} --fix
  49. typos:
  50. typos
  51. # fix all typos
  52. [no-exit-message]
  53. typos-fix:
  54. just typos -w
  55. itest db:
  56. #!/usr/bin/env bash
  57. ./misc/itests.sh "{{db}}"
  58. fake-mint-itest db:
  59. #!/usr/bin/env bash
  60. ./misc/fake_itests.sh "{{db}}"
  61. itest-payment-processor ln:
  62. #!/usr/bin/env bash
  63. ./misc/mintd_payment_processor.sh "{{ln}}"
  64. run-examples:
  65. cargo r --example p2pk
  66. cargo r --example mint-token
  67. cargo r --example proof_selection
  68. cargo r --example wallet
  69. check-wasm *ARGS="--target wasm32-unknown-unknown":
  70. #!/usr/bin/env bash
  71. set -euo pipefail
  72. if [ ! -f Cargo.toml ]; then
  73. cd {{invocation_directory()}}
  74. fi
  75. buildargs=(
  76. "-p cdk"
  77. "-p cdk --no-default-features"
  78. "-p cdk --no-default-features --features wallet"
  79. "-p cdk --no-default-features --features mint"
  80. )
  81. for arg in "${buildargs[@]}"; do
  82. echo "Checking '$arg'"
  83. cargo check $arg {{ARGS}}
  84. echo
  85. done
  86. release m="":
  87. #!/usr/bin/env bash
  88. set -euo pipefail
  89. args=(
  90. "-p cashu"
  91. "-p cdk-common"
  92. "-p cdk"
  93. "-p cdk-redb"
  94. "-p cdk-sqlite"
  95. "-p cdk-rexie"
  96. "-p cdk-axum"
  97. "-p cdk-mint-rpc"
  98. "-p cdk-cln"
  99. "-p cdk-lnd"
  100. "-p cdk-strike"
  101. "-p cdk-phoenixd"
  102. "-p cdk-lnbits"
  103. "-p cdk-fake-wallet"
  104. "-p cdk-cli"
  105. "-p cdk-mintd"
  106. )
  107. for arg in "${args[@]}";
  108. do
  109. echo "Publishing '$arg'"
  110. cargo publish $arg {{m}}
  111. echo
  112. done
  113. check-docs:
  114. #!/usr/bin/env bash
  115. set -euo pipefail
  116. args=(
  117. "-p cashu"
  118. "-p cdk-common"
  119. "-p cdk"
  120. "-p cdk-redb"
  121. "-p cdk-sqlite"
  122. "-p cdk-axum"
  123. "-p cdk-rexie"
  124. "-p cdk-cln"
  125. "-p cdk-lnd"
  126. "-p cdk-strike"
  127. "-p cdk-phoenixd"
  128. "-p cdk-lnbits"
  129. "-p cdk-fake-wallet"
  130. "-p cdk-mint-rpc"
  131. "-p cdk-cli"
  132. "-p cdk-mintd"
  133. )
  134. for arg in "${args[@]}"; do
  135. echo "Checking '$arg' docs"
  136. cargo doc $arg --all-features
  137. echo
  138. done