ci.yml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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 --features redis,
  103. --bin cdk-mintd --features redb,
  104. --bin cdk-mintd --features "redis swagger redb",
  105. --bin cdk-mintd --no-default-features --features lnd,
  106. --bin cdk-mintd --no-default-features --features cln,
  107. --bin cdk-mintd --no-default-features --features lnbits,
  108. --bin cdk-mintd --no-default-features --features fakewallet,
  109. --bin cdk-mintd --no-default-features --features "management-rpc lnd",
  110. --bin cdk-mintd --no-default-features --features "management-rpc cln",
  111. --bin cdk-mintd --no-default-features --features "management-rpc lnbits",
  112. --bin cdk-mintd --no-default-features --features "swagger lnd",
  113. --bin cdk-mintd --no-default-features --features "swagger cln",
  114. --bin cdk-mintd --no-default-features --features "swagger lnbits",
  115. --bin cdk-mint-cli,
  116. ]
  117. steps:
  118. - name: checkout
  119. uses: actions/checkout@v4
  120. - name: Install Nix
  121. uses: DeterminateSystems/nix-installer-action@v11
  122. - name: Nix Cache
  123. uses: DeterminateSystems/magic-nix-cache-action@v6
  124. - name: Rust Cache
  125. uses: Swatinem/rust-cache@v2
  126. - name: Build
  127. run: nix develop -i -L .#stable --command cargo build ${{ matrix.build-args }}
  128. - name: Clippy
  129. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  130. - name: Test
  131. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  132. itest:
  133. name: "Integration regtest tests"
  134. runs-on: ubuntu-latest
  135. timeout-minutes: 15
  136. strategy:
  137. matrix:
  138. build-args:
  139. [
  140. -p cdk-integration-tests,
  141. ]
  142. database:
  143. [
  144. REDB,
  145. SQLITE,
  146. ]
  147. steps:
  148. - name: checkout
  149. uses: actions/checkout@v4
  150. - name: Install Nix
  151. uses: DeterminateSystems/nix-installer-action@v11
  152. - name: Nix Cache
  153. uses: DeterminateSystems/magic-nix-cache-action@v6
  154. - name: Rust Cache
  155. uses: Swatinem/rust-cache@v2
  156. - name: Clippy
  157. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  158. - name: Test
  159. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  160. fake-wallet-itest:
  161. name: "Integration fake wallet tests"
  162. runs-on: ubuntu-latest
  163. timeout-minutes: 15
  164. strategy:
  165. matrix:
  166. build-args:
  167. [
  168. -p cdk-integration-tests,
  169. ]
  170. database:
  171. [
  172. REDB,
  173. SQLITE,
  174. ]
  175. steps:
  176. - name: checkout
  177. uses: actions/checkout@v4
  178. - name: Install Nix
  179. uses: DeterminateSystems/nix-installer-action@v11
  180. - name: Nix Cache
  181. uses: DeterminateSystems/magic-nix-cache-action@v6
  182. - name: Rust Cache
  183. uses: Swatinem/rust-cache@v2
  184. - name: Clippy
  185. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  186. - name: Test fake mint
  187. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  188. pure-itest:
  189. name: "Integration fake wallet tests"
  190. runs-on: ubuntu-latest
  191. timeout-minutes: 15
  192. steps:
  193. - name: checkout
  194. uses: actions/checkout@v4
  195. - name: Install Nix
  196. uses: DeterminateSystems/nix-installer-action@v11
  197. - name: Nix Cache
  198. uses: DeterminateSystems/magic-nix-cache-action@v6
  199. - name: Rust Cache
  200. uses: Swatinem/rust-cache@v2
  201. - name: Test fake mint
  202. run: nix develop -i -L .#stable --command just test
  203. msrv-build:
  204. name: "MSRV build"
  205. runs-on: ubuntu-latest
  206. timeout-minutes: 15
  207. strategy:
  208. matrix:
  209. build-args:
  210. [
  211. -p cashu --no-default-features --features "wallet mint",
  212. -p cdk-common --no-default-features --features "wallet mint",
  213. -p cdk --no-default-features --features "mint mint",
  214. -p cdk-axum,
  215. -p cdk-axum --no-default-features --features redis,
  216. -p cdk-lnbits,
  217. -p cdk-fake-wallet,
  218. -p cdk-cln,
  219. -p cdk-lnd,
  220. -p cdk-mint-rpc,
  221. -p cdk-sqlite,
  222. -p cdk-mintd,
  223. ]
  224. steps:
  225. - name: checkout
  226. uses: actions/checkout@v4
  227. - name: Install Nix
  228. uses: DeterminateSystems/nix-installer-action@v11
  229. - name: Nix Cache
  230. uses: DeterminateSystems/magic-nix-cache-action@v6
  231. - name: Rust Cache
  232. uses: Swatinem/rust-cache@v2
  233. - name: Build
  234. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  235. check-wasm:
  236. name: Check WASM
  237. runs-on: ubuntu-latest
  238. timeout-minutes: 15
  239. strategy:
  240. matrix:
  241. rust:
  242. - stable
  243. target:
  244. - wasm32-unknown-unknown
  245. build-args:
  246. [
  247. -p cdk,
  248. -p cdk --no-default-features,
  249. -p cdk --no-default-features --features wallet,
  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 cdk and binding
  261. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  262. check-wasm-msrv:
  263. name: Check WASM
  264. runs-on: ubuntu-latest
  265. timeout-minutes: 15
  266. strategy:
  267. matrix:
  268. rust:
  269. - msrv
  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 wasm
  288. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}