ci.yml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. clippy:
  41. name: "Stable build, clippy and test"
  42. runs-on: ubuntu-latest
  43. strategy:
  44. matrix:
  45. build-args:
  46. [
  47. -p cdk,
  48. -p cdk --no-default-features,
  49. -p cdk --no-default-features --features wallet,
  50. -p cdk --no-default-features --features mint,
  51. -p cdk --no-default-features --features "mint swagger",
  52. -p cdk-redb,
  53. -p cdk-sqlite,
  54. -p cdk-axum --no-default-features,
  55. -p cdk-axum --no-default-features --features swagger,
  56. -p cdk-axum --no-default-features --features redis,
  57. -p cdk-axum --no-default-features --features "redis swagger",
  58. -p cdk-axum,
  59. -p cdk-cln,
  60. -p cdk-lnd,
  61. -p cdk-phoenixd,
  62. -p cdk-strike,
  63. -p cdk-lnbits,
  64. -p cdk-fake-wallet,
  65. --bin cdk-cli,
  66. --bin cdk-mintd,
  67. --bin cdk-mintd --no-default-features --features swagger,
  68. --bin cdk-mintd --no-default-features --features redis,
  69. --bin cdk-mintd --no-default-features --features "redis swagger",
  70. ]
  71. steps:
  72. - name: checkout
  73. uses: actions/checkout@v4
  74. - name: Install Nix
  75. uses: DeterminateSystems/nix-installer-action@v11
  76. - name: Nix Cache
  77. uses: DeterminateSystems/magic-nix-cache-action@v6
  78. - name: Rust Cache
  79. uses: Swatinem/rust-cache@v2
  80. - name: Build
  81. run: nix develop -i -L .#stable --command cargo build ${{ matrix.build-args }}
  82. - name: Clippy
  83. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  84. - name: Test
  85. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  86. itest:
  87. name: "Integration regtest tests"
  88. runs-on: ubuntu-latest
  89. strategy:
  90. matrix:
  91. build-args:
  92. [
  93. -p cdk-integration-tests,
  94. ]
  95. database:
  96. [
  97. REDB,
  98. SQLITE,
  99. MEMORY,
  100. ]
  101. steps:
  102. - name: checkout
  103. uses: actions/checkout@v4
  104. - name: Install Nix
  105. uses: DeterminateSystems/nix-installer-action@v11
  106. - name: Nix Cache
  107. uses: DeterminateSystems/magic-nix-cache-action@v6
  108. - name: Rust Cache
  109. uses: Swatinem/rust-cache@v2
  110. - name: Clippy
  111. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  112. - name: Test
  113. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  114. fake-wallet-itest:
  115. name: "Integration fake wallet tests"
  116. runs-on: ubuntu-latest
  117. strategy:
  118. matrix:
  119. build-args:
  120. [
  121. -p cdk-integration-tests,
  122. ]
  123. database:
  124. [
  125. REDB,
  126. SQLITE,
  127. MEMORY,
  128. ]
  129. steps:
  130. - name: checkout
  131. uses: actions/checkout@v4
  132. - name: Install Nix
  133. uses: DeterminateSystems/nix-installer-action@v11
  134. - name: Nix Cache
  135. uses: DeterminateSystems/magic-nix-cache-action@v6
  136. - name: Rust Cache
  137. uses: Swatinem/rust-cache@v2
  138. - name: Clippy
  139. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  140. - name: Test fake mint
  141. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  142. msrv-build:
  143. name: "MSRV build"
  144. runs-on: ubuntu-latest
  145. strategy:
  146. matrix:
  147. build-args:
  148. [
  149. -p cdk,
  150. -p cdk --no-default-features,
  151. -p cdk --no-default-features --features wallet,
  152. -p cdk --no-default-features --features mint,
  153. -p cdk-axum,
  154. -p cdk-axum --no-default-features --features redis,
  155. -p cdk-strike,
  156. -p cdk-lnbits,
  157. -p cdk-phoenixd,
  158. -p cdk-fake-wallet,
  159. -p cdk-cln,
  160. ]
  161. steps:
  162. - name: checkout
  163. uses: actions/checkout@v4
  164. - name: Install Nix
  165. uses: DeterminateSystems/nix-installer-action@v11
  166. - name: Nix Cache
  167. uses: DeterminateSystems/magic-nix-cache-action@v6
  168. - name: Rust Cache
  169. uses: Swatinem/rust-cache@v2
  170. - name: Build
  171. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  172. db-msrv-build:
  173. name: "DB MSRV build"
  174. runs-on: ubuntu-latest
  175. strategy:
  176. matrix:
  177. build-args:
  178. [
  179. -p cdk-sqlite,
  180. -p cdk-redb,
  181. ]
  182. steps:
  183. - name: checkout
  184. uses: actions/checkout@v4
  185. - name: Install Nix
  186. uses: DeterminateSystems/nix-installer-action@v11
  187. - name: Nix Cache
  188. uses: DeterminateSystems/magic-nix-cache-action@v6
  189. - name: Rust Cache
  190. uses: Swatinem/rust-cache@v2
  191. - name: Build
  192. run: nix develop -i -L .#db_shell --command cargo build ${{ matrix.build-args }}
  193. check-wasm:
  194. name: Check WASM
  195. runs-on: ubuntu-latest
  196. strategy:
  197. matrix:
  198. rust:
  199. - stable
  200. target:
  201. - wasm32-unknown-unknown
  202. build-args:
  203. [
  204. -p cdk,
  205. -p cdk --no-default-features,
  206. -p cdk --no-default-features --features wallet,
  207. ]
  208. steps:
  209. - name: checkout
  210. uses: actions/checkout@v4
  211. - name: Install Nix
  212. uses: DeterminateSystems/nix-installer-action@v11
  213. - name: Nix Cache
  214. uses: DeterminateSystems/magic-nix-cache-action@v6
  215. - name: Rust Cache
  216. uses: Swatinem/rust-cache@v2
  217. - name: Build cdk and binding
  218. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  219. check-wasm-msrv:
  220. name: Check WASM
  221. runs-on: ubuntu-latest
  222. strategy:
  223. matrix:
  224. rust:
  225. - msrv
  226. target:
  227. - wasm32-unknown-unknown
  228. build-args:
  229. [
  230. -p cdk,
  231. -p cdk --no-default-features,
  232. -p cdk --no-default-features --features wallet,
  233. ]
  234. steps:
  235. - name: checkout
  236. uses: actions/checkout@v4
  237. - name: Install Nix
  238. uses: DeterminateSystems/nix-installer-action@v11
  239. - name: Nix Cache
  240. uses: DeterminateSystems/magic-nix-cache-action@v6
  241. - name: Rust Cache
  242. uses: Swatinem/rust-cache@v2
  243. - name: Build cdk wasm
  244. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}