ci.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. fmt:
  11. name: Format
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v3
  15. - run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
  16. build:
  17. name: Build
  18. runs-on: ubuntu-latest
  19. strategy:
  20. matrix:
  21. rust:
  22. - version: stable
  23. build-args:
  24. [
  25. -p cdk,
  26. -p cdk --no-default-features,
  27. -p cdk --no-default-features --features wallet,
  28. -p cdk --no-default-features --features mint,
  29. -p cdk-redb,
  30. -p cdk-sqlite,
  31. -p cdk-axum,
  32. -p cdk-cln,
  33. -p cdk-fake-wallet,
  34. -p cdk-strike,
  35. --bin cdk-cli,
  36. --bin cdk-mintd,
  37. --examples
  38. ]
  39. steps:
  40. - name: Checkout
  41. uses: actions/checkout@v3
  42. - name: Cache
  43. uses: actions/cache@v3
  44. with:
  45. path: |
  46. ~/.cargo/registry
  47. ~/.cargo/git
  48. target
  49. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  50. - name: Set default toolchain
  51. run: rustup default ${{ matrix.rust.version }}
  52. - name: Set profile
  53. run: rustup set profile minimal && rustup component add clippy
  54. - name: Build
  55. run: cargo build ${{ matrix.build-args }}
  56. - name: Clippy
  57. run: cargo clippy ${{ matrix.build-args }} -- -D warnings
  58. build-wasm:
  59. name: Build WASM
  60. runs-on: ubuntu-latest
  61. strategy:
  62. matrix:
  63. rust:
  64. - version: stable
  65. build-args:
  66. [
  67. -p cdk,
  68. -p cdk --no-default-features,
  69. -p cdk --no-default-features --features wallet,
  70. -p cdk-js
  71. ]
  72. steps:
  73. - name: Checkout
  74. uses: actions/checkout@v3
  75. - name: Cache
  76. uses: actions/cache@v3
  77. with:
  78. path: |
  79. ~/.cargo/registry
  80. ~/.cargo/git
  81. target
  82. key: ${{ runner.os }}-cargo-wasm32-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  83. - name: Set default toolchain
  84. run: rustup default ${{ matrix.rust.version }}
  85. - name: Add WASM
  86. run: rustup target add wasm32-unknown-unknown
  87. - name: Set profile
  88. run: rustup set profile minimal && rustup component add clippy
  89. - name: Build
  90. run: cargo build ${{ matrix.build-args }} --target wasm32-unknown-unknown
  91. - name: Clippy
  92. run: cargo clippy ${{ matrix.build-args }} --target wasm32-unknown-unknown -- -D warnings