sculkr 0.2.1

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

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

permissions:
  contents: read

concurrency:
  group: ci-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

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@v4

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

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

      - name: Cache cargo artifacts
        uses: Swatinem/rust-cache@v2
        with:
          key: lint

      - 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@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

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

      - name: Install cargo-nextest
        uses: taiki-e/install-action@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@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@1.88.0

      - name: Cache cargo artifacts
        uses: Swatinem/rust-cache@v2
        with:
          key: msrv

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