ci.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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
  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: Free Disk Space (Ubuntu)
  170. uses: jlumbroso/free-disk-space@main
  171. with:
  172. tool-cache: false
  173. android: true
  174. dotnet: true
  175. haskell: true
  176. large-packages: true
  177. docker-images: true
  178. swap-storage: true
  179. - name: Install Nix
  180. uses: DeterminateSystems/nix-installer-action@v17
  181. - name: Nix Cache
  182. uses: DeterminateSystems/magic-nix-cache-action@main
  183. - name: Rust Cache
  184. uses: Swatinem/rust-cache@v2
  185. with:
  186. shared-key: "stable"
  187. - name: Test
  188. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  189. fake-mint-itest:
  190. name: "Integration fake mint tests"
  191. runs-on: ubuntu-latest
  192. timeout-minutes: 30
  193. needs: [pre-commit-checks, clippy]
  194. strategy:
  195. matrix:
  196. build-args:
  197. [
  198. -p cdk-integration-tests,
  199. ]
  200. database:
  201. [
  202. SQLITE,
  203. ]
  204. steps:
  205. - name: checkout
  206. uses: actions/checkout@v4
  207. - name: Free Disk Space (Ubuntu)
  208. uses: jlumbroso/free-disk-space@main
  209. with:
  210. tool-cache: true
  211. android: true
  212. dotnet: true
  213. haskell: true
  214. large-packages: true
  215. docker-images: true
  216. swap-storage: true
  217. - name: Install Nix
  218. uses: DeterminateSystems/nix-installer-action@v17
  219. - name: Nix Cache
  220. uses: DeterminateSystems/magic-nix-cache-action@main
  221. - name: Rust Cache
  222. uses: Swatinem/rust-cache@v2
  223. with:
  224. shared-key: "stable"
  225. - name: Clippy
  226. run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
  227. - name: Test fake auth mint
  228. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  229. pure-itest:
  230. name: "Integration fake wallet tests"
  231. runs-on: ubuntu-latest
  232. timeout-minutes: 30
  233. needs: [pre-commit-checks, clippy]
  234. strategy:
  235. matrix:
  236. database:
  237. [
  238. memory,
  239. sqlite,
  240. redb
  241. ]
  242. steps:
  243. - name: checkout
  244. uses: actions/checkout@v4
  245. - name: Free Disk Space (Ubuntu)
  246. uses: jlumbroso/free-disk-space@main
  247. with:
  248. tool-cache: true
  249. android: true
  250. dotnet: true
  251. haskell: true
  252. large-packages: true
  253. docker-images: true
  254. swap-storage: true
  255. - name: Install Nix
  256. uses: DeterminateSystems/nix-installer-action@v17
  257. - name: Nix Cache
  258. uses: DeterminateSystems/magic-nix-cache-action@main
  259. - name: Rust Cache
  260. uses: Swatinem/rust-cache@v2
  261. with:
  262. shared-key: "stable"
  263. - name: Test fake mint
  264. run: nix develop -i -L .#stable --command just test-pure ${{ matrix.database }}
  265. - name: Test mint
  266. run: nix develop -i -L .#stable --command just test
  267. payment-processor-itests:
  268. name: "Payment processor tests"
  269. runs-on: ubuntu-latest
  270. timeout-minutes: 30
  271. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest, regtest-itest]
  272. strategy:
  273. matrix:
  274. ln:
  275. [
  276. FAKEWALLET,
  277. CLN,
  278. LND
  279. ]
  280. steps:
  281. - name: checkout
  282. uses: actions/checkout@v4
  283. - name: Free Disk Space (Ubuntu)
  284. uses: jlumbroso/free-disk-space@main
  285. with:
  286. tool-cache: true
  287. android: true
  288. dotnet: true
  289. haskell: true
  290. large-packages: true
  291. docker-images: true
  292. swap-storage: true
  293. - name: Install Nix
  294. uses: DeterminateSystems/nix-installer-action@v17
  295. - name: Nix Cache
  296. uses: DeterminateSystems/magic-nix-cache-action@main
  297. - name: Rust Cache
  298. uses: Swatinem/rust-cache@v2
  299. with:
  300. shared-key: "stable"
  301. - name: Test
  302. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  303. msrv-build:
  304. name: "MSRV build"
  305. runs-on: ubuntu-latest
  306. timeout-minutes: 30
  307. needs: [pre-commit-checks, clippy]
  308. strategy:
  309. matrix:
  310. build-args:
  311. [
  312. -p cashu --no-default-features --features "wallet mint",
  313. -p cdk-common --no-default-features --features "wallet mint",
  314. -p cdk,
  315. -p cdk --no-default-features --features "mint auth",
  316. -p cdk --no-default-features --features "wallet auth",
  317. -p cdk --no-default-features --features "http_subscription",
  318. -p cdk-axum,
  319. -p cdk-axum --no-default-features --features redis,
  320. -p cdk-lnbits,
  321. -p cdk-fake-wallet,
  322. -p cdk-cln,
  323. -p cdk-lnd,
  324. -p cdk-mint-rpc,
  325. -p cdk-sqlite,
  326. -p cdk-mintd,
  327. -p cdk-payment-processor --no-default-features,
  328. ]
  329. steps:
  330. - name: checkout
  331. uses: actions/checkout@v4
  332. - name: Install Nix
  333. uses: DeterminateSystems/nix-installer-action@v17
  334. - name: Nix Cache
  335. uses: DeterminateSystems/magic-nix-cache-action@main
  336. - name: Rust Cache
  337. uses: Swatinem/rust-cache@v2
  338. with:
  339. shared-key: "msrv"
  340. - name: Build
  341. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  342. check-wasm:
  343. name: Check WASM
  344. runs-on: ubuntu-latest
  345. timeout-minutes: 30
  346. needs: [pre-commit-checks, clippy]
  347. strategy:
  348. matrix:
  349. rust:
  350. - stable
  351. target:
  352. - wasm32-unknown-unknown
  353. build-args:
  354. [
  355. -p cdk,
  356. -p cdk --no-default-features,
  357. -p cdk --no-default-features --features wallet,
  358. ]
  359. steps:
  360. - name: checkout
  361. uses: actions/checkout@v4
  362. - name: Install Nix
  363. uses: DeterminateSystems/nix-installer-action@v17
  364. - name: Nix Cache
  365. uses: DeterminateSystems/magic-nix-cache-action@main
  366. - name: Rust Cache
  367. uses: Swatinem/rust-cache@v2
  368. with:
  369. shared-key: "stable"
  370. - name: Build cdk and binding
  371. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  372. check-wasm-msrv:
  373. name: Check WASM
  374. runs-on: ubuntu-latest
  375. timeout-minutes: 30
  376. needs: [pre-commit-checks, clippy, msrv-build]
  377. strategy:
  378. matrix:
  379. rust:
  380. - msrv
  381. target:
  382. - wasm32-unknown-unknown
  383. build-args:
  384. [
  385. -p cdk,
  386. -p cdk --no-default-features,
  387. -p cdk --no-default-features --features wallet,
  388. ]
  389. steps:
  390. - name: checkout
  391. uses: actions/checkout@v4
  392. - name: Install Nix
  393. uses: DeterminateSystems/nix-installer-action@v17
  394. - name: Nix Cache
  395. uses: DeterminateSystems/magic-nix-cache-action@main
  396. - name: Rust Cache
  397. uses: Swatinem/rust-cache@v2
  398. with:
  399. shared-key: "msrv"
  400. - name: Build cdk wasm
  401. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  402. fake-mint-auth-itest:
  403. name: "Integration fake mint auth tests"
  404. runs-on: ubuntu-latest
  405. timeout-minutes: 30
  406. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  407. strategy:
  408. matrix:
  409. database:
  410. [
  411. SQLITE,
  412. ]
  413. steps:
  414. - name: checkout
  415. uses: actions/checkout@v4
  416. - name: Install Nix
  417. uses: DeterminateSystems/nix-installer-action@v17
  418. - name: Nix Cache
  419. uses: DeterminateSystems/magic-nix-cache-action@main
  420. - name: Rust Cache
  421. uses: Swatinem/rust-cache@v2
  422. with:
  423. shared-key: "stable"
  424. - name: Start Keycloak with Backup
  425. run: |
  426. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  427. 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
  428. - name: Verify Keycloak Import
  429. run: |
  430. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  431. - name: Test fake auth mint
  432. 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
  433. - name: Stop and clean up Docker Compose
  434. run: |
  435. docker compose -f misc/keycloak/docker-compose-recover.yml down
  436. doc-tests:
  437. name: "Documentation Tests"
  438. runs-on: ubuntu-latest
  439. timeout-minutes: 30
  440. needs: pre-commit-checks
  441. steps:
  442. - name: checkout
  443. uses: actions/checkout@v4
  444. - name: Install Nix
  445. uses: DeterminateSystems/nix-installer-action@v17
  446. - name: Nix Cache
  447. uses: DeterminateSystems/magic-nix-cache-action@main
  448. - name: Rust Cache
  449. uses: Swatinem/rust-cache@v2
  450. with:
  451. shared-key: "stable"
  452. - name: Run doc tests
  453. run: nix develop -i -L .#stable --command cargo test --doc
  454. strict-docs:
  455. name: "Strict Documentation Check"
  456. runs-on: ubuntu-latest
  457. timeout-minutes: 30
  458. needs: doc-tests
  459. steps:
  460. - name: checkout
  461. uses: actions/checkout@v4
  462. - name: Install Nix
  463. uses: DeterminateSystems/nix-installer-action@v17
  464. - name: Nix Cache
  465. uses: DeterminateSystems/magic-nix-cache-action@main
  466. - name: Rust Cache
  467. uses: Swatinem/rust-cache@v2
  468. with:
  469. shared-key: "stable"
  470. - name: Check docs with strict warnings
  471. run: nix develop -i -L .#stable --command just docs-strict