relay-knowledge 1.1.4

Graph-database-based knowledge graph project.
Documentation
name: PR Checks

on:
  pull_request:
    branches:
      - main
    types:
      - opened
      - synchronize
      - reopened
      - ready_for_review
  push:
    branches:
      - main
  workflow_dispatch:

concurrency:
  group: pr-checks-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  format:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy

      - name: Format gate
        run: cargo fmt --all -- --check

  clippy:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal --component clippy

      - name: Clippy gate
        run: cargo clippy --all-targets --all-features -- -D warnings

  unit-test:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal

      - name: Unit and integration test suite
        run: cargo test --all-targets --all-features

      - name: GraphRAG evaluation fixture gate
        run: cargo test --test relay_knowledge graphrag_fixture_dataset_scores_phase4_cases

  skill-metadata:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal

      - name: Skill metadata gate
        shell: bash
        run: |
          set -euo pipefail
          manifest_version="$(cargo metadata --no-deps --format-version 1 \
            | python3 -c 'import json,sys; print(json.load(sys.stdin)["packages"][0]["version"])')"
          python3 tools/release/update_skill_metadata_version.py --self-test --check \
            skills/relay-knowledge-cli/SKILL.md "$manifest_version"

      - name: Linux glibc compatibility policy gate
        run: |
          python3 tools/release/check_linux_glibc_compat.py --self-test \
            --verify-workflow .github/workflows/release.yml

  coverage:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal

      - name: Install cargo-llvm-cov
        run: cargo install cargo-llvm-cov --locked

      - name: Unit coverage gate
        run: cargo llvm-cov --all-targets --all-features --fail-under-lines 90

  build:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal

      - name: Build
        run: cargo build --all-targets --all-features

      - name: Verify repository is unchanged after checks
        run: git diff --exit-code

  runtime-smoke:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal

      - name: Set up Node
        uses: actions/setup-node@v4
        with:
          node-version: '24'

      - name: Build release binary
        run: cargo build --release

      - name: Install Web dependencies
        run: npm ci
        working-directory: web

      - name: Build Web diagnostics
        run: npm run build
        working-directory: web

      - name: run.sh runtime smoke gate
        run: sh tests/runtime/run_sh_smoke.sh

  browser-integration:
    if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    env:
      PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Set up uv
        uses: astral-sh/setup-uv@v6

      - name: Set up Node
        uses: actions/setup-node@v4
        with:
          node-version: '24'

      - name: Install Web dependencies
        run: npm ci
        working-directory: web

      - name: Build Web diagnostics
        run: npm run build
        working-directory: web

      - name: Install browser test dependencies
        run: uv sync --extra dev --no-default-groups

      - name: Install Playwright Chromium
        run: uv run --extra dev python -m playwright install --with-deps chromium

      - name: Browser integration gate
        run: uv run --extra dev pytest tests/browser