ci.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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-lnbits
  36. -p cdk-integration-tests,
  37. --bin cdk-cli,
  38. --bin cdk-mintd,
  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
  94. run-examples:
  95. name: Run Examples
  96. runs-on: ubuntu-latest
  97. strategy:
  98. matrix:
  99. rust:
  100. - version: stable
  101. build-args:
  102. [
  103. mint-token,
  104. p2pk,
  105. proof-selection,
  106. wallet
  107. ]
  108. steps:
  109. - name: Checkout
  110. uses: actions/checkout@v3
  111. - name: Cache
  112. uses: actions/cache@v3
  113. with:
  114. path: |
  115. ~/.cargo/registry
  116. ~/.cargo/git
  117. target
  118. key: ${{ runner.os }}-cargo-wasm32-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
  119. - name: Set default toolchain
  120. run: rustup default ${{ matrix.rust.version }}
  121. - name: Run
  122. run: cargo run --example ${{ matrix.build-args }}