cargo-affected 0.2.0

Run only the tests affected by git changes, using LLVM coverage.
name: ci

# Runner versions are pinned to avoid surprise breaking changes from -latest
# migrations. The matrix covers `x86_64-pc-windows-msvc` alongside Linux and
# macOS โ€” `x86_64-pc-windows-gnu` and `aarch64-pc-windows-msvc` are
# documented as broken upstream (rust-lang/rust#111098, #150123) and are
# excluded.

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

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
  CARGO_TERM_COLOR: always
  # CI does clean builds, so incremental compilation tracking adds I/O overhead
  # with no benefit.
  CARGO_INCREMENTAL: 0

jobs:
  lint:
    runs-on: ubuntu-24.04
    steps:
    - name: ๐Ÿ“‚ Checkout code
      uses: actions/checkout@v6

    - name: ๐Ÿ’ฐ Cache
      uses: Swatinem/rust-cache@v2

    - name: ๐Ÿ” Clippy
      run: cargo clippy --all-targets -- -D warnings

  test:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-24.04
            name: linux
          - os: macos-15
            name: macos
          - os: windows-2022
            name: windows
    name: test (${{ matrix.name }})
    runs-on: ${{ matrix.os }}

    steps:
    - name: ๐Ÿ“‚ Checkout code
      uses: actions/checkout@v6

    - name: Install llvm-tools
      run: rustup component add llvm-tools

    - name: Install cargo-nextest
      uses: baptiste0928/cargo-install@v3
      with:
        crate: cargo-nextest
        version: "=0.9.132"

    - name: ๐Ÿ’ฐ Cache
      uses: Swatinem/rust-cache@v2

    - name: ๐Ÿงช Tests
      run: cargo test