ci.yml 9.5 KB

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