ci.yml 2.5 KB

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