ci.yml 2.6 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 --no-default-features --features wallet --features nostr,
  30. -p cdk-redb,
  31. -p cdk-sqlite,
  32. --bin cdk-cli,
  33. --examples
  34. ]
  35. steps:
  36. - name: Checkout
  37. uses: actions/checkout@v3
  38. - name: Cache
  39. uses: actions/cache@v3
  40. with:
  41. path: |
  42. ~/.cargo/registry
  43. ~/.cargo/git
  44. target
  45. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  46. - name: Set default toolchain
  47. run: rustup default ${{ matrix.rust.version }}
  48. - name: Set profile
  49. run: rustup set profile minimal && rustup component add clippy
  50. - name: Build
  51. run: cargo build ${{ matrix.build-args }}
  52. - name: Clippy
  53. run: cargo clippy ${{ matrix.build-args }} -- -D warnings
  54. build-wasm:
  55. name: Build WASM
  56. runs-on: ubuntu-latest
  57. strategy:
  58. matrix:
  59. rust:
  60. - version: stable
  61. build-args:
  62. [
  63. -p cdk,
  64. -p cdk --no-default-features,
  65. -p cdk --no-default-features --features wallet,
  66. -p cdk --no-default-features --features wallet --features nostr,
  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