ci.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  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. needs: [pre-commit-checks, clippy]
  47. strategy:
  48. matrix:
  49. build-args:
  50. [
  51. mint-token,
  52. p2pk,
  53. proof-selection,
  54. wallet
  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: Run example
  66. run: nix develop -i -L .#stable --command cargo r --example ${{ matrix.build-args }}
  67. clippy:
  68. name: "Stable build, clippy and test"
  69. runs-on: ubuntu-latest
  70. timeout-minutes: 15
  71. needs: pre-commit-checks
  72. strategy:
  73. matrix:
  74. build-args:
  75. [
  76. -p cashu,
  77. -p cashu --no-default-features,
  78. -p cashu --no-default-features --features wallet,
  79. -p cashu --no-default-features --features mint,
  80. -p cashu --no-default-features --features "mint swagger",
  81. -p cashu --no-default-features --features auth,
  82. -p cashu --no-default-features --features "mint auth",
  83. -p cashu --no-default-features --features "wallet auth",
  84. -p cdk-common,
  85. -p cdk-common --no-default-features,
  86. -p cdk-common --no-default-features --features wallet,
  87. -p cdk-common --no-default-features --features mint,
  88. -p cdk-common --no-default-features --features "mint swagger",
  89. -p cdk-common --no-default-features --features "auth",
  90. -p cdk-common --no-default-features --features "mint auth",
  91. -p cdk-common --no-default-features --features "wallet auth",
  92. -p cdk,
  93. -p cdk --no-default-features,
  94. -p cdk --no-default-features --features wallet,
  95. -p cdk --no-default-features --features mint,
  96. -p cdk --no-default-features --features "mint swagger",
  97. -p cdk --no-default-features --features auth,
  98. -p cdk --features auth,
  99. -p cdk --no-default-features --features "auth mint",
  100. -p cdk --no-default-features --features "auth wallet",
  101. -p cdk-redb,
  102. -p cdk-sqlite,
  103. -p cdk-sqlite --features sqlcipher,
  104. -p cdk-axum --no-default-features,
  105. -p cdk-axum --no-default-features --features swagger,
  106. -p cdk-axum --no-default-features --features redis,
  107. -p cdk-axum --no-default-features --features "redis swagger",
  108. -p cdk-axum --no-default-features --features "auth redis",
  109. -p cdk-axum,
  110. -p cdk-cln,
  111. -p cdk-lnd,
  112. -p cdk-lnbits,
  113. -p cdk-fake-wallet,
  114. -p cdk-payment-processor,
  115. --bin cdk-cli,
  116. --bin cdk-cli --features sqlcipher,
  117. --bin cdk-mintd,
  118. --bin cdk-mintd --features redis,
  119. --bin cdk-mintd --features redb,
  120. --bin cdk-mintd --features "redis swagger redb",
  121. --bin cdk-mintd --features sqlcipher,
  122. --bin cdk-mintd --no-default-features --features lnd,
  123. --bin cdk-mintd --no-default-features --features cln,
  124. --bin cdk-mintd --no-default-features --features lnbits,
  125. --bin cdk-mintd --no-default-features --features fakewallet,
  126. --bin cdk-mintd --no-default-features --features grpc-processor,
  127. --bin cdk-mintd --no-default-features --features "management-rpc lnd",
  128. --bin cdk-mintd --no-default-features --features "management-rpc cln",
  129. --bin cdk-mintd --no-default-features --features "management-rpc lnbits",
  130. --bin cdk-mintd --no-default-features --features "management-rpc grpc-processor",
  131. --bin cdk-mintd --no-default-features --features "swagger lnd",
  132. --bin cdk-mintd --no-default-features --features "swagger cln",
  133. --bin cdk-mintd --no-default-features --features "swagger lnbits",
  134. --bin cdk-mintd --no-default-features --features "auth lnd",
  135. --bin cdk-mintd --no-default-features --features "auth cln",
  136. --bin cdk-mint-cli,
  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: Clippy
  148. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  149. - name: Test
  150. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  151. regtest-itest:
  152. name: "Integration regtest tests"
  153. runs-on: ubuntu-latest
  154. timeout-minutes: 15
  155. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  156. strategy:
  157. matrix:
  158. build-args:
  159. [
  160. -p cdk-integration-tests,
  161. ]
  162. database:
  163. [
  164. REDB,
  165. SQLITE,
  166. ]
  167. steps:
  168. - name: checkout
  169. uses: actions/checkout@v4
  170. - name: Install Nix
  171. uses: DeterminateSystems/nix-installer-action@v11
  172. - name: Nix Cache
  173. uses: DeterminateSystems/magic-nix-cache-action@v6
  174. - name: Rust Cache
  175. uses: Swatinem/rust-cache@v2
  176. - name: Test
  177. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  178. fake-mint-itest:
  179. name: "Integration fake mint tests"
  180. runs-on: ubuntu-latest
  181. timeout-minutes: 15
  182. needs: [pre-commit-checks, clippy]
  183. strategy:
  184. matrix:
  185. build-args:
  186. [
  187. -p cdk-integration-tests,
  188. ]
  189. database:
  190. [
  191. REDB,
  192. SQLITE,
  193. ]
  194. steps:
  195. - name: checkout
  196. uses: actions/checkout@v4
  197. - name: Install Nix
  198. uses: DeterminateSystems/nix-installer-action@v11
  199. - name: Nix Cache
  200. uses: DeterminateSystems/magic-nix-cache-action@v6
  201. - name: Rust Cache
  202. uses: Swatinem/rust-cache@v2
  203. - name: Clippy
  204. run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
  205. - name: Test fake auth mint
  206. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  207. pure-itest:
  208. name: "Integration fake wallet tests"
  209. runs-on: ubuntu-latest
  210. timeout-minutes: 15
  211. needs: [pre-commit-checks, clippy]
  212. steps:
  213. - name: checkout
  214. uses: actions/checkout@v4
  215. - name: Install Nix
  216. uses: DeterminateSystems/nix-installer-action@v11
  217. - name: Nix Cache
  218. uses: DeterminateSystems/magic-nix-cache-action@v6
  219. - name: Rust Cache
  220. uses: Swatinem/rust-cache@v2
  221. - name: Test fake mint
  222. run: nix develop -i -L .#stable --command just test
  223. payment-processor-itests:
  224. name: "Payment processor tests"
  225. runs-on: ubuntu-latest
  226. timeout-minutes: 15
  227. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest, regtest-itest]
  228. strategy:
  229. matrix:
  230. ln:
  231. [
  232. FAKEWALLET,
  233. CLN,
  234. LND
  235. ]
  236. steps:
  237. - name: checkout
  238. uses: actions/checkout@v4
  239. - name: Install Nix
  240. uses: DeterminateSystems/nix-installer-action@v11
  241. - name: Nix Cache
  242. uses: DeterminateSystems/magic-nix-cache-action@v6
  243. - name: Rust Cache
  244. uses: Swatinem/rust-cache@v2
  245. - name: Test
  246. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  247. msrv-build:
  248. name: "MSRV build"
  249. runs-on: ubuntu-latest
  250. timeout-minutes: 15
  251. needs: [pre-commit-checks, clippy, pure-itest]
  252. strategy:
  253. matrix:
  254. build-args:
  255. [
  256. -p cashu --no-default-features --features "wallet mint",
  257. -p cdk-common --no-default-features --features "wallet mint",
  258. -p cdk,
  259. -p cdk --no-default-features --features "mint auth",
  260. -p cdk --no-default-features --features "wallet auth",
  261. -p cdk --no-default-features --features "http_subscription",
  262. -p cdk-axum,
  263. -p cdk-axum --no-default-features --features redis,
  264. -p cdk-lnbits,
  265. -p cdk-fake-wallet,
  266. -p cdk-cln,
  267. -p cdk-lnd,
  268. -p cdk-mint-rpc,
  269. -p cdk-sqlite,
  270. -p cdk-mintd,
  271. -p cdk-payment-processor --no-default-features,
  272. ]
  273. steps:
  274. - name: checkout
  275. uses: actions/checkout@v4
  276. - name: Install Nix
  277. uses: DeterminateSystems/nix-installer-action@v11
  278. - name: Nix Cache
  279. uses: DeterminateSystems/magic-nix-cache-action@v6
  280. - name: Rust Cache
  281. uses: Swatinem/rust-cache@v2
  282. - name: Build
  283. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  284. check-wasm:
  285. name: Check WASM
  286. runs-on: ubuntu-latest
  287. timeout-minutes: 15
  288. needs: [pre-commit-checks, clippy, pure-itest]
  289. strategy:
  290. matrix:
  291. rust:
  292. - stable
  293. target:
  294. - wasm32-unknown-unknown
  295. build-args:
  296. [
  297. -p cdk,
  298. -p cdk --no-default-features,
  299. -p cdk --no-default-features --features wallet,
  300. ]
  301. steps:
  302. - name: checkout
  303. uses: actions/checkout@v4
  304. - name: Install Nix
  305. uses: DeterminateSystems/nix-installer-action@v11
  306. - name: Nix Cache
  307. uses: DeterminateSystems/magic-nix-cache-action@v6
  308. - name: Rust Cache
  309. uses: Swatinem/rust-cache@v2
  310. - name: Build cdk and binding
  311. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  312. check-wasm-msrv:
  313. name: Check WASM
  314. runs-on: ubuntu-latest
  315. timeout-minutes: 15
  316. needs: [pre-commit-checks, clippy, msrv-build]
  317. strategy:
  318. matrix:
  319. rust:
  320. - msrv
  321. target:
  322. - wasm32-unknown-unknown
  323. build-args:
  324. [
  325. -p cdk,
  326. -p cdk --no-default-features,
  327. -p cdk --no-default-features --features wallet,
  328. ]
  329. steps:
  330. - name: checkout
  331. uses: actions/checkout@v4
  332. - name: Install Nix
  333. uses: DeterminateSystems/nix-installer-action@v11
  334. - name: Nix Cache
  335. uses: DeterminateSystems/magic-nix-cache-action@v6
  336. - name: Rust Cache
  337. uses: Swatinem/rust-cache@v2
  338. - name: Build cdk wasm
  339. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  340. fake-mint-auth-itest:
  341. name: "Integration fake mint auth tests"
  342. runs-on: ubuntu-latest
  343. timeout-minutes: 15
  344. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  345. strategy:
  346. matrix:
  347. database:
  348. [
  349. REDB,
  350. SQLITE,
  351. ]
  352. steps:
  353. - name: checkout
  354. uses: actions/checkout@v4
  355. - name: Install Nix
  356. uses: DeterminateSystems/nix-installer-action@v11
  357. - name: Nix Cache
  358. uses: DeterminateSystems/magic-nix-cache-action@v6
  359. - name: Rust Cache
  360. uses: Swatinem/rust-cache@v2
  361. - name: Start Keycloak with Backup
  362. run: |
  363. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  364. until docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Keycloak 25.0.6 on JVM (powered by Quarkus 3.8.5) started"; do sleep 1; done
  365. - name: Verify Keycloak Import
  366. run: |
  367. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  368. - name: Test fake auth mint
  369. run: nix develop -i -L .#stable --command just fake-auth-mint-itest ${{ matrix.database }} http://127.0.0.1:8080/realms/cdk-test-realm/.well-known/openid-configuration
  370. - name: Stop and clean up Docker Compose
  371. run: |
  372. docker compose -f misc/keycloak/docker-compose-recover.yml down