ci.yml 2.5 KB

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