ci.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. self-care:
  11. name: Flake self-check
  12. runs-on: ubuntu-latest
  13. timeout-minutes: 15
  14. steps:
  15. - uses: actions/checkout@v4
  16. - name: Check Nix flake inputs
  17. uses: DeterminateSystems/flake-checker-action@v7
  18. with:
  19. fail-mode: true
  20. pre-commit-checks:
  21. name: "Cargo fmt, typos"
  22. runs-on: ubuntu-latest
  23. timeout-minutes: 15
  24. steps:
  25. - name: checkout
  26. uses: actions/checkout@v4
  27. - name: Install Nix
  28. uses: DeterminateSystems/nix-installer-action@v11
  29. - name: Nix Cache
  30. uses: DeterminateSystems/magic-nix-cache-action@v6
  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@v11
  62. - name: Nix Cache
  63. uses: DeterminateSystems/magic-nix-cache-action@v6
  64. - name: Rust Cache
  65. uses: Swatinem/rust-cache@v2
  66. - name: Run example
  67. run: nix develop -i -L .#stable --command cargo r --example ${{ matrix.build-args }}
  68. clippy:
  69. name: "Stable build, clippy and test"
  70. runs-on: ubuntu-latest
  71. timeout-minutes: 15
  72. needs: pre-commit-checks
  73. strategy:
  74. matrix:
  75. build-args:
  76. [
  77. -p cashu,
  78. -p cashu --no-default-features,
  79. -p cashu --no-default-features --features wallet,
  80. -p cashu --no-default-features --features mint,
  81. -p cashu --no-default-features --features "mint swagger",
  82. -p cashu --no-default-features --features auth,
  83. -p cashu --no-default-features --features "mint auth",
  84. -p cashu --no-default-features --features "wallet auth",
  85. -p cdk-common,
  86. -p cdk-common --no-default-features,
  87. -p cdk-common --no-default-features --features wallet,
  88. -p cdk-common --no-default-features --features mint,
  89. -p cdk-common --no-default-features --features "mint swagger",
  90. -p cdk-common --no-default-features --features "auth",
  91. -p cdk-common --no-default-features --features "mint auth",
  92. -p cdk-common --no-default-features --features "wallet auth",
  93. -p cdk,
  94. -p cdk --no-default-features,
  95. -p cdk --no-default-features --features wallet,
  96. -p cdk --no-default-features --features mint,
  97. -p cdk --no-default-features --features "mint swagger",
  98. -p cdk --no-default-features --features auth,
  99. -p cdk --features auth,
  100. -p cdk --no-default-features --features "auth mint",
  101. -p cdk --no-default-features --features "auth wallet",
  102. -p cdk-redb,
  103. -p cdk-sqlite,
  104. -p cdk-sqlite --features sqlcipher,
  105. -p cdk-axum --no-default-features,
  106. -p cdk-axum --no-default-features --features swagger,
  107. -p cdk-axum --no-default-features --features redis,
  108. -p cdk-axum --no-default-features --features "redis swagger",
  109. -p cdk-axum --no-default-features --features "auth redis",
  110. -p cdk-axum,
  111. -p cdk-cln,
  112. -p cdk-lnd,
  113. -p cdk-lnbits,
  114. -p cdk-fake-wallet,
  115. -p cdk-payment-processor,
  116. --bin cdk-cli,
  117. --bin cdk-cli --features sqlcipher,
  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@v11
  144. - name: Nix Cache
  145. uses: DeterminateSystems/magic-nix-cache-action@v6
  146. - name: Rust Cache
  147. uses: Swatinem/rust-cache@v2
  148. - name: Clippy
  149. run: nix develop -i -L .#stable --command cargo clippy ${{ matrix.build-args }} -- -D warnings
  150. - name: Test
  151. run: nix develop -i -L .#stable --command cargo test ${{ matrix.build-args }}
  152. regtest-itest:
  153. name: "Integration regtest tests"
  154. runs-on: ubuntu-latest
  155. timeout-minutes: 15
  156. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  157. strategy:
  158. matrix:
  159. build-args:
  160. [
  161. -p cdk-integration-tests,
  162. ]
  163. database:
  164. [
  165. REDB,
  166. SQLITE,
  167. ]
  168. steps:
  169. - name: checkout
  170. uses: actions/checkout@v4
  171. - name: Install Nix
  172. uses: DeterminateSystems/nix-installer-action@v11
  173. - name: Nix Cache
  174. uses: DeterminateSystems/magic-nix-cache-action@v6
  175. - name: Rust Cache
  176. uses: Swatinem/rust-cache@v2
  177. - name: Test
  178. run: nix develop -i -L .#stable --command just itest ${{ matrix.database }}
  179. fake-mint-itest:
  180. name: "Integration fake mint tests"
  181. runs-on: ubuntu-latest
  182. timeout-minutes: 15
  183. needs: [pre-commit-checks, clippy]
  184. strategy:
  185. matrix:
  186. build-args:
  187. [
  188. -p cdk-integration-tests,
  189. ]
  190. database:
  191. [
  192. REDB,
  193. SQLITE,
  194. ]
  195. steps:
  196. - name: checkout
  197. uses: actions/checkout@v4
  198. - name: Install Nix
  199. uses: DeterminateSystems/nix-installer-action@v11
  200. - name: Nix Cache
  201. uses: DeterminateSystems/magic-nix-cache-action@v6
  202. - name: Rust Cache
  203. uses: Swatinem/rust-cache@v2
  204. - name: Clippy
  205. run: nix develop -i -L .#stable --command cargo clippy -- -D warnings
  206. - name: Test fake auth mint
  207. run: nix develop -i -L .#stable --command just fake-mint-itest ${{ matrix.database }}
  208. pure-itest:
  209. name: "Integration fake wallet tests"
  210. runs-on: ubuntu-latest
  211. timeout-minutes: 15
  212. needs: [pre-commit-checks, clippy]
  213. steps:
  214. - name: checkout
  215. uses: actions/checkout@v4
  216. - name: Install Nix
  217. uses: DeterminateSystems/nix-installer-action@v11
  218. - name: Nix Cache
  219. uses: DeterminateSystems/magic-nix-cache-action@v6
  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
  224. payment-processor-itests:
  225. name: "Payment processor tests"
  226. runs-on: ubuntu-latest
  227. timeout-minutes: 15
  228. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest, regtest-itest]
  229. strategy:
  230. matrix:
  231. ln:
  232. [
  233. FAKEWALLET,
  234. CLN,
  235. LND
  236. ]
  237. steps:
  238. - name: checkout
  239. uses: actions/checkout@v4
  240. - name: Install Nix
  241. uses: DeterminateSystems/nix-installer-action@v11
  242. - name: Nix Cache
  243. uses: DeterminateSystems/magic-nix-cache-action@v6
  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@v11
  279. - name: Nix Cache
  280. uses: DeterminateSystems/magic-nix-cache-action@v6
  281. - name: Rust Cache
  282. uses: Swatinem/rust-cache@v2
  283. - name: Build
  284. run: nix develop -i -L .#msrv --command cargo build ${{ matrix.build-args }}
  285. check-wasm:
  286. name: Check WASM
  287. runs-on: ubuntu-latest
  288. timeout-minutes: 15
  289. needs: [pre-commit-checks, clippy, pure-itest]
  290. strategy:
  291. matrix:
  292. rust:
  293. - stable
  294. target:
  295. - wasm32-unknown-unknown
  296. build-args:
  297. [
  298. -p cdk,
  299. -p cdk --no-default-features,
  300. -p cdk --no-default-features --features wallet,
  301. ]
  302. steps:
  303. - name: checkout
  304. uses: actions/checkout@v4
  305. - name: Install Nix
  306. uses: DeterminateSystems/nix-installer-action@v11
  307. - name: Nix Cache
  308. uses: DeterminateSystems/magic-nix-cache-action@v6
  309. - name: Rust Cache
  310. uses: Swatinem/rust-cache@v2
  311. - name: Build cdk and binding
  312. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  313. check-wasm-msrv:
  314. name: Check WASM
  315. runs-on: ubuntu-latest
  316. timeout-minutes: 15
  317. needs: [pre-commit-checks, clippy, msrv-build]
  318. strategy:
  319. matrix:
  320. rust:
  321. - msrv
  322. target:
  323. - wasm32-unknown-unknown
  324. build-args:
  325. [
  326. -p cdk,
  327. -p cdk --no-default-features,
  328. -p cdk --no-default-features --features wallet,
  329. ]
  330. steps:
  331. - name: checkout
  332. uses: actions/checkout@v4
  333. - name: Install Nix
  334. uses: DeterminateSystems/nix-installer-action@v11
  335. - name: Nix Cache
  336. uses: DeterminateSystems/magic-nix-cache-action@v6
  337. - name: Rust Cache
  338. uses: Swatinem/rust-cache@v2
  339. - name: Build cdk wasm
  340. run: nix develop -i -L ".#${{ matrix.rust }}" --command cargo build ${{ matrix.build-args }} --target ${{ matrix.target }}
  341. fake-mint-auth-itest:
  342. name: "Integration fake mint auth tests"
  343. runs-on: ubuntu-latest
  344. timeout-minutes: 15
  345. needs: [pre-commit-checks, clippy, pure-itest, fake-mint-itest]
  346. strategy:
  347. matrix:
  348. database:
  349. [
  350. REDB,
  351. SQLITE,
  352. ]
  353. steps:
  354. - name: checkout
  355. uses: actions/checkout@v4
  356. - name: Install Nix
  357. uses: DeterminateSystems/nix-installer-action@v11
  358. - name: Nix Cache
  359. uses: DeterminateSystems/magic-nix-cache-action@v6
  360. - name: Rust Cache
  361. uses: Swatinem/rust-cache@v2
  362. - name: Start Keycloak with Backup
  363. run: |
  364. docker compose -f misc/keycloak/docker-compose-recover.yml up -d
  365. 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
  366. - name: Verify Keycloak Import
  367. run: |
  368. docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported"
  369. - name: Test fake auth mint
  370. 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
  371. - name: Stop and clean up Docker Compose
  372. run: |
  373. docker compose -f misc/keycloak/docker-compose-recover.yml down