ci.yml 13 KB

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