ci.yml 2.6 KB

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