git-vet 0.1.3

Git-based review gate for tracked file contents
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-Dwarnings"

permissions:
  contents: read

jobs:
  checks:
    runs-on: ubuntu-latest
    env:
      CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: allow
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: clippy, rustfmt

      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Clippy (all features)
        run: cargo clippy --workspace --all-targets --all-features

      - name: Clippy (no default features)
        run: cargo clippy --workspace --all-targets --no-default-features

      - name: Rustfmt
        run: cargo fmt --check --all

      - name: Doc
        env:
          RUSTDOCFLAGS: "-Dwarnings"
        run: cargo doc --workspace --no-deps

      - name: Check
        run: cargo check --workspace

      - name: Verify no uncommitted changes
        run: git diff --exit-code

  test:
    name: test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
        if: matrix.os != 'windows-latest'

      - name: Test
        run: cargo test --workspace

  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@0fd46367812ee04360509b4169d9f659d6892bb2 # v2.79.15
        with:
          tool: cargo-llvm-cov

      - name: Generate coverage
        run: cargo llvm-cov --workspace --lcov --output-path lcov.info

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: lcov.info

  msrv:
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: "" # Override global -Dwarnings for MSRV check
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - uses: taiki-e/install-action@0fd46367812ee04360509b4169d9f659d6892bb2 # v2.79.15
        with:
          tool: cargo-hack

      - name: Check MSRV
        run: cargo hack check --workspace --rust-version --ignore-private

  typos:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - uses: crate-ci/typos@f8a58b6b53f2279f71eb605f03a4ae4d10608f45 # v1.47.0

  collect:
    needs: [checks, test, coverage, msrv, typos]
    if: always()
    runs-on: ubuntu-latest
    steps:
      - name: Check results
        run: |
          results=("${{ needs.checks.result }}" "${{ needs.test.result }}" "${{ needs.coverage.result }}" "${{ needs.msrv.result }}" "${{ needs.typos.result }}")
          for result in "${results[@]}"; do
            if [[ "$result" != "success" ]]; then
              echo "One or more jobs failed"
              exit 1
            fi
          done
          echo "All jobs passed"