ci.yml 5.9 KB

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