ci.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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-phoenixd,
  34. -p cdk-strike,
  35. -p cdk-lnbits
  36. -p cdk-integration-tests,
  37. -p cdk-fake-wallet,
  38. --bin cdk-cli,
  39. --bin cdk-mintd,
  40. ]
  41. steps:
  42. - name: Checkout
  43. uses: actions/checkout@v3
  44. - name: Cache
  45. uses: actions/cache@v3
  46. with:
  47. path: |
  48. ~/.cargo/registry
  49. ~/.cargo/git
  50. target
  51. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  52. - name: Set default toolchain
  53. run: rustup default ${{ matrix.rust.version }}
  54. - name: Set profile
  55. run: rustup set profile minimal && rustup component add clippy
  56. - name: Build
  57. run: cargo build ${{ matrix.build-args }}
  58. - name: Clippy
  59. run: cargo clippy ${{ matrix.build-args }} -- -D warnings
  60. build-wasm:
  61. name: Build WASM
  62. runs-on: ubuntu-latest
  63. strategy:
  64. matrix:
  65. rust:
  66. - version: stable
  67. build-args:
  68. [
  69. -p cdk,
  70. -p cdk --no-default-features,
  71. -p cdk --no-default-features --features wallet,
  72. -p cdk-js
  73. ]
  74. steps:
  75. - name: Checkout
  76. uses: actions/checkout@v3
  77. - name: Cache
  78. uses: actions/cache@v3
  79. with:
  80. path: |
  81. ~/.cargo/registry
  82. ~/.cargo/git
  83. target
  84. key: ${{ runner.os }}-cargo-wasm32-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  85. - name: Set default toolchain
  86. run: rustup default ${{ matrix.rust.version }}
  87. - name: Add WASM
  88. run: rustup target add wasm32-unknown-unknown
  89. - name: Set profile
  90. run: rustup set profile minimal && rustup component add clippy
  91. - name: Build
  92. run: cargo build ${{ matrix.build-args }} --target wasm32-unknown-unknown
  93. - name: Clippy
  94. run: cargo clippy ${{ matrix.build-args }} --target wasm32-unknown-unknown -- -D warnings
  95. run-examples:
  96. name: Run Examples
  97. runs-on: ubuntu-latest
  98. strategy:
  99. matrix:
  100. rust:
  101. - version: stable
  102. build-args:
  103. [
  104. mint-token,
  105. p2pk,
  106. proof-selection,
  107. wallet
  108. ]
  109. steps:
  110. - name: Checkout
  111. uses: actions/checkout@v3
  112. - name: Cache
  113. uses: actions/cache@v3
  114. with:
  115. path: |
  116. ~/.cargo/registry
  117. ~/.cargo/git
  118. target
  119. key: ${{ runner.os }}-cargo-wasm32-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  120. - name: Set default toolchain
  121. run: rustup default ${{ matrix.rust.version }}
  122. - name: Run
  123. run: cargo run --example ${{ matrix.build-args }}