ci.yml 9.2 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. steps:
  14. - uses: actions/checkout@v4
  15. - name: Check Nix flake inputs
  16. uses: DeterminateSystems/flake-checker-action@v7
  17. with:
  18. fail-mode: true
  19. pre-commit-checks:
  20. name: "Cargo fmt, typos"
  21. runs-on: ubuntu-latest
  22. steps:
  23. - name: checkout
  24. uses: actions/checkout@v4
  25. - name: Install Nix
  26. uses: DeterminateSystems/nix-installer-action@v11
  27. - name: Nix Cache
  28. uses: DeterminateSystems/magic-nix-cache-action@v6
  29. - name: Rust Cache
  30. uses: Swatinem/rust-cache@v2
  31. - name: Cargo fmt
  32. run: |
  33. nix develop -i -L .#nightly --command bash -c '
  34. # Force use of Nix-provided rustfmt
  35. export RUSTFMT=$(command -v rustfmt)
  36. cargo fmt --check
  37. '
  38. - name: typos
  39. run: nix develop -i -L .#nightly --command typos
  40. examples:
  41. name: "Run examples"
  42. runs-on: ubuntu-latest
  43. strategy:
  44. matrix:
  45. build-args:
  46. [
  47. mint-token,
  48. p2pk,
  49. proof-selection,
  50. wallet
  51. ]
  52. steps:
  53. - name: checkout
  54. uses: actions/checkout@v4
  55. - name: Install Nix
  56. uses: DeterminateSystems/nix-installer-action@v11
  57. - name: Nix Cache
  58. uses: DeterminateSystems/magic-nix-cache-action@v6
  59. - name: Rust Cache
  60. uses: Swatinem/rust-cache@v2
  61. - name: Run example
  62. run: nix develop -i -L .#stable --command cargo r --example ${{ matrix.build-args }}
  63. clippy:
  64. name: "Stable build, clippy and test"
  65. runs-on: ubuntu-latest
  66. strategy:
  67. matrix:
  68. build-args:
  69. [
  70. -p cashu,
  71. -p cashu --no-default-features,
  72. -p cashu --no-default-features --features wallet,
  73. -p cashu --no-default-features --features mint,
  74. -p cashu --no-default-features --features "mint swagger",
  75. -p cdk-common,
  76. -p cdk-common --no-default-features,
  77. -p cdk-common --no-default-features --features wallet,
  78. -p cdk-common --no-default-features --features mint,
  79. -p cdk-common --no-default-features --features "mint swagger",
  80. -p cdk,
  81. -p cdk --no-default-features,
  82. -p cdk --no-default-features --features wallet,
  83. -p cdk --no-default-features --features mint,
  84. -p cdk --no-default-features --features "mint swagger",
  85. -p cdk-redb,
  86. -p cdk-sqlite,
  87. -p cdk-axum --no-default-features,
  88. -p cdk-axum --no-default-features --features swagger,
  89. -p cdk-axum --no-default-features --features redis,
  90. -p cdk-axum --no-default-features --features "redis swagger",
  91. -p cdk-axum,
  92. -p cdk-cln,
  93. -p cdk-lnd,
  94. -p cdk-phoenixd,
  95. -p cdk-strike,
  96. -p cdk-lnbits,
  97. -p cdk-fake-wallet,
  98. --bin cdk-cli,
  99. --bin cdk-mintd,
  100. --bin cdk-mintd --no-default-features --features swagger,
  101. --bin cdk-mintd --no-default-features --features redis,
  102. --bin cdk-mintd --no-default-features --features "redis swagger",
  103. ]
  104. steps:
  105. - name: checkout
  106. uses: actions/checkout@v4
  107. - name: Install Nix
  108. uses: DeterminateSystems/nix-installer-action@v11
  109. - name: Nix Cache
  110. uses: DeterminateSystems/magic-nix-cache-action@v6
  111. - name: Rust Cache
  112. uses: Swatinem/rust-cache@v2
  113. - name: Build
  114. run: nix develop -i -L .#stable --command cargo build ${{ matrix.build-args }}
  115. - name: Clippy
  116. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  117. - name: Test
  118. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  119. itest:
  120. name: "Integration regtest tests"
  121. runs-on: ubuntu-latest
  122. strategy:
  123. matrix:
  124. build-args:
  125. [
  126. -p cdk-integration-tests,
  127. ]
  128. database:
  129. [
  130. REDB,
  131. SQLITE,
  132. MEMORY,
  133. ]
  134. steps:
  135. - name: checkout
  136. uses: actions/checkout@v4
  137. - name: Install Nix
  138. uses: DeterminateSystems/nix-installer-action@v11
  139. - name: Nix Cache
  140. uses: DeterminateSystems/magic-nix-cache-action@v6
  141. - name: Rust Cache
  142. uses: Swatinem/rust-cache@v2
  143. - name: Clippy
  144. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  145. - name: Test
  146. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  147. fake-wallet-itest:
  148. name: "Integration fake wallet tests"
  149. runs-on: ubuntu-latest
  150. strategy:
  151. matrix:
  152. build-args:
  153. [
  154. -p cdk-integration-tests,
  155. ]
  156. database:
  157. [
  158. REDB,
  159. SQLITE,
  160. MEMORY,
  161. ]
  162. steps:
  163. - name: checkout
  164. uses: actions/checkout@v4
  165. - name: Install Nix
  166. uses: DeterminateSystems/nix-installer-action@v11
  167. - name: Nix Cache
  168. uses: DeterminateSystems/magic-nix-cache-action@v6
  169. - name: Rust Cache
  170. uses: Swatinem/rust-cache@v2
  171. - name: Clippy
  172. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  173. - name: Test fake mint
  174. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  175. pure-itest:
  176. name: "Integration fake wallet tests"
  177. runs-on: ubuntu-latest
  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: Test fake mint
  188. run: nix develop -i -L .#stable --command just test
  189. msrv-build:
  190. name: "MSRV build"
  191. runs-on: ubuntu-latest
  192. strategy:
  193. matrix:
  194. build-args:
  195. [
  196. -p cashu --no-default-features --features "wallet mint",
  197. -p cdk-common --no-default-features --features "wallet mint",
  198. -p cdk --no-default-features --features "mint mint",
  199. -p cdk-axum,
  200. -p cdk-axum --no-default-features --features redis,
  201. -p cdk-strike,
  202. -p cdk-lnbits,
  203. -p cdk-phoenixd,
  204. -p cdk-fake-wallet,
  205. -p cdk-cln,
  206. ]
  207. steps:
  208. - name: checkout
  209. uses: actions/checkout@v4
  210. - name: Install Nix
  211. uses: DeterminateSystems/nix-installer-action@v11
  212. - name: Nix Cache
  213. uses: DeterminateSystems/magic-nix-cache-action@v6
  214. - name: Rust Cache
  215. uses: Swatinem/rust-cache@v2
  216. - name: Build
  217. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  218. db-msrv-build:
  219. name: "DB MSRV build"
  220. runs-on: ubuntu-latest
  221. strategy:
  222. matrix:
  223. build-args:
  224. [
  225. -p cdk-sqlite,
  226. -p cdk-redb,
  227. ]
  228. steps:
  229. - name: checkout
  230. uses: actions/checkout@v4
  231. - name: Install Nix
  232. uses: DeterminateSystems/nix-installer-action@v11
  233. - name: Nix Cache
  234. uses: DeterminateSystems/magic-nix-cache-action@v6
  235. - name: Rust Cache
  236. uses: Swatinem/rust-cache@v2
  237. - name: Build
  238. run: nix develop -i -L .#db_shell --command cargo build ${{ matrix.build-args }}
  239. check-wasm:
  240. name: Check WASM
  241. runs-on: ubuntu-latest
  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. strategy:
  269. matrix:
  270. rust:
  271. - msrv
  272. target:
  273. - wasm32-unknown-unknown
  274. build-args:
  275. [
  276. -p cdk,
  277. -p cdk --no-default-features,
  278. -p cdk --no-default-features --features wallet,
  279. ]
  280. steps:
  281. - name: checkout
  282. uses: actions/checkout@v4
  283. - name: Install Nix
  284. uses: DeterminateSystems/nix-installer-action@v11
  285. - name: Nix Cache
  286. uses: DeterminateSystems/magic-nix-cache-action@v6
  287. - name: Rust Cache
  288. uses: Swatinem/rust-cache@v2
  289. - name: Build cdk wasm
  290. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}