chia-peer 0.1.3

DIG Chia light-client connectivity: a wallet-protocol full-node client + ChainSource provider (dig-node seam 1)
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  build-test:
    name: Build, Test & Lint (Rust)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt, clippy, llvm-tools-preview

      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Install cargo-nextest
        uses: taiki-e/install-action@nextest

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Check clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      # Coverage MUST be collected via the combined `cargo llvm-cov nextest` form so llvm-cov
      # drives nextest directly -- never run `cargo nextest run` and `cargo llvm-cov` as two
      # separate steps, that collects zero coverage (see chia-query #489). Gated at >= 80% lines
      # (CLAUDE.md ยง2.3); retries so a flake is reported FLAKY rather than blocking.
      - name: Run tests with coverage (gate >= 80%)
        run: cargo llvm-cov nextest --fail-under-lines 80 --all-features --workspace --lcov --output-path lcov.info --retries 2

      - name: Coverage summary
        if: always()
        run: cargo llvm-cov report --summary-only

      - name: Upload coverage artifact
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: lcov-coverage
          path: lcov.info
          if-no-files-found: warn

      - name: Check documentation
        run: cargo doc --no-deps --all-features