ci.yml 11 KB

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