sculkr 0.2.3

Companion CLI for packwiz - generate modlists and track Minecraft modpack changes
name: Checks

# Called by ci.yml and tagged_release.yml so both run the same checks against
# the same definition, rather than two copies that drift apart.
on:
  workflow_call:

permissions:
  contents: read

# A caller's env does not reach a reusable workflow, so these are repeated here.
env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0
  RUST_BACKTRACE: 1

jobs:
  lint:
    name: Lint (fmt, clippy, docs)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Install stable toolchain
        uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
        with:
          toolchain: stable
          components: clippy

      - name: Install nightly rustfmt
        uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
        with:
          toolchain: nightly
          components: rustfmt

      - name: Cache cargo artifacts
        uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          key: lint

      # Installing nightly leaves it as the default, so every step names its
      # toolchain rather than trusting whichever was installed last.
      - name: Check formatting
        run: cargo +nightly fmt --all --check

      - name: Clippy
        run: cargo +stable clippy --locked --all-targets --all-features -- -D warnings

      - name: Check documentation
        env:
          RUSTDOCFLAGS: -D warnings
        run: cargo +stable doc --locked --no-deps --all-features

  test:
    name: Test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
        with:
          toolchain: stable

      - name: Cache cargo artifacts
        uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          key: test-${{ matrix.os }}

      - name: Install cargo-nextest
        uses: taiki-e/install-action@fa23953489c080190314742a9b907f8e97c6767c # v2.87.10
        with:
          tool: nextest

      - name: Run tests
        run: cargo nextest run --locked --all-features

  msrv:
    name: MSRV (1.88)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
        with:
          toolchain: "1.88.0"

      - name: Cache cargo artifacts
        uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          key: msrv

      - name: Check
        run: cargo check --locked --all-targets --all-features