ci.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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. strategy:
  218. matrix:
  219. database:
  220. [
  221. memory,
  222. sqlite,
  223. redb
  224. ]
  225. steps:
  226. - name: checkout
  227. uses: actions/checkout@v4
  228. - name: Install Nix
  229. uses: DeterminateSystems/nix-installer-action@v11
  230. - name: Nix Cache
  231. uses: DeterminateSystems/magic-nix-cache-action@v6
  232. - name: Rust Cache
  233. uses: Swatinem/rust-cache@v2
  234. - name: Test fake mint
  235. run: nix develop -i -L .#stable --command just test-pure ${{ matrix.database }}
  236. - name: Test mint
  237. run: nix develop -i -L .#stable --command just test
  238. payment-processor-itests:
  239. name: "Payment processor tests"
  240. runs-on: ubuntu-latest
  241. timeout-minutes: 15
  242. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest, regtest-itest]
  243. strategy:
  244. matrix:
  245. ln:
  246. [
  247. FAKEWALLET,
  248. CLN,
  249. LND
  250. ]
  251. steps:
  252. - name: checkout
  253. uses: actions/checkout@v4
  254. - name: Install Nix
  255. uses: DeterminateSystems/nix-installer-action@v11
  256. - name: Nix Cache
  257. uses: DeterminateSystems/magic-nix-cache-action@v6
  258. - name: Rust Cache
  259. uses: Swatinem/rust-cache@v2
  260. - name: Test
  261. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  262. msrv-build:
  263. name: "MSRV build"
  264. runs-on: ubuntu-latest
  265. timeout-minutes: 15
  266. needs: [pre-commit-checks, clippy, pure-itest]
  267. strategy:
  268. matrix:
  269. build-args:
  270. [
  271. -p cashu --no-default-features --features "wallet mint",
  272. -p cdk-common --no-default-features --features "wallet mint",
  273. -p cdk,
  274. -p cdk --no-default-features --features "mint auth",
  275. -p cdk --no-default-features --features "wallet auth",
  276. -p cdk --no-default-features --features "http_subscription",
  277. -p cdk-axum,
  278. -p cdk-axum --no-default-features --features redis,
  279. -p cdk-lnbits,
  280. -p cdk-fake-wallet,
  281. -p cdk-cln,
  282. -p cdk-lnd,
  283. -p cdk-mint-rpc,
  284. -p cdk-sqlite,
  285. -p cdk-mintd,
  286. -p cdk-payment-processor --no-default-features,
  287. ]
  288. steps:
  289. - name: checkout
  290. uses: actions/checkout@v4
  291. - name: Install Nix
  292. uses: DeterminateSystems/nix-installer-action@v11
  293. - name: Nix Cache
  294. uses: DeterminateSystems/magic-nix-cache-action@v6
  295. - name: Rust Cache
  296. uses: Swatinem/rust-cache@v2
  297. - name: Build
  298. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  299. check-wasm:
  300. name: Check WASM
  301. runs-on: ubuntu-latest
  302. timeout-minutes: 15
  303. needs: [pre-commit-checks, clippy, pure-itest]
  304. strategy:
  305. matrix:
  306. rust:
  307. - stable
  308. target:
  309. - wasm32-unknown-unknown
  310. build-args:
  311. [
  312. -p cdk,
  313. -p cdk --no-default-features,
  314. -p cdk --no-default-features --features wallet,
  315. ]
  316. steps:
  317. - name: checkout
  318. uses: actions/checkout@v4
  319. - name: Install Nix
  320. uses: DeterminateSystems/nix-installer-action@v11
  321. - name: Nix Cache
  322. uses: DeterminateSystems/magic-nix-cache-action@v6
  323. - name: Rust Cache
  324. uses: Swatinem/rust-cache@v2
  325. - name: Build cdk and binding
  326. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  327. check-wasm-msrv:
  328. name: Check WASM
  329. runs-on: ubuntu-latest
  330. timeout-minutes: 15
  331. needs: [pre-commit-checks, clippy, msrv-build]
  332. strategy:
  333. matrix:
  334. rust:
  335. - msrv
  336. target:
  337. - wasm32-unknown-unknown
  338. build-args:
  339. [
  340. -p cdk,
  341. -p cdk --no-default-features,
  342. -p cdk --no-default-features --features wallet,
  343. ]
  344. steps:
  345. - name: checkout
  346. uses: actions/checkout@v4
  347. - name: Install Nix
  348. uses: DeterminateSystems/nix-installer-action@v11
  349. - name: Nix Cache
  350. uses: DeterminateSystems/magic-nix-cache-action@v6
  351. - name: Rust Cache
  352. uses: Swatinem/rust-cache@v2
  353. - name: Build cdk wasm
  354. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  355. fake-mint-auth-itest:
  356. name: "Integration fake mint auth tests"
  357. runs-on: ubuntu-latest
  358. timeout-minutes: 15
  359. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  360. strategy:
  361. matrix:
  362. database:
  363. [
  364. REDB,
  365. SQLITE,
  366. ]
  367. steps:
  368. - name: checkout
  369. uses: actions/checkout@v4
  370. - name: Install Nix
  371. uses: DeterminateSystems/nix-installer-action@v11
  372. - name: Nix Cache
  373. uses: DeterminateSystems/magic-nix-cache-action@v6
  374. - name: Rust Cache
  375. uses: Swatinem/rust-cache@v2
  376. - name: Start Keycloak with Backup
  377. run: |
  378. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  379. 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
  380. - name: Verify Keycloak Import
  381. run: |
  382. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  383. - name: Test fake auth mint
  384. 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
  385. - name: Stop and clean up Docker Compose
  386. run: |
  387. docker compose -f misc/keycloak/docker-compose-recover.yml down
  388. doc-tests:
  389. name: "Documentation Tests"
  390. runs-on: ubuntu-latest
  391. timeout-minutes: 15
  392. needs: pre-commit-checks
  393. steps:
  394. - name: checkout
  395. uses: actions/checkout@v4
  396. - name: Install Nix
  397. uses: DeterminateSystems/nix-installer-action@v11
  398. - name: Nix Cache
  399. uses: DeterminateSystems/magic-nix-cache-action@v6
  400. - name: Rust Cache
  401. uses: Swatinem/rust-cache@v2
  402. - name: Run doc tests
  403. run: nix develop -i -L .#stable --command cargo test --doc
  404. strict-docs:
  405. name: "Strict Documentation Check"
  406. runs-on: ubuntu-latest
  407. timeout-minutes: 15
  408. needs: doc-tests
  409. steps:
  410. - name: checkout
  411. uses: actions/checkout@v4
  412. - name: Install Nix
  413. uses: DeterminateSystems/nix-installer-action@v11
  414. - name: Nix Cache
  415. uses: DeterminateSystems/magic-nix-cache-action@v6
  416. - name: Rust Cache
  417. uses: Swatinem/rust-cache@v2
  418. - name: Check docs with strict warnings
  419. run: nix develop -i -L .#stable --command just docs-strict