ci.yml 9.5 KB

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