name: Tui-scrollbar

permissions:
  contents: read

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  check:
    name: Check (${{ matrix.features.name }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        features:
          - name: default
            args: -p tui-scrollbar --locked
          - name: all-features
            args: -p tui-scrollbar --locked --all-features
          - name: crossterm
            args: -p tui-scrollbar --locked --no-default-features --features crossterm
          - name: crossterm_0_28
            args: -p tui-scrollbar --locked --no-default-features --features crossterm_0_28
          - name: crossterm_0_29
            args: -p tui-scrollbar --locked --no-default-features --features crossterm_0_29
          - name: crossterm_0_28+crossterm_0_29
            args: -p tui-scrollbar --locked --no-default-features --features crossterm_0_28,crossterm_0_29
    steps:
      - name: Checkout repository
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
        with:
          persist-credentials: false
      - name: Install Rust toolchain (stable)
        uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
        with:
          toolchain: stable
      - name: Cargo check
        run: cargo check ${{ matrix.features.args }}

  docsrs:
    name: docs.rs
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
        with:
          persist-credentials: false
      - name: Install Rust toolchain (nightly)
        uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
        with:
          toolchain: nightly
      - name: Install cargo-docs-rs
        uses: taiki-e/install-action@7a79fe8c3a13344501c80d99cae481c1c9085912 # v2.81.10
        with:
          tool: cargo-docs-rs
      - name: Cargo doc (docsrs)
        run: cargo docs-rs -p tui-scrollbar --locked
