ci.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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: 30
  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: 30
  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: 30
  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: 30
  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 "redis swagger",
  121. --bin cdk-mintd --features sqlcipher,
  122. --bin cdk-mintd --no-default-features --features lnd,
  123. --bin cdk-mintd --no-default-features --features cln,
  124. --bin cdk-mintd --no-default-features --features lnbits,
  125. --bin cdk-mintd --no-default-features --features fakewallet,
  126. --bin cdk-mintd --no-default-features --features grpc-processor,
  127. --bin cdk-mintd --no-default-features --features "management-rpc lnd",
  128. --bin cdk-mintd --no-default-features --features "management-rpc cln",
  129. --bin cdk-mintd --no-default-features --features "management-rpc lnbits",
  130. --bin cdk-mintd --no-default-features --features "management-rpc grpc-processor",
  131. --bin cdk-mintd --no-default-features --features "swagger lnd",
  132. --bin cdk-mintd --no-default-features --features "swagger cln",
  133. --bin cdk-mintd --no-default-features --features "swagger lnbits",
  134. --bin cdk-mintd --no-default-features --features "auth lnd",
  135. --bin cdk-mintd --no-default-features --features "auth cln",
  136. --bin cdk-mint-cli,
  137. ]
  138. steps:
  139. - name: checkout
  140. uses: actions/checkout@v4
  141. - name: Install Nix
  142. uses: DeterminateSystems/nix-installer-action@v17
  143. - name: Rust Cache
  144. uses: Swatinem/rust-cache@v2
  145. - name: Clippy
  146. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  147. - name: Test
  148. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  149. regtest-itest:
  150. name: "Integration regtest tests"
  151. runs-on: ubuntu-latest
  152. timeout-minutes: 30
  153. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  154. strategy:
  155. matrix:
  156. build-args:
  157. [
  158. -p cdk-integration-tests,
  159. ]
  160. database:
  161. [
  162. REDB,
  163. SQLITE,
  164. ]
  165. steps:
  166. - name: checkout
  167. uses: actions/checkout@v4
  168. - name: Install Nix
  169. uses: DeterminateSystems/nix-installer-action@v17
  170. - name: Rust Cache
  171. uses: Swatinem/rust-cache@v2
  172. - name: Test
  173. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  174. fake-mint-itest:
  175. name: "Integration fake mint tests"
  176. runs-on: ubuntu-latest
  177. timeout-minutes: 30
  178. needs: [pre-commit-checks, clippy]
  179. strategy:
  180. matrix:
  181. build-args:
  182. [
  183. -p cdk-integration-tests,
  184. ]
  185. database:
  186. [
  187. REDB,
  188. SQLITE,
  189. ]
  190. steps:
  191. - name: checkout
  192. uses: actions/checkout@v4
  193. - name: Install Nix
  194. uses: DeterminateSystems/nix-installer-action@v17
  195. - name: Rust Cache
  196. uses: Swatinem/rust-cache@v2
  197. - name: Clippy
  198. run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
  199. - name: Test fake auth mint
  200. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  201. pure-itest:
  202. name: "Integration fake wallet tests"
  203. runs-on: ubuntu-latest
  204. timeout-minutes: 30
  205. needs: [pre-commit-checks, clippy]
  206. strategy:
  207. matrix:
  208. database:
  209. [
  210. memory,
  211. sqlite,
  212. redb
  213. ]
  214. steps:
  215. - name: checkout
  216. uses: actions/checkout@v4
  217. - name: Install Nix
  218. uses: DeterminateSystems/nix-installer-action@v17
  219. - name: Rust Cache
  220. uses: Swatinem/rust-cache@v2
  221. - name: Test fake mint
  222. run: nix develop -i -L .#stable --command just test-pure ${{ matrix.database }}
  223. - name: Test 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: 30
  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@v17
  243. - name: Rust Cache
  244. uses: Swatinem/rust-cache@v2
  245. - name: Test
  246. run: nix develop -i -L .#stable --command just itest-payment-processor ${{matrix.ln}}
  247. msrv-build:
  248. name: "MSRV build"
  249. runs-on: ubuntu-latest
  250. timeout-minutes: 30
  251. needs: [pre-commit-checks, clippy, pure-itest]
  252. strategy:
  253. matrix:
  254. build-args:
  255. [
  256. -p cashu --no-default-features --features "wallet mint",
  257. -p cdk-common --no-default-features --features "wallet mint",
  258. -p cdk,
  259. -p cdk --no-default-features --features "mint auth",
  260. -p cdk --no-default-features --features "wallet auth",
  261. -p cdk --no-default-features --features "http_subscription",
  262. -p cdk-axum,
  263. -p cdk-axum --no-default-features --features redis,
  264. -p cdk-lnbits,
  265. -p cdk-fake-wallet,
  266. -p cdk-cln,
  267. -p cdk-lnd,
  268. -p cdk-mint-rpc,
  269. -p cdk-sqlite,
  270. -p cdk-mintd,
  271. -p cdk-payment-processor --no-default-features,
  272. ]
  273. steps:
  274. - name: checkout
  275. uses: actions/checkout@v4
  276. - name: Install Nix
  277. uses: DeterminateSystems/nix-installer-action@v17
  278. - name: Rust Cache
  279. uses: Swatinem/rust-cache@v2
  280. - name: Build
  281. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  282. check-wasm:
  283. name: Check WASM
  284. runs-on: ubuntu-latest
  285. timeout-minutes: 30
  286. needs: [pre-commit-checks, clippy, pure-itest]
  287. strategy:
  288. matrix:
  289. rust:
  290. - stable
  291. target:
  292. - wasm32-unknown-unknown
  293. build-args:
  294. [
  295. -p cdk,
  296. -p cdk --no-default-features,
  297. -p cdk --no-default-features --features wallet,
  298. ]
  299. steps:
  300. - name: checkout
  301. uses: actions/checkout@v4
  302. - name: Install Nix
  303. uses: DeterminateSystems/nix-installer-action@v17
  304. - name: Rust Cache
  305. uses: Swatinem/rust-cache@v2
  306. - name: Build cdk and binding
  307. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  308. check-wasm-msrv:
  309. name: Check WASM
  310. runs-on: ubuntu-latest
  311. timeout-minutes: 30
  312. needs: [pre-commit-checks, clippy, msrv-build]
  313. strategy:
  314. matrix:
  315. rust:
  316. - msrv
  317. target:
  318. - wasm32-unknown-unknown
  319. build-args:
  320. [
  321. -p cdk,
  322. -p cdk --no-default-features,
  323. -p cdk --no-default-features --features wallet,
  324. ]
  325. steps:
  326. - name: checkout
  327. uses: actions/checkout@v4
  328. - name: Install Nix
  329. uses: DeterminateSystems/nix-installer-action@v17
  330. - name: Rust Cache
  331. uses: Swatinem/rust-cache@v2
  332. - name: Build cdk wasm
  333. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  334. fake-mint-auth-itest:
  335. name: "Integration fake mint auth tests"
  336. runs-on: ubuntu-latest
  337. timeout-minutes: 30
  338. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  339. strategy:
  340. matrix:
  341. database:
  342. [
  343. REDB,
  344. SQLITE,
  345. ]
  346. steps:
  347. - name: checkout
  348. uses: actions/checkout@v4
  349. - name: Install Nix
  350. uses: DeterminateSystems/nix-installer-action@v17
  351. - name: Rust Cache
  352. uses: Swatinem/rust-cache@v2
  353. - name: Start Keycloak with Backup
  354. run: |
  355. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  356. 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
  357. - name: Verify Keycloak Import
  358. run: |
  359. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  360. - name: Test fake auth mint
  361. 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
  362. - name: Stop and clean up Docker Compose
  363. run: |
  364. docker compose -f misc/keycloak/docker-compose-recover.yml down
  365. doc-tests:
  366. name: "Documentation Tests"
  367. runs-on: ubuntu-latest
  368. timeout-minutes: 30
  369. needs: pre-commit-checks
  370. steps:
  371. - name: checkout
  372. uses: actions/checkout@v4
  373. - name: Install Nix
  374. uses: DeterminateSystems/nix-installer-action@v17
  375. - name: Rust Cache
  376. uses: Swatinem/rust-cache@v2
  377. - name: Run doc tests
  378. run: nix develop -i -L .#stable --command cargo test --doc
  379. strict-docs:
  380. name: "Strict Documentation Check"
  381. runs-on: ubuntu-latest
  382. timeout-minutes: 30
  383. needs: doc-tests
  384. steps:
  385. - name: checkout
  386. uses: actions/checkout@v4
  387. - name: Install Nix
  388. uses: DeterminateSystems/nix-installer-action@v17
  389. - name: Rust Cache
  390. uses: Swatinem/rust-cache@v2
  391. - name: Check docs with strict warnings
  392. run: nix develop -i -L .#stable --command just docs-strict