ci.yml 2.3 KB

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