ci.yml 15 KB

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