chia-query 0.2.1

Query the Chia blockchain via decentralized peers with coinset.org fallback
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

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: Check formatting
        run: cargo fmt --all -- --check

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

      # Coverage is measure-only for now: the active unit-test suite is still being built out
      # (tracked in #157). It is NOT yet gated at >= 80% lines to avoid blocking this PR on a
      # large new test suite; once the suite lands the gate becomes --fail-under-lines 80.
      - name: Run tests with coverage (measure-only)
        run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info

      - 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