ci.yml 14 KB

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