ci.yml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. self-care:
  11. name: Flake self-check
  12. runs-on: ubuntu-latest
  13. timeout-minutes: 15
  14. steps:
  15. - uses: actions/checkout@v4
  16. - name: Check Nix flake inputs
  17. uses: DeterminateSystems/flake-checker-action@v7
  18. with:
  19. fail-mode: true
  20. pre-commit-checks:
  21. name: "Cargo fmt, typos"
  22. runs-on: ubuntu-latest
  23. timeout-minutes: 15
  24. steps:
  25. - name: checkout
  26. uses: actions/checkout@v4
  27. - name: Install Nix
  28. uses: DeterminateSystems/nix-installer-action@v11
  29. - name: Nix Cache
  30. uses: DeterminateSystems/magic-nix-cache-action@v6
  31. - name: Rust Cache
  32. uses: Swatinem/rust-cache@v2
  33. - name: Cargo fmt
  34. run: |
  35. nix develop -i -L .#nightly --command bash -c '
  36. # Force use of Nix-provided rustfmt
  37. export RUSTFMT=$(command -v rustfmt)
  38. cargo fmt --check
  39. '
  40. - name: typos
  41. run: nix develop -i -L .#nightly --command typos
  42. examples:
  43. name: "Run examples"
  44. runs-on: ubuntu-latest
  45. timeout-minutes: 15
  46. strategy:
  47. matrix:
  48. build-args:
  49. [
  50. mint-token,
  51. p2pk,
  52. proof-selection,
  53. wallet
  54. ]
  55. steps:
  56. - name: checkout
  57. uses: actions/checkout@v4
  58. - name: Install Nix
  59. uses: DeterminateSystems/nix-installer-action@v11
  60. - name: Nix Cache
  61. uses: DeterminateSystems/magic-nix-cache-action@v6
  62. - name: Rust Cache
  63. uses: Swatinem/rust-cache@v2
  64. - name: Run example
  65. run: nix develop -i -L .#stable --command cargo r --example ${{ matrix.build-args }}
  66. clippy:
  67. name: "Stable build, clippy and test"
  68. runs-on: ubuntu-latest
  69. timeout-minutes: 15
  70. strategy:
  71. matrix:
  72. build-args:
  73. [
  74. -p cashu,
  75. -p cashu --no-default-features,
  76. -p cashu --no-default-features --features wallet,
  77. -p cashu --no-default-features --features mint,
  78. -p cashu --no-default-features --features "mint swagger",
  79. -p cdk-common,
  80. -p cdk-common --no-default-features,
  81. -p cdk-common --no-default-features --features wallet,
  82. -p cdk-common --no-default-features --features mint,
  83. -p cdk-common --no-default-features --features "mint swagger",
  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. -p cdk --no-default-features --features "mint swagger",
  89. -p cdk-redb,
  90. -p cdk-sqlite,
  91. -p cdk-axum --no-default-features,
  92. -p cdk-axum --no-default-features --features swagger,
  93. -p cdk-axum --no-default-features --features redis,
  94. -p cdk-axum --no-default-features --features "redis swagger",
  95. -p cdk-axum,
  96. -p cdk-cln,
  97. -p cdk-lnd,
  98. -p cdk-lnbits,
  99. -p cdk-fake-wallet,
  100. --bin cdk-cli,
  101. --bin cdk-mintd,
  102. --bin cdk-mintd --no-default-features --features swagger,
  103. --bin cdk-mintd --no-default-features --features redis,
  104. --bin cdk-mintd --no-default-features --features "redis swagger",
  105. --bin cdk-mintd --no-default-features --features management-rpc,
  106. --bin cdk-mintd --no-default-features --features redb,
  107. --bin cdk-mint-cli,
  108. ]
  109. steps:
  110. - name: checkout
  111. uses: actions/checkout@v4
  112. - name: Install Nix
  113. uses: DeterminateSystems/nix-installer-action@v11
  114. - name: Nix Cache
  115. uses: DeterminateSystems/magic-nix-cache-action@v6
  116. - name: Rust Cache
  117. uses: Swatinem/rust-cache@v2
  118. - name: Build
  119. run: nix develop -i -L .#stable --command cargo build ${{ matrix.build-args }}
  120. - name: Clippy
  121. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  122. - name: Test
  123. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  124. itest:
  125. name: "Integration regtest tests"
  126. runs-on: ubuntu-latest
  127. timeout-minutes: 15
  128. strategy:
  129. matrix:
  130. build-args:
  131. [
  132. -p cdk-integration-tests,
  133. ]
  134. database:
  135. [
  136. REDB,
  137. SQLITE,
  138. ]
  139. steps:
  140. - name: checkout
  141. uses: actions/checkout@v4
  142. - name: Install Nix
  143. uses: DeterminateSystems/nix-installer-action@v11
  144. - name: Nix Cache
  145. uses: DeterminateSystems/magic-nix-cache-action@v6
  146. - name: Rust Cache
  147. uses: Swatinem/rust-cache@v2
  148. - name: Clippy
  149. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  150. - name: Test
  151. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  152. fake-wallet-itest:
  153. name: "Integration fake wallet tests"
  154. runs-on: ubuntu-latest
  155. timeout-minutes: 15
  156. strategy:
  157. matrix:
  158. build-args:
  159. [
  160. -p cdk-integration-tests,
  161. ]
  162. database:
  163. [
  164. REDB,
  165. SQLITE,
  166. ]
  167. steps:
  168. - name: checkout
  169. uses: actions/checkout@v4
  170. - name: Install Nix
  171. uses: DeterminateSystems/nix-installer-action@v11
  172. - name: Nix Cache
  173. uses: DeterminateSystems/magic-nix-cache-action@v6
  174. - name: Rust Cache
  175. uses: Swatinem/rust-cache@v2
  176. - name: Clippy
  177. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  178. - name: Test fake mint
  179. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  180. pure-itest:
  181. name: "Integration fake wallet tests"
  182. runs-on: ubuntu-latest
  183. timeout-minutes: 15
  184. steps:
  185. - name: checkout
  186. uses: actions/checkout@v4
  187. - name: Install Nix
  188. uses: DeterminateSystems/nix-installer-action@v11
  189. - name: Nix Cache
  190. uses: DeterminateSystems/magic-nix-cache-action@v6
  191. - name: Rust Cache
  192. uses: Swatinem/rust-cache@v2
  193. - name: Test fake mint
  194. run: nix develop -i -L .#stable --command just test
  195. msrv-build:
  196. name: "MSRV build"
  197. runs-on: ubuntu-latest
  198. timeout-minutes: 15
  199. strategy:
  200. matrix:
  201. build-args:
  202. [
  203. -p cashu --no-default-features --features "wallet mint",
  204. -p cdk-common --no-default-features --features "wallet mint",
  205. -p cdk --no-default-features --features "mint mint",
  206. -p cdk-axum,
  207. -p cdk-axum --no-default-features --features redis,
  208. -p cdk-lnbits,
  209. -p cdk-fake-wallet,
  210. -p cdk-cln,
  211. -p cdk-lnd,
  212. -p cdk-mint-rpc,
  213. -p cdk-sqlite,
  214. -p cdk-mintd,
  215. ]
  216. steps:
  217. - name: checkout
  218. uses: actions/checkout@v4
  219. - name: Install Nix
  220. uses: DeterminateSystems/nix-installer-action@v11
  221. - name: Nix Cache
  222. uses: DeterminateSystems/magic-nix-cache-action@v6
  223. - name: Rust Cache
  224. uses: Swatinem/rust-cache@v2
  225. - name: Build
  226. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  227. check-wasm:
  228. name: Check WASM
  229. runs-on: ubuntu-latest
  230. timeout-minutes: 15
  231. strategy:
  232. matrix:
  233. rust:
  234. - stable
  235. target:
  236. - wasm32-unknown-unknown
  237. build-args:
  238. [
  239. -p cdk,
  240. -p cdk --no-default-features,
  241. -p cdk --no-default-features --features wallet,
  242. ]
  243. steps:
  244. - name: checkout
  245. uses: actions/checkout@v4
  246. - name: Install Nix
  247. uses: DeterminateSystems/nix-installer-action@v11
  248. - name: Nix Cache
  249. uses: DeterminateSystems/magic-nix-cache-action@v6
  250. - name: Rust Cache
  251. uses: Swatinem/rust-cache@v2
  252. - name: Build cdk and binding
  253. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  254. check-wasm-msrv:
  255. name: Check WASM
  256. runs-on: ubuntu-latest
  257. timeout-minutes: 15
  258. strategy:
  259. matrix:
  260. rust:
  261. - msrv
  262. target:
  263. - wasm32-unknown-unknown
  264. build-args:
  265. [
  266. -p cdk,
  267. -p cdk --no-default-features,
  268. -p cdk --no-default-features --features wallet,
  269. ]
  270. steps:
  271. - name: checkout
  272. uses: actions/checkout@v4
  273. - name: Install Nix
  274. uses: DeterminateSystems/nix-installer-action@v11
  275. - name: Nix Cache
  276. uses: DeterminateSystems/magic-nix-cache-action@v6
  277. - name: Rust Cache
  278. uses: Swatinem/rust-cache@v2
  279. - name: Build cdk wasm
  280. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}