ci.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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-cli --features redb,
  121. --bin cdk-cli --features "sqlcipher redb",
  122. --bin cdk-mintd,
  123. --bin cdk-mintd --features redis,
  124. --bin cdk-mintd --features redb,
  125. --bin cdk-mintd --features "redis swagger redb",
  126. --bin cdk-mintd --features sqlcipher,
  127. --bin cdk-mintd --no-default-features --features lnd,
  128. --bin cdk-mintd --no-default-features --features cln,
  129. --bin cdk-mintd --no-default-features --features lnbits,
  130. --bin cdk-mintd --no-default-features --features fakewallet,
  131. --bin cdk-mintd --no-default-features --features grpc-processor,
  132. --bin cdk-mintd --no-default-features --features "management-rpc lnd",
  133. --bin cdk-mintd --no-default-features --features "management-rpc cln",
  134. --bin cdk-mintd --no-default-features --features "management-rpc lnbits",
  135. --bin cdk-mintd --no-default-features --features "management-rpc grpc-processor",
  136. --bin cdk-mintd --no-default-features --features "swagger lnd",
  137. --bin cdk-mintd --no-default-features --features "swagger cln",
  138. --bin cdk-mintd --no-default-features --features "swagger lnbits",
  139. --bin cdk-mintd --no-default-features --features "auth lnd",
  140. --bin cdk-mintd --no-default-features --features "auth cln",
  141. --bin cdk-mint-cli,
  142. ]
  143. steps:
  144. - name: checkout
  145. uses: actions/checkout@v4
  146. - name: Install Nix
  147. uses: DeterminateSystems/nix-installer-action@v11
  148. - name: Nix Cache
  149. uses: DeterminateSystems/magic-nix-cache-action@v6
  150. - name: Rust Cache
  151. uses: Swatinem/rust-cache@v2
  152. - name: Clippy
  153. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  154. - name: Test
  155. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  156. regtest-itest:
  157. name: "Integration regtest tests"
  158. runs-on: ubuntu-latest
  159. timeout-minutes: 15
  160. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  161. strategy:
  162. matrix:
  163. build-args:
  164. [
  165. -p cdk-integration-tests,
  166. ]
  167. database:
  168. [
  169. REDB,
  170. SQLITE,
  171. ]
  172. steps:
  173. - name: checkout
  174. uses: actions/checkout@v4
  175. - name: Install Nix
  176. uses: DeterminateSystems/nix-installer-action@v11
  177. - name: Nix Cache
  178. uses: DeterminateSystems/magic-nix-cache-action@v6
  179. - name: Rust Cache
  180. uses: Swatinem/rust-cache@v2
  181. - name: Test
  182. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  183. fake-mint-itest:
  184. name: "Integration fake mint tests"
  185. runs-on: ubuntu-latest
  186. timeout-minutes: 15
  187. needs: [pre-commit-checks, clippy]
  188. strategy:
  189. matrix:
  190. build-args:
  191. [
  192. -p cdk-integration-tests,
  193. ]
  194. database:
  195. [
  196. REDB,
  197. SQLITE,
  198. ]
  199. steps:
  200. - name: checkout
  201. uses: actions/checkout@v4
  202. - name: Install Nix
  203. uses: DeterminateSystems/nix-installer-action@v11
  204. - name: Nix Cache
  205. uses: DeterminateSystems/magic-nix-cache-action@v6
  206. - name: Rust Cache
  207. uses: Swatinem/rust-cache@v2
  208. - name: Clippy
  209. run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
  210. - name: Test fake auth mint
  211. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  212. pure-itest:
  213. name: "Integration fake wallet tests"
  214. runs-on: ubuntu-latest
  215. timeout-minutes: 15
  216. needs: [pre-commit-checks, clippy]
  217. steps:
  218. - name: checkout
  219. uses: actions/checkout@v4
  220. - name: Install Nix
  221. uses: DeterminateSystems/nix-installer-action@v11
  222. - name: Nix Cache
  223. uses: DeterminateSystems/magic-nix-cache-action@v6
  224. - name: Rust Cache
  225. uses: Swatinem/rust-cache@v2
  226. - name: Test fake mint
  227. run: nix develop -i -L .#stable --command just test
  228. payment-processor-itests:
  229. name: "Payment processor tests"
  230. runs-on: ubuntu-latest
  231. timeout-minutes: 15
  232. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest, regtest-itest]
  233. strategy:
  234. matrix:
  235. ln:
  236. [
  237. FAKEWALLET,
  238. CLN,
  239. LND
  240. ]
  241. steps:
  242. - name: checkout
  243. uses: actions/checkout@v4
  244. - name: Install Nix
  245. uses: DeterminateSystems/nix-installer-action@v11
  246. - name: Nix Cache
  247. uses: DeterminateSystems/magic-nix-cache-action@v6
  248. - name: Rust Cache
  249. uses: Swatinem/rust-cache@v2
  250. - name: Test
  251. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  252. msrv-build:
  253. name: "MSRV build"
  254. runs-on: ubuntu-latest
  255. timeout-minutes: 15
  256. needs: [pre-commit-checks, clippy, pure-itest]
  257. strategy:
  258. matrix:
  259. build-args:
  260. [
  261. -p cashu --no-default-features --features "wallet mint",
  262. -p cdk-common --no-default-features --features "wallet mint",
  263. -p cdk,
  264. -p cdk --no-default-features --features "mint auth",
  265. -p cdk --no-default-features --features "wallet auth",
  266. -p cdk --no-default-features --features "http_subscription",
  267. -p cdk-axum,
  268. -p cdk-axum --no-default-features --features redis,
  269. -p cdk-lnbits,
  270. -p cdk-fake-wallet,
  271. -p cdk-cln,
  272. -p cdk-lnd,
  273. -p cdk-mint-rpc,
  274. -p cdk-sqlite,
  275. -p cdk-mintd,
  276. -p cdk-payment-processor --no-default-features,
  277. ]
  278. steps:
  279. - name: checkout
  280. uses: actions/checkout@v4
  281. - name: Install Nix
  282. uses: DeterminateSystems/nix-installer-action@v11
  283. - name: Nix Cache
  284. uses: DeterminateSystems/magic-nix-cache-action@v6
  285. - name: Rust Cache
  286. uses: Swatinem/rust-cache@v2
  287. - name: Build
  288. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  289. check-wasm:
  290. name: Check WASM
  291. runs-on: ubuntu-latest
  292. timeout-minutes: 15
  293. needs: [pre-commit-checks, clippy, pure-itest]
  294. strategy:
  295. matrix:
  296. rust:
  297. - stable
  298. target:
  299. - wasm32-unknown-unknown
  300. build-args:
  301. [
  302. -p cdk,
  303. -p cdk --no-default-features,
  304. -p cdk --no-default-features --features wallet,
  305. ]
  306. steps:
  307. - name: checkout
  308. uses: actions/checkout@v4
  309. - name: Install Nix
  310. uses: DeterminateSystems/nix-installer-action@v11
  311. - name: Nix Cache
  312. uses: DeterminateSystems/magic-nix-cache-action@v6
  313. - name: Rust Cache
  314. uses: Swatinem/rust-cache@v2
  315. - name: Build cdk and binding
  316. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  317. check-wasm-msrv:
  318. name: Check WASM
  319. runs-on: ubuntu-latest
  320. timeout-minutes: 15
  321. needs: [pre-commit-checks, clippy, msrv-build]
  322. strategy:
  323. matrix:
  324. rust:
  325. - msrv
  326. target:
  327. - wasm32-unknown-unknown
  328. build-args:
  329. [
  330. -p cdk,
  331. -p cdk --no-default-features,
  332. -p cdk --no-default-features --features wallet,
  333. ]
  334. steps:
  335. - name: checkout
  336. uses: actions/checkout@v4
  337. - name: Install Nix
  338. uses: DeterminateSystems/nix-installer-action@v11
  339. - name: Nix Cache
  340. uses: DeterminateSystems/magic-nix-cache-action@v6
  341. - name: Rust Cache
  342. uses: Swatinem/rust-cache@v2
  343. - name: Build cdk wasm
  344. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  345. fake-mint-auth-itest:
  346. name: "Integration fake mint auth tests"
  347. runs-on: ubuntu-latest
  348. timeout-minutes: 15
  349. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  350. strategy:
  351. matrix:
  352. database:
  353. [
  354. REDB,
  355. SQLITE,
  356. ]
  357. steps:
  358. - name: checkout
  359. uses: actions/checkout@v4
  360. - name: Install Nix
  361. uses: DeterminateSystems/nix-installer-action@v11
  362. - name: Nix Cache
  363. uses: DeterminateSystems/magic-nix-cache-action@v6
  364. - name: Rust Cache
  365. uses: Swatinem/rust-cache@v2
  366. - name: Start Keycloak with Backup
  367. run: |
  368. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  369. 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
  370. - name: Verify Keycloak Import
  371. run: |
  372. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  373. - name: Test fake auth mint
  374. 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
  375. - name: Stop and clean up Docker Compose
  376. run: |
  377. docker compose -f misc/keycloak/docker-compose-recover.yml down
  378. doc-tests:
  379. name: "Documentation Tests"
  380. runs-on: ubuntu-latest
  381. timeout-minutes: 15
  382. needs: pre-commit-checks
  383. steps:
  384. - name: checkout
  385. uses: actions/checkout@v4
  386. - name: Install Nix
  387. uses: DeterminateSystems/nix-installer-action@v11
  388. - name: Nix Cache
  389. uses: DeterminateSystems/magic-nix-cache-action@v6
  390. - name: Rust Cache
  391. uses: Swatinem/rust-cache@v2
  392. - name: Run doc tests
  393. run: nix develop -i -L .#stable --command cargo test --doc
  394. strict-docs:
  395. name: "Strict Documentation Check"
  396. runs-on: ubuntu-latest
  397. timeout-minutes: 15
  398. needs: doc-tests
  399. steps:
  400. - name: checkout
  401. uses: actions/checkout@v4
  402. - name: Install Nix
  403. uses: DeterminateSystems/nix-installer-action@v11
  404. - name: Nix Cache
  405. uses: DeterminateSystems/magic-nix-cache-action@v6
  406. - name: Rust Cache
  407. uses: Swatinem/rust-cache@v2
  408. - name: Check docs with strict warnings
  409. run: nix develop -i -L .#stable --command just docs-strict