justfile 3.3 KB

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