justfile 4.4 KB

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