ci.yml 7.0 KB

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