ci.yml 13 KB

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