avanalyze 0.1.0

Long-running Apple Vision.framework worker that analyses keyframes and emits mediaschema-shaped detections.
Documentation
name: CI

on:
  push:
    branches:
      - main
    paths-ignore:
      - 'README'
      - 'COPYRIGHT'
      - 'LICENSE-*'
      - '**.md'
      - '**.txt'
  pull_request:
    paths-ignore:
      - 'README'
      - 'COPYRIGHT'
      - 'LICENSE-*'
      - '**.md'
      - '**.txt'
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -Dwarnings
  RUST_BACKTRACE: 1

# avanalyze is a macOS-only Apple Vision wrapper — every Vision call is
# `cfg(target_os = "macos")`-gated and the non-macOS surface is a structured
# `ErrorCode::AppleVisionFailed` stub. So:
#
# - macOS jobs run the real test surface (clippy, tests, doc, feature matrix).
# - Linux job verifies the cfg-gated stub still compiles — keeps the crate
#   usable as a workspace-dep on non-macOS hosts.
# - Sanitizer / miri / loom / cross-target / Windows jobs from the template
#   were removed: they can't meaningfully run on objc2 / Vision code paths.

jobs:
  rustfmt:
    name: rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install Rust
        run: rustup update stable && rustup default stable && rustup component add rustfmt
      - name: cargo fmt --check
        run: cargo fmt --all -- --check

  clippy-macos:
    name: clippy (macos)
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      - name: Cache cargo build and registry
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: macos-clippy-${{ hashFiles('**/Cargo.lock', 'Cargo.toml') }}
          restore-keys: |
            macos-clippy-
      - name: Install Rust
        run: rustup update stable && rustup default stable && rustup component add clippy
      - name: Install cargo-hack
        run: cargo install --locked cargo-hack
      - name: clippy --each-feature (-D warnings)
        run: cargo hack clippy --each-feature --tests --no-deps -- -D warnings

  test-macos:
    name: test (macos)
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      - name: Cache cargo build and registry
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: macos-test-${{ hashFiles('**/Cargo.lock', 'Cargo.toml') }}
          restore-keys: |
            macos-test-
      - name: Install Rust
        run: rustup update stable && rustup default stable
      - name: cargo test --all-features
        run: cargo test --all-features --lib --no-fail-fast

  doc-macos:
    name: doc (macos)
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      - name: Cache cargo build and registry
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: macos-doc-${{ hashFiles('**/Cargo.lock', 'Cargo.toml') }}
          restore-keys: |
            macos-doc-
      - name: Install Rust
        run: rustup update stable && rustup default stable
      - name: cargo doc --all-features --no-deps
        env:
          RUSTDOCFLAGS: -Dwarnings
        run: cargo doc --all-features --no-deps

  # Sanity check: the non-macOS stub (`VisionAnalyzer::analyze_keyframe`
  # returns a structured platform-unavailable error) must still compile so
  # downstream workspaces can keep avanalyze in their dep tree on any host.
  build-stub-linux:
    name: build stub (linux)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install Rust
        run: rustup update stable && rustup default stable
      - name: cargo check --all-features (cfg-gated stub)
        run: cargo check --all-features