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