ci.yml 2.5 KB

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