ci.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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-sqlite --features sqlcipher,
  92. -p cdk-axum --no-default-features,
  93. -p cdk-axum --no-default-features --features swagger,
  94. -p cdk-axum --no-default-features --features redis,
  95. -p cdk-axum --no-default-features --features "redis swagger",
  96. -p cdk-axum,
  97. -p cdk-cln,
  98. -p cdk-lnd,
  99. -p cdk-lnbits,
  100. -p cdk-fake-wallet,
  101. -p cdk-payment-processor,
  102. --bin cdk-cli,
  103. --bin cdk-cli --features sqlcipher,
  104. --bin cdk-mintd,
  105. --bin cdk-mintd --features redis,
  106. --bin cdk-mintd --features redb,
  107. --bin cdk-mintd --features "redis swagger redb",
  108. --bin cdk-mintd --features sqlcipher,
  109. --bin cdk-mintd --no-default-features --features lnd,
  110. --bin cdk-mintd --no-default-features --features cln,
  111. --bin cdk-mintd --no-default-features --features lnbits,
  112. --bin cdk-mintd --no-default-features --features fakewallet,
  113. --bin cdk-mintd --no-default-features --features grpc-processor,
  114. --bin cdk-mintd --no-default-features --features "management-rpc lnd",
  115. --bin cdk-mintd --no-default-features --features "management-rpc cln",
  116. --bin cdk-mintd --no-default-features --features "management-rpc lnbits",
  117. --bin cdk-mintd --no-default-features --features "management-rpc grpc-processor",
  118. --bin cdk-mintd --no-default-features --features "swagger lnd",
  119. --bin cdk-mintd --no-default-features --features "swagger cln",
  120. --bin cdk-mintd --no-default-features --features "swagger lnbits",
  121. --bin cdk-mint-cli,
  122. ]
  123. steps:
  124. - name: checkout
  125. uses: actions/checkout@v4
  126. - name: Install Nix
  127. uses: DeterminateSystems/nix-installer-action@v11
  128. - name: Nix Cache
  129. uses: DeterminateSystems/magic-nix-cache-action@v6
  130. - name: Rust Cache
  131. uses: Swatinem/rust-cache@v2
  132. - name: Clippy
  133. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  134. - name: Test
  135. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  136. itest:
  137. name: "Integration regtest tests"
  138. runs-on: ubuntu-latest
  139. timeout-minutes: 15
  140. strategy:
  141. matrix:
  142. build-args:
  143. [
  144. -p cdk-integration-tests,
  145. ]
  146. database:
  147. [
  148. REDB,
  149. SQLITE,
  150. ]
  151. steps:
  152. - name: checkout
  153. uses: actions/checkout@v4
  154. - name: Install Nix
  155. uses: DeterminateSystems/nix-installer-action@v11
  156. - name: Nix Cache
  157. uses: DeterminateSystems/magic-nix-cache-action@v6
  158. - name: Rust Cache
  159. uses: Swatinem/rust-cache@v2
  160. - name: Clippy
  161. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  162. - name: Test
  163. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  164. fake-wallet-itest:
  165. name: "Integration fake wallet tests"
  166. runs-on: ubuntu-latest
  167. timeout-minutes: 15
  168. strategy:
  169. matrix:
  170. build-args:
  171. [
  172. -p cdk-integration-tests,
  173. ]
  174. database:
  175. [
  176. REDB,
  177. SQLITE,
  178. ]
  179. steps:
  180. - name: checkout
  181. uses: actions/checkout@v4
  182. - name: Install Nix
  183. uses: DeterminateSystems/nix-installer-action@v11
  184. - name: Nix Cache
  185. uses: DeterminateSystems/magic-nix-cache-action@v6
  186. - name: Rust Cache
  187. uses: Swatinem/rust-cache@v2
  188. - name: Clippy
  189. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  190. - name: Test fake mint
  191. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  192. pure-itest:
  193. name: "Integration fake wallet tests"
  194. runs-on: ubuntu-latest
  195. timeout-minutes: 15
  196. steps:
  197. - name: checkout
  198. uses: actions/checkout@v4
  199. - name: Install Nix
  200. uses: DeterminateSystems/nix-installer-action@v11
  201. - name: Nix Cache
  202. uses: DeterminateSystems/magic-nix-cache-action@v6
  203. - name: Rust Cache
  204. uses: Swatinem/rust-cache@v2
  205. - name: Test fake mint
  206. run: nix develop -i -L .#stable --command just test
  207. payment-processor-itests:
  208. name: "Payment processor tests"
  209. runs-on: ubuntu-latest
  210. strategy:
  211. matrix:
  212. ln:
  213. [
  214. FAKEWALLET,
  215. CLN,
  216. LND
  217. ]
  218. steps:
  219. - name: checkout
  220. uses: actions/checkout@v4
  221. - name: Install Nix
  222. uses: DeterminateSystems/nix-installer-action@v11
  223. - name: Nix Cache
  224. uses: DeterminateSystems/magic-nix-cache-action@v6
  225. - name: Rust Cache
  226. uses: Swatinem/rust-cache@v2
  227. - name: Test
  228. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  229. msrv-build:
  230. name: "MSRV build"
  231. runs-on: ubuntu-latest
  232. timeout-minutes: 15
  233. strategy:
  234. matrix:
  235. build-args:
  236. [
  237. -p cashu --no-default-features --features "wallet mint",
  238. -p cdk-common --no-default-features --features "wallet mint",
  239. -p cdk --no-default-features --features "mint mint",
  240. -p cdk-axum,
  241. -p cdk-axum --no-default-features --features redis,
  242. -p cdk-lnbits,
  243. -p cdk-fake-wallet,
  244. -p cdk-cln,
  245. -p cdk-lnd,
  246. -p cdk-mint-rpc,
  247. -p cdk-sqlite,
  248. -p cdk-mintd,
  249. -p cdk-payment-processor --no-default-features,
  250. ]
  251. steps:
  252. - name: checkout
  253. uses: actions/checkout@v4
  254. - name: Install Nix
  255. uses: DeterminateSystems/nix-installer-action@v11
  256. - name: Nix Cache
  257. uses: DeterminateSystems/magic-nix-cache-action@v6
  258. - name: Rust Cache
  259. uses: Swatinem/rust-cache@v2
  260. - name: Build
  261. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  262. check-wasm:
  263. name: Check WASM
  264. runs-on: ubuntu-latest
  265. timeout-minutes: 15
  266. strategy:
  267. matrix:
  268. rust:
  269. - stable
  270. target:
  271. - wasm32-unknown-unknown
  272. build-args:
  273. [
  274. -p cdk,
  275. -p cdk --no-default-features,
  276. -p cdk --no-default-features --features wallet,
  277. ]
  278. steps:
  279. - name: checkout
  280. uses: actions/checkout@v4
  281. - name: Install Nix
  282. uses: DeterminateSystems/nix-installer-action@v11
  283. - name: Nix Cache
  284. uses: DeterminateSystems/magic-nix-cache-action@v6
  285. - name: Rust Cache
  286. uses: Swatinem/rust-cache@v2
  287. - name: Build cdk and binding
  288. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  289. check-wasm-msrv:
  290. name: Check WASM
  291. runs-on: ubuntu-latest
  292. timeout-minutes: 15
  293. strategy:
  294. matrix:
  295. rust:
  296. - msrv
  297. target:
  298. - wasm32-unknown-unknown
  299. build-args:
  300. [
  301. -p cdk,
  302. -p cdk --no-default-features,
  303. -p cdk --no-default-features --features wallet,
  304. ]
  305. steps:
  306. - name: checkout
  307. uses: actions/checkout@v4
  308. - name: Install Nix
  309. uses: DeterminateSystems/nix-installer-action@v11
  310. - name: Nix Cache
  311. uses: DeterminateSystems/magic-nix-cache-action@v6
  312. - name: Rust Cache
  313. uses: Swatinem/rust-cache@v2
  314. - name: Build cdk wasm
  315. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}