minigraf 1.1.1

Zero-config, single-file, embedded graph database with bi-temporal Datalog queries
Documentation
name: Coverage Gates

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

permissions:
  contents: read

jobs:
  coverage-gates:
    name: Per-module coverage gates
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

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

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

      - name: Generate coverage (text)
        run: cargo llvm-cov --text 2>&1 > cov_text.txt || true

      - name: Check per-module thresholds
        run: |
          FAIL=0
          check_module() {
            local file=$1 threshold=$2
            local pct
            pct=$(grep "$file" cov_text.txt | grep -oP '\d+\.\d+(?=%)' | tail -1)
            if [ -z "$pct" ]; then
              echo "WARNING: $file not found in coverage report"
              return 0
            fi
            if python3 -c "import sys; sys.exit(0 if float('$pct') >= $threshold else 1)"; then
              echo "OK: $file: ${pct}% >= ${threshold}%"
            else
              echo "FAIL: $file: ${pct}% < ${threshold}%"
              return 1
            fi
          }
          # Thresholds from coverage-thresholds.toml
          check_module "wal.rs"            75 || FAIL=1
          check_module "db.rs"             70 || FAIL=1
          check_module "persistent_facts"  70 || FAIL=1
          check_module "btree_v6"          65 || FAIL=1
          check_module "executor.rs"       75 || FAIL=1
          check_module "evaluator.rs"      75 || FAIL=1
          check_module "stratification"    75 || FAIL=1
          exit $FAIL