axterminator 0.10.2

macOS GUI testing framework with background testing, sub-millisecond element access, and self-healing locators
name: CI

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

env:
  CARGO_TERM_COLOR: always

jobs:
  check:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
      - uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2.9.1
      - run: cargo check --all-features

  test:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
      - uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2.9.1
      # macos-latest's Xcode 26.5 image is missing libclang_rt.osx.a at the path
      # clang reports, so linking objects that use @available (which needs
      # __isPlatformVersionAtLeast from that lib) fails with "library
      # 'clang_rt.osx' not found". Find the runtime lib wherever the image keeps
      # it and add its directory to the link search path, so we build on the
      # latest toolchain rather than pinning to an old runner image.
      - name: ensure compiler-rt is linkable
        run: |
          echo "xcode-select: $(xcode-select -p)"
          echo "clang runtime-dir: $(clang -print-runtime-dir 2>&1)"
          lib=$(find /Applications/Xcode*.app /Library/Developer -name 'libclang_rt.osx.a' 2>/dev/null | head -1)
          echo "libclang_rt.osx.a: ${lib:-<not found on runner>}"
          if [ -n "$lib" ]; then
            echo "RUSTFLAGS=-L $(dirname "$lib") ${RUSTFLAGS:-}" >> "$GITHUB_ENV"
          fi
      # Skip live macOS session tests; permission probes that self-skip still run in CI.
      - run: cargo test --all-features -- --skip live_

  fmt:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: rustfmt
      - run: cargo fmt --all -- --check

  secrets-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 0
      - uses: trufflesecurity/trufflehog@05a583290be8c8f79852eb8741f5042920b47d00 # main
        with:
          extra_args: --only-verified

  # Dependency-vulnerability gate: scans Cargo.lock against the OSV database on
  # every PR and push. Fails the build on any known, fixable vuln so a security
  # fix lands with the change that introduces (or fails to bump past) it — not
  # weeks later. osv-scanner is the only dep-vuln gate in this repo; cargo's
  # dependabot updater PROPOSES bumps, this gate DISPOSES — it refuses to ship
  # until the fix is merged. Accepted/unfixable vulns are time-boxed in
  # .github/osv-scanner.toml. The release.yml `security-gate` job is the backstop.
  osv-scan:
    name: OSV vulnerability scan
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - name: Scan Rust dependencies against OSV
        uses: google/osv-scanner-action/osv-scanner-action@6e4298ebc4db23e847df9b2e2de2939d6f066c67 # v2.5.1
        with:
          scan-args: |-
            --config=.github/osv-scanner.toml
            --recursive
            ./

  clippy:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2.9.1
      - run: cargo clippy --all-features -- -D warnings -A unexpected_cfgs -A clippy::collapsible_if -A clippy::unnecessary_cast

  bench-build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
      - uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2.9.1
      # Type-check benchmarks in CI so performance-critical paths keep building.
      # Full Criterion runs still belong on an interactive macOS host because
      # Accessibility and WindowServer availability vary on hosted runners.
      # All-features coverage is handled by the check/test/clippy jobs; keeping
      # this as `cargo check` avoids release/LTO link cost on every PR.
      - run: cargo check --benches