whichdisk 0.4.0

Cross-platform disk/volume resolver — given a path, tells you which disk it's on, its mount point, relative path, and disk usage
Documentation
name: CI

on:
  push:
    branches:
      - main
    paths-ignore:
      - 'README'
      - 'COPYRIGHT'
      - 'LICENSE-*'
      - '**.md'
      - '**.txt'
  pull_request:
    paths-ignore:
      - 'README'
      - 'COPYRIGHT'
      - 'LICENSE-*'
      - '**.md'
      - '**.txt'
  workflow_dispatch:
  schedule: [cron: "0 1 */30 * *"]

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -Dwarnings
  RUST_BACKTRACE: 1

jobs:
  # Check formatting (platform-independent, one OS is enough)
  rustfmt:
    name: rustfmt
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - name: Install Rust
      run: rustup update stable && rustup default stable && rustup component add rustfmt
    - name: Check formatting
      run: cargo fmt --all -- --check

  # Apply clippy lints
  clippy:
    name: clippy
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v6
    - name: Install Rust
      # --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
      run: rustup update stable --no-self-update && rustup default stable && rustup component add clippy
    - name: Install cargo-hack
      run: cargo install cargo-hack
    - name: Apply clippy lints
      run: cargo hack clippy --each-feature

  build:
    name: build
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v6
    - name: Cache cargo build and registry
      uses: actions/cache@v5
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ${{ runner.os }}-build-
    - name: Install Rust
      # --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
      run: rustup update stable --no-self-update && rustup default stable
    - name: Install cargo-hack
      run: cargo install cargo-hack
    - name: Run build
      run: cargo hack build --feature-powerset

  test:
    name: test
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v6
    - name: Cache cargo build and registry
      uses: actions/cache@v5
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ${{ runner.os }}-test-
    - name: Install Rust
      # --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
      run: rustup update stable --no-self-update && rustup default stable
    - name: Install cargo-hack
      run: cargo install cargo-hack
    - name: Run test
      run: cargo hack test --feature-powerset