ci.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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: Debug SQLite vesion
  195. run: grep -C 3 "sqlite" Cargo.lock
  196. - name: Test fake mint
  197. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  198. pure-itest:
  199. name: "Integration fake wallet tests"
  200. runs-on: ubuntu-latest
  201. timeout-minutes: 15
  202. needs: [pre-commit-checks, clippy]
  203. steps:
  204. - name: checkout
  205. uses: actions/checkout@v4
  206. - name: Install Nix
  207. uses: DeterminateSystems/nix-installer-action@v11
  208. - name: Nix Cache
  209. uses: DeterminateSystems/magic-nix-cache-action@v6
  210. - name: Rust Cache
  211. uses: Swatinem/rust-cache@v2
  212. - name: Test fake mint
  213. run: nix develop -i -L .#stable --command just test
  214. payment-processor-itests:
  215. name: "Payment processor tests"
  216. runs-on: ubuntu-latest
  217. timeout-minutes: 15
  218. needs: [pre-commit-checks, clippy, pure-itest, fake-wallet-itest, itest]
  219. strategy:
  220. matrix:
  221. ln:
  222. [
  223. FAKEWALLET,
  224. CLN,
  225. LND
  226. ]
  227. steps:
  228. - name: checkout
  229. uses: actions/checkout@v4
  230. - name: Install Nix
  231. uses: DeterminateSystems/nix-installer-action@v11
  232. - name: Nix Cache
  233. uses: DeterminateSystems/magic-nix-cache-action@v6
  234. - name: Rust Cache
  235. uses: Swatinem/rust-cache@v2
  236. - name: Test
  237. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  238. msrv-build:
  239. name: "MSRV build"
  240. runs-on: ubuntu-latest
  241. timeout-minutes: 15
  242. needs: [pre-commit-checks, clippy, pure-itest]
  243. strategy:
  244. matrix:
  245. build-args:
  246. [
  247. -p cashu --no-default-features --features "wallet mint",
  248. -p cdk-common --no-default-features --features "wallet mint",
  249. -p cdk --no-default-features --features "mint mint",
  250. -p cdk-axum,
  251. -p cdk-axum --no-default-features --features redis,
  252. -p cdk-lnbits,
  253. -p cdk-fake-wallet,
  254. -p cdk-cln,
  255. -p cdk-lnd,
  256. -p cdk-mint-rpc,
  257. -p cdk-sqlite,
  258. -p cdk-mintd,
  259. -p cdk-payment-processor --no-default-features,
  260. ]
  261. steps:
  262. - name: checkout
  263. uses: actions/checkout@v4
  264. - name: Install Nix
  265. uses: DeterminateSystems/nix-installer-action@v11
  266. - name: Nix Cache
  267. uses: DeterminateSystems/magic-nix-cache-action@v6
  268. - name: Rust Cache
  269. uses: Swatinem/rust-cache@v2
  270. - name: Build
  271. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  272. check-wasm:
  273. name: Check WASM
  274. runs-on: ubuntu-latest
  275. timeout-minutes: 15
  276. needs: [pre-commit-checks, clippy, pure-itest]
  277. strategy:
  278. matrix:
  279. rust:
  280. - stable
  281. target:
  282. - wasm32-unknown-unknown
  283. build-args:
  284. [
  285. -p cdk,
  286. -p cdk --no-default-features,
  287. -p cdk --no-default-features --features wallet,
  288. ]
  289. steps:
  290. - name: checkout
  291. uses: actions/checkout@v4
  292. - name: Install Nix
  293. uses: DeterminateSystems/nix-installer-action@v11
  294. - name: Nix Cache
  295. uses: DeterminateSystems/magic-nix-cache-action@v6
  296. - name: Rust Cache
  297. uses: Swatinem/rust-cache@v2
  298. - name: Build cdk and binding
  299. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  300. check-wasm-msrv:
  301. name: Check WASM
  302. runs-on: ubuntu-latest
  303. timeout-minutes: 15
  304. needs: [pre-commit-checks, clippy, msrv-build]
  305. strategy:
  306. matrix:
  307. rust:
  308. - msrv
  309. target:
  310. - wasm32-unknown-unknown
  311. build-args:
  312. [
  313. -p cdk,
  314. -p cdk --no-default-features,
  315. -p cdk --no-default-features --features wallet,
  316. ]
  317. steps:
  318. - name: checkout
  319. uses: actions/checkout@v4
  320. - name: Install Nix
  321. uses: DeterminateSystems/nix-installer-action@v11
  322. - name: Nix Cache
  323. uses: DeterminateSystems/magic-nix-cache-action@v6
  324. - name: Rust Cache
  325. uses: Swatinem/rust-cache@v2
  326. - name: Build cdk wasm
  327. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}