dio-align 0.1.0

Query direct I/O alignment requirements for a filesystem path.
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 */7 * *"]

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

jobs:
  # Check formatting
  rustfmt:
    name: rustfmt
    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 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 clippy --all-features
  build:
    name: build
    strategy:
      matrix:
        os:
          - ubuntu-20.04
          - 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: Cache ~/.cargo
        uses: actions/cache@v5
        with:
          path: ~/.cargo
          key: ${{ runner.os }}-coverage-dotcargo
      - name: Run build
        run: cargo build --all-features

  test:
    name: test
    strategy:
      matrix:
        os:
          - ubuntu-20.04
          - 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: Cache ~/.cargo
        uses: actions/cache@v5
        with:
          path: ~/.cargo
          key: ${{ runner.os }}-coverage-dotcargo
      - name: Run test
        run: cargo test --all-features -- --nocapture