ci.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. release:
  8. types: [created]
  9. env:
  10. CARGO_TERM_COLOR: always
  11. jobs:
  12. self-care:
  13. name: Flake self-check
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 15
  16. steps:
  17. - uses: actions/checkout@v4
  18. - name: Check Nix flake inputs
  19. uses: DeterminateSystems/flake-checker-action@v7
  20. with:
  21. fail-mode: true
  22. pre-commit-checks:
  23. name: "Cargo fmt, typos"
  24. runs-on: ubuntu-latest
  25. timeout-minutes: 15
  26. steps:
  27. - name: checkout
  28. uses: actions/checkout@v4
  29. - name: Install Nix
  30. uses: DeterminateSystems/nix-installer-action@v11
  31. - name: Nix Cache
  32. uses: DeterminateSystems/magic-nix-cache-action@v6
  33. - name: Rust Cache
  34. uses: Swatinem/rust-cache@v2
  35. - name: Cargo fmt
  36. run: |
  37. nix develop -i -L .#nightly --command bash -c '
  38. # Force use of Nix-provided rustfmt
  39. export RUSTFMT=$(command -v rustfmt)
  40. cargo fmt --check
  41. '
  42. - name: typos
  43. run: nix develop -i -L .#nightly --command typos
  44. examples:
  45. name: "Run examples"
  46. runs-on: ubuntu-latest
  47. timeout-minutes: 15
  48. needs: [pre-commit-checks, clippy]
  49. strategy:
  50. matrix:
  51. build-args:
  52. [
  53. mint-token,
  54. melt-token,
  55. p2pk,
  56. proof-selection,
  57. wallet
  58. ]
  59. steps:
  60. - name: checkout
  61. uses: actions/checkout@v4
  62. - name: Install Nix
  63. uses: DeterminateSystems/nix-installer-action@v11
  64. - name: Nix Cache
  65. uses: DeterminateSystems/magic-nix-cache-action@v6
  66. - name: Rust Cache
  67. uses: Swatinem/rust-cache@v2
  68. - name: Run example
  69. run: nix develop -i -L .#stable --command cargo r --example ${{ matrix.build-args }}
  70. clippy:
  71. name: "Stable build, clippy and test"
  72. runs-on: ubuntu-latest
  73. timeout-minutes: 15
  74. needs: pre-commit-checks
  75. strategy:
  76. matrix:
  77. build-args:
  78. [
  79. -p cashu,
  80. -p cashu --no-default-features,
  81. -p cashu --no-default-features --features wallet,
  82. -p cashu --no-default-features --features mint,
  83. -p cashu --no-default-features --features "mint swagger",
  84. -p cashu --no-default-features --features auth,
  85. -p cashu --no-default-features --features "mint auth",
  86. -p cashu --no-default-features --features "wallet auth",
  87. -p cdk-common,
  88. -p cdk-common --no-default-features,
  89. -p cdk-common --no-default-features --features wallet,
  90. -p cdk-common --no-default-features --features mint,
  91. -p cdk-common --no-default-features --features "mint swagger",
  92. -p cdk-common --no-default-features --features "auth",
  93. -p cdk-common --no-default-features --features "mint auth",
  94. -p cdk-common --no-default-features --features "wallet auth",
  95. -p cdk,
  96. -p cdk --no-default-features,
  97. -p cdk --no-default-features --features wallet,
  98. -p cdk --no-default-features --features mint,
  99. -p cdk --no-default-features --features "mint swagger",
  100. -p cdk --no-default-features --features auth,
  101. -p cdk --features auth,
  102. -p cdk --no-default-features --features "auth mint",
  103. -p cdk --no-default-features --features "auth wallet",
  104. -p cdk-redb,
  105. -p cdk-sqlite,
  106. -p cdk-sqlite --features sqlcipher,
  107. -p cdk-axum --no-default-features,
  108. -p cdk-axum --no-default-features --features swagger,
  109. -p cdk-axum --no-default-features --features redis,
  110. -p cdk-axum --no-default-features --features "redis swagger",
  111. -p cdk-axum --no-default-features --features "auth redis",
  112. -p cdk-axum,
  113. -p cdk-cln,
  114. -p cdk-lnd,
  115. -p cdk-lnbits,
  116. -p cdk-fake-wallet,
  117. -p cdk-payment-processor,
  118. --bin cdk-cli,
  119. --bin cdk-cli --features sqlcipher,
  120. --bin cdk-mintd,
  121. --bin cdk-mintd --features redis,
  122. --bin cdk-mintd --features redb,
  123. --bin cdk-mintd --features "redis swagger redb",
  124. --bin cdk-mintd --features sqlcipher,
  125. --bin cdk-mintd --no-default-features --features lnd,
  126. --bin cdk-mintd --no-default-features --features cln,
  127. --bin cdk-mintd --no-default-features --features lnbits,
  128. --bin cdk-mintd --no-default-features --features fakewallet,
  129. --bin cdk-mintd --no-default-features --features grpc-processor,
  130. --bin cdk-mintd --no-default-features --features "management-rpc lnd",
  131. --bin cdk-mintd --no-default-features --features "management-rpc cln",
  132. --bin cdk-mintd --no-default-features --features "management-rpc lnbits",
  133. --bin cdk-mintd --no-default-features --features "management-rpc grpc-processor",
  134. --bin cdk-mintd --no-default-features --features "swagger lnd",
  135. --bin cdk-mintd --no-default-features --features "swagger cln",
  136. --bin cdk-mintd --no-default-features --features "swagger lnbits",
  137. --bin cdk-mintd --no-default-features --features "auth lnd",
  138. --bin cdk-mintd --no-default-features --features "auth cln",
  139. --bin cdk-mint-cli,
  140. ]
  141. steps:
  142. - name: checkout
  143. uses: actions/checkout@v4
  144. - name: Install Nix
  145. uses: DeterminateSystems/nix-installer-action@v11
  146. - name: Nix Cache
  147. uses: DeterminateSystems/magic-nix-cache-action@v6
  148. - name: Rust Cache
  149. uses: Swatinem/rust-cache@v2
  150. - name: Clippy
  151. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  152. - name: Test
  153. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  154. regtest-itest:
  155. name: "Integration regtest tests"
  156. runs-on: ubuntu-latest
  157. timeout-minutes: 15
  158. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  159. strategy:
  160. matrix:
  161. build-args:
  162. [
  163. -p cdk-integration-tests,
  164. ]
  165. database:
  166. [
  167. REDB,
  168. SQLITE,
  169. ]
  170. steps:
  171. - name: checkout
  172. uses: actions/checkout@v4
  173. - name: Install Nix
  174. uses: DeterminateSystems/nix-installer-action@v11
  175. - name: Nix Cache
  176. uses: DeterminateSystems/magic-nix-cache-action@v6
  177. - name: Rust Cache
  178. uses: Swatinem/rust-cache@v2
  179. - name: Test
  180. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  181. fake-mint-itest:
  182. name: "Integration fake mint tests"
  183. runs-on: ubuntu-latest
  184. timeout-minutes: 15
  185. needs: [pre-commit-checks, clippy]
  186. strategy:
  187. matrix:
  188. build-args:
  189. [
  190. -p cdk-integration-tests,
  191. ]
  192. database:
  193. [
  194. REDB,
  195. SQLITE,
  196. ]
  197. steps:
  198. - name: checkout
  199. uses: actions/checkout@v4
  200. - name: Install Nix
  201. uses: DeterminateSystems/nix-installer-action@v11
  202. - name: Nix Cache
  203. uses: DeterminateSystems/magic-nix-cache-action@v6
  204. - name: Rust Cache
  205. uses: Swatinem/rust-cache@v2
  206. - name: Clippy
  207. run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
  208. - name: Test fake auth mint
  209. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  210. pure-itest:
  211. name: "Integration fake wallet tests"
  212. runs-on: ubuntu-latest
  213. timeout-minutes: 15
  214. needs: [pre-commit-checks, clippy]
  215. steps:
  216. - name: checkout
  217. uses: actions/checkout@v4
  218. - name: Install Nix
  219. uses: DeterminateSystems/nix-installer-action@v11
  220. - name: Nix Cache
  221. uses: DeterminateSystems/magic-nix-cache-action@v6
  222. - name: Rust Cache
  223. uses: Swatinem/rust-cache@v2
  224. - name: Test fake mint
  225. run: nix develop -i -L .#stable --command just test
  226. payment-processor-itests:
  227. name: "Payment processor tests"
  228. runs-on: ubuntu-latest
  229. timeout-minutes: 15
  230. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest, regtest-itest]
  231. strategy:
  232. matrix:
  233. ln:
  234. [
  235. FAKEWALLET,
  236. CLN,
  237. LND
  238. ]
  239. steps:
  240. - name: checkout
  241. uses: actions/checkout@v4
  242. - name: Install Nix
  243. uses: DeterminateSystems/nix-installer-action@v11
  244. - name: Nix Cache
  245. uses: DeterminateSystems/magic-nix-cache-action@v6
  246. - name: Rust Cache
  247. uses: Swatinem/rust-cache@v2
  248. - name: Test
  249. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  250. msrv-build:
  251. name: "MSRV build"
  252. runs-on: ubuntu-latest
  253. timeout-minutes: 15
  254. needs: [pre-commit-checks, clippy, pure-itest]
  255. strategy:
  256. matrix:
  257. build-args:
  258. [
  259. -p cashu --no-default-features --features "wallet mint",
  260. -p cdk-common --no-default-features --features "wallet mint",
  261. -p cdk,
  262. -p cdk --no-default-features --features "mint auth",
  263. -p cdk --no-default-features --features "wallet auth",
  264. -p cdk --no-default-features --features "http_subscription",
  265. -p cdk-axum,
  266. -p cdk-axum --no-default-features --features redis,
  267. -p cdk-lnbits,
  268. -p cdk-fake-wallet,
  269. -p cdk-cln,
  270. -p cdk-lnd,
  271. -p cdk-mint-rpc,
  272. -p cdk-sqlite,
  273. -p cdk-mintd,
  274. -p cdk-payment-processor --no-default-features,
  275. ]
  276. steps:
  277. - name: checkout
  278. uses: actions/checkout@v4
  279. - name: Install Nix
  280. uses: DeterminateSystems/nix-installer-action@v11
  281. - name: Nix Cache
  282. uses: DeterminateSystems/magic-nix-cache-action@v6
  283. - name: Rust Cache
  284. uses: Swatinem/rust-cache@v2
  285. - name: Build
  286. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  287. check-wasm:
  288. name: Check WASM
  289. runs-on: ubuntu-latest
  290. timeout-minutes: 15
  291. needs: [pre-commit-checks, clippy, pure-itest]
  292. strategy:
  293. matrix:
  294. rust:
  295. - stable
  296. target:
  297. - wasm32-unknown-unknown
  298. build-args:
  299. [
  300. -p cdk,
  301. -p cdk --no-default-features,
  302. -p cdk --no-default-features --features wallet,
  303. ]
  304. steps:
  305. - name: checkout
  306. uses: actions/checkout@v4
  307. - name: Install Nix
  308. uses: DeterminateSystems/nix-installer-action@v11
  309. - name: Nix Cache
  310. uses: DeterminateSystems/magic-nix-cache-action@v6
  311. - name: Rust Cache
  312. uses: Swatinem/rust-cache@v2
  313. - name: Build cdk and binding
  314. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  315. check-wasm-msrv:
  316. name: Check WASM
  317. runs-on: ubuntu-latest
  318. timeout-minutes: 15
  319. needs: [pre-commit-checks, clippy, msrv-build]
  320. strategy:
  321. matrix:
  322. rust:
  323. - msrv
  324. target:
  325. - wasm32-unknown-unknown
  326. build-args:
  327. [
  328. -p cdk,
  329. -p cdk --no-default-features,
  330. -p cdk --no-default-features --features wallet,
  331. ]
  332. steps:
  333. - name: checkout
  334. uses: actions/checkout@v4
  335. - name: Install Nix
  336. uses: DeterminateSystems/nix-installer-action@v11
  337. - name: Nix Cache
  338. uses: DeterminateSystems/magic-nix-cache-action@v6
  339. - name: Rust Cache
  340. uses: Swatinem/rust-cache@v2
  341. - name: Build cdk wasm
  342. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  343. fake-mint-auth-itest:
  344. name: "Integration fake mint auth tests"
  345. runs-on: ubuntu-latest
  346. timeout-minutes: 15
  347. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  348. strategy:
  349. matrix:
  350. database:
  351. [
  352. REDB,
  353. SQLITE,
  354. ]
  355. steps:
  356. - name: checkout
  357. uses: actions/checkout@v4
  358. - name: Install Nix
  359. uses: DeterminateSystems/nix-installer-action@v11
  360. - name: Nix Cache
  361. uses: DeterminateSystems/magic-nix-cache-action@v6
  362. - name: Rust Cache
  363. uses: Swatinem/rust-cache@v2
  364. - name: Start Keycloak with Backup
  365. run: |
  366. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  367. 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
  368. - name: Verify Keycloak Import
  369. run: |
  370. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  371. - name: Test fake auth mint
  372. 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
  373. - name: Stop and clean up Docker Compose
  374. run: |
  375. docker compose -f misc/keycloak/docker-compose-recover.yml down
  376. doc-tests:
  377. name: "Documentation Tests"
  378. runs-on: ubuntu-latest
  379. timeout-minutes: 15
  380. needs: pre-commit-checks
  381. steps:
  382. - name: checkout
  383. uses: actions/checkout@v4
  384. - name: Install Nix
  385. uses: DeterminateSystems/nix-installer-action@v11
  386. - name: Nix Cache
  387. uses: DeterminateSystems/magic-nix-cache-action@v6
  388. - name: Rust Cache
  389. uses: Swatinem/rust-cache@v2
  390. - name: Run doc tests
  391. run: nix develop -i -L .#stable --command cargo test --doc