ci.yml 9.6 KB

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