ci.yml 3.4 KB

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