justfile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 doc 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 mint
  42. # run doc tests
  43. test-pure db="memory": build
  44. #!/usr/bin/env bash
  45. set -euo pipefail
  46. if [ ! -f Cargo.toml ]; then
  47. cd {{invocation_directory()}}
  48. fi
  49. # Run pure integration tests
  50. CDK_TEST_DB_TYPE={{db}} cargo test -p cdk-integration-tests --test integration_tests_pure
  51. test-all db="memory":
  52. #!/usr/bin/env bash
  53. just test {{db}}
  54. ./misc/itests.sh "{{db}}"
  55. ./misc/fake_itests.sh "{{db}}"
  56. # run `cargo clippy` on everything
  57. clippy *ARGS="--locked --offline --workspace --all-targets":
  58. cargo clippy {{ARGS}}
  59. # run `cargo clippy --fix` on everything
  60. clippy-fix *ARGS="--locked --offline --workspace --all-targets":
  61. cargo clippy {{ARGS}} --fix
  62. typos:
  63. typos
  64. # fix all typos
  65. [no-exit-message]
  66. typos-fix:
  67. just typos -w
  68. itest db:
  69. #!/usr/bin/env bash
  70. ./misc/itests.sh "{{db}}"
  71. fake-mint-itest db:
  72. #!/usr/bin/env bash
  73. ./misc/fake_itests.sh "{{db}}"
  74. itest-payment-processor ln:
  75. #!/usr/bin/env bash
  76. ./misc/mintd_payment_processor.sh "{{ln}}"
  77. fake-auth-mint-itest db openid_discovery:
  78. #!/usr/bin/env bash
  79. ./misc/fake_auth_itests.sh "{{db}}" "{{openid_discovery}}"
  80. run-examples:
  81. cargo r --example p2pk
  82. cargo r --example mint-token
  83. cargo r --example melt-token
  84. cargo r --example proof_selection
  85. cargo r --example wallet
  86. check-wasm *ARGS="--target wasm32-unknown-unknown":
  87. #!/usr/bin/env bash
  88. set -euo pipefail
  89. if [ ! -f Cargo.toml ]; then
  90. cd {{invocation_directory()}}
  91. fi
  92. buildargs=(
  93. "-p cdk"
  94. "-p cdk --no-default-features"
  95. "-p cdk --no-default-features --features wallet"
  96. "-p cdk --no-default-features --features mint"
  97. )
  98. for arg in "${buildargs[@]}"; do
  99. echo "Checking '$arg'"
  100. cargo check $arg {{ARGS}}
  101. echo
  102. done
  103. release m="":
  104. #!/usr/bin/env bash
  105. set -euo pipefail
  106. args=(
  107. "-p cashu"
  108. "-p cdk-common"
  109. "-p cdk-sqlite"
  110. "-p cdk-redb"
  111. "-p cdk"
  112. "-p cdk-rexie"
  113. "-p cdk-axum"
  114. "-p cdk-mint-rpc"
  115. "-p cdk-cln"
  116. "-p cdk-lnd"
  117. "-p cdk-lnbits"
  118. "-p cdk-fake-wallet"
  119. "-p cdk-payment-processor"
  120. "-p cdk-cli"
  121. "-p cdk-mintd"
  122. )
  123. for arg in "${args[@]}";
  124. do
  125. echo "Publishing '$arg'"
  126. cargo publish $arg {{m}}
  127. echo
  128. done
  129. check-docs:
  130. #!/usr/bin/env bash
  131. set -euo pipefail
  132. args=(
  133. "-p cashu"
  134. "-p cdk-common"
  135. "-p cdk"
  136. "-p cdk-redb"
  137. "-p cdk-sqlite"
  138. "-p cdk-axum"
  139. "-p cdk-rexie"
  140. "-p cdk-cln"
  141. "-p cdk-lnd"
  142. "-p cdk-lnbits"
  143. "-p cdk-fake-wallet"
  144. "-p cdk-mint-rpc"
  145. "-p cdk-cli"
  146. "-p cdk-mintd"
  147. )
  148. for arg in "${args[@]}"; do
  149. echo "Checking '$arg' docs"
  150. cargo doc $arg --all-features
  151. echo
  152. done
  153. # Build docs for all crates and error on warnings
  154. docs-strict:
  155. #!/usr/bin/env bash
  156. set -euo pipefail
  157. args=(
  158. "-p cashu"
  159. "-p cdk-common"
  160. "-p cdk"
  161. "-p cdk-redb"
  162. "-p cdk-sqlite"
  163. "-p cdk-axum"
  164. "-p cdk-rexie"
  165. "-p cdk-cln"
  166. "-p cdk-lnd"
  167. "-p cdk-lnbits"
  168. "-p cdk-fake-wallet"
  169. "-p cdk-mint-rpc"
  170. "-p cdk-payment-processor"
  171. "-p cdk-cli"
  172. "-p cdk-mintd"
  173. )
  174. for arg in "${args[@]}"; do
  175. echo "Building docs for $arg with strict warnings"
  176. RUSTDOCFLAGS="-D warnings" cargo doc $arg --all-features --no-deps
  177. echo
  178. done