ci.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. --bin cdk-cli,
  35. --bin cdk-mintd,
  36. --examples
  37. ]
  38. steps:
  39. - name: Checkout
  40. uses: actions/checkout@v3
  41. - name: Cache
  42. uses: actions/cache@v3
  43. with:
  44. path: |
  45. ~/.cargo/registry
  46. ~/.cargo/git
  47. target
  48. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  49. - name: Set default toolchain
  50. run: rustup default ${{ matrix.rust.version }}
  51. - name: Set profile
  52. run: rustup set profile minimal && rustup component add clippy
  53. - name: Build
  54. run: cargo build ${{ matrix.build-args }}
  55. - name: Clippy
  56. run: cargo clippy ${{ matrix.build-args }} -- -D warnings
  57. build-wasm:
  58. name: Build WASM
  59. runs-on: ubuntu-latest
  60. strategy:
  61. matrix:
  62. rust:
  63. - version: stable
  64. build-args:
  65. [
  66. -p cdk,
  67. -p cdk --no-default-features,
  68. -p cdk --no-default-features --features wallet,
  69. -p cdk-js
  70. ]
  71. steps:
  72. - name: Checkout
  73. uses: actions/checkout@v3
  74. - name: Cache
  75. uses: actions/cache@v3
  76. with:
  77. path: |
  78. ~/.cargo/registry
  79. ~/.cargo/git
  80. target
  81. key: ${{ runner.os }}-cargo-wasm32-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  82. - name: Set default toolchain
  83. run: rustup default ${{ matrix.rust.version }}
  84. - name: Add WASM
  85. run: rustup target add wasm32-unknown-unknown
  86. - name: Set profile
  87. run: rustup set profile minimal && rustup component add clippy
  88. - name: Build
  89. run: cargo build ${{ matrix.build-args }} --target wasm32-unknown-unknown
  90. - name: Clippy
  91. run: cargo clippy ${{ matrix.build-args }} --target wasm32-unknown-unknown -- -D warnings