dig-epoch 0.1.1

DIG L2 epoch geometry, phase machine, manager, and checkpoint competition types
Documentation
name: CI

# Runs on every push to main and every pull request so the test suite and
# the >=80% line-coverage gate guard ordinary development — not just tag
# publishes (which publish.yml handles). fmt + clippy + tests + coverage all
# block a merge below the floor.
on:
  push:
    branches:
      - main
  pull_request:
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test Suite + Coverage Gate
    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

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

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

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

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

      # nextest natively detects+reports flaky tests (failed-then-passed on
      # retry shows as "FLAKY" in the run summary instead of silently passing
      # or hard-failing on a one-off). Tests share RwLock-protected
      # EpochManager state, so they MUST run single-threaded (--test-threads=1).
      - name: Run tests (nextest, flaky-aware)
        run: cargo nextest run --all-features --retries 2 --test-threads=1

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

      # Coverage gate: line coverage must stay at or above 80%. `--fail-under-lines 80`
      # fails the build on a regression below the floor. The crate currently
      # measures ~99.9% lines. Uses the nextest runner so retried-flaky tests
      # are reported the same way as the plain test step above. --retries/--test-threads
      # are `cargo nextest run` options, not test-binary args, so they MUST come
      # BEFORE the `--` separator (args after `--` go to the test binary itself and
      # nextest rejects `--retries`/`--test-threads` there with "arguments are unsupported").
      - name: Coverage (>=80% lines)
        run: cargo llvm-cov nextest --all-features --retries 2 --test-threads=1 --summary-only --fail-under-lines 80

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