ci.yml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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-lnbits,
  100. -p cdk-fake-wallet,
  101. --bin cdk-cli,
  102. --bin cdk-mintd,
  103. --bin cdk-mintd --no-default-features --features swagger,
  104. --bin cdk-mintd --no-default-features --features redis,
  105. --bin cdk-mintd --no-default-features --features "redis swagger",
  106. --bin cdk-mintd --no-default-features --features management-rpc,
  107. --bin cdk-mintd --no-default-features --features redb,
  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-lnbits,
  210. -p cdk-phoenixd,
  211. -p cdk-fake-wallet,
  212. -p cdk-cln,
  213. -p cdk-lnd,
  214. -p cdk-mint-rpc,
  215. -p cdk-sqlite,
  216. -p cdk-mintd,
  217. ]
  218. steps:
  219. - name: checkout
  220. uses: actions/checkout@v4
  221. - name: Install Nix
  222. uses: DeterminateSystems/nix-installer-action@v11
  223. - name: Nix Cache
  224. uses: DeterminateSystems/magic-nix-cache-action@v6
  225. - name: Rust Cache
  226. uses: Swatinem/rust-cache@v2
  227. - name: Build
  228. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  229. check-wasm:
  230. name: Check WASM
  231. runs-on: ubuntu-latest
  232. timeout-minutes: 15
  233. strategy:
  234. matrix:
  235. rust:
  236. - stable
  237. target:
  238. - wasm32-unknown-unknown
  239. build-args:
  240. [
  241. -p cdk,
  242. -p cdk --no-default-features,
  243. -p cdk --no-default-features --features wallet,
  244. ]
  245. steps:
  246. - name: checkout
  247. uses: actions/checkout@v4
  248. - name: Install Nix
  249. uses: DeterminateSystems/nix-installer-action@v11
  250. - name: Nix Cache
  251. uses: DeterminateSystems/magic-nix-cache-action@v6
  252. - name: Rust Cache
  253. uses: Swatinem/rust-cache@v2
  254. - name: Build cdk and binding
  255. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  256. check-wasm-msrv:
  257. name: Check WASM
  258. runs-on: ubuntu-latest
  259. timeout-minutes: 15
  260. strategy:
  261. matrix:
  262. rust:
  263. - msrv
  264. target:
  265. - wasm32-unknown-unknown
  266. build-args:
  267. [
  268. -p cdk,
  269. -p cdk --no-default-features,
  270. -p cdk --no-default-features --features wallet,
  271. ]
  272. steps:
  273. - name: checkout
  274. uses: actions/checkout@v4
  275. - name: Install Nix
  276. uses: DeterminateSystems/nix-installer-action@v11
  277. - name: Nix Cache
  278. uses: DeterminateSystems/magic-nix-cache-action@v6
  279. - name: Rust Cache
  280. uses: Swatinem/rust-cache@v2
  281. - name: Build cdk wasm
  282. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}