spec-drift 0.1.0

Semantic coherence analysis between specification and implementation for Rust projects.
Documentation
name: Rust

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

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: "1.95"
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - name: Build
        run: cargo build --verbose
      - name: Run tests
        run: cargo test --verbose
      - name: Clippy
        run: cargo clippy --all-targets -- -D warnings

  self-check:
    name: spec-drift (self)
    runs-on: ubuntu-latest
    needs: build
    permissions:
      contents: read
      security-events: write  # required to upload SARIF to code scanning
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # --blame needs full history

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: "1.95"

      - uses: Swatinem/rust-cache@v2

      - name: Build spec-drift
        run: cargo build --release

      - name: Run spec-drift (human report)
        run: ./target/release/spec-drift --deny warning

      - name: Run spec-drift (SARIF + blame)
        if: always()
        run: |
          ./target/release/spec-drift --format sarif --blame > spec-drift.sarif \
            || echo "spec-drift reported divergences; SARIF still emitted"

      - name: Upload SARIF to GitHub code scanning
        if: always()
        uses: github/codeql-action/upload-sarif@v4
        with:
          sarif_file: spec-drift.sarif
          category: spec-drift

      - name: Archive SARIF artifact
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: spec-drift-sarif
          path: spec-drift.sarif