ci.yml 2.4 KB

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