srz 0.4.0

Fast, modular CLI to summarize webpages, documents, books, and live news using local LLMs
name: CI & Security

on:
  push:
    branches:
      - master
    paths:
      - 'src/**'
      - 'tests/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/ci.yml'
  pull_request:
    branches:
      - master
    paths:
      - 'src/**'
      - 'tests/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/ci.yml'
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read
  actions: write

jobs:
  test:
    name: Test & Lint (${{ matrix.os }})
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
          - os: macos-latest
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy

      - name: Set up sccache
        uses: mozilla/sccache-action@v0.0.8

      - name: Configure sccache
        shell: bash
        run: |
          echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
          echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV

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

      - name: Install Linux build dependencies
        if: matrix.os == 'ubuntu-latest'
        run: |
          sudo apt-get update
          sudo apt-get install -y pkg-config libssl-dev build-essential cmake

      - name: Run cargo test
        run: cargo test --all-targets

      - name: Run cargo clippy (warnings denied)
        run: cargo clippy --all-targets -- -D warnings

      - name: Show sccache stats
        if: always()
        run: sccache --show-stats

  security-audit:
    name: Dependency Security Audit
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

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

      - name: Run cargo audit
        run: cargo audit