ci.yml 2.4 KB

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