---
name: Rust

"on":
  push:
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
      fail-fast: false

    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: '3.x'
      - run: |
          python -m pip install python_debian
      - name: Build
        run: cargo build --verbose
      - name: Install cargo-all-features
        run: cargo install cargo-all-features
      - name: Run tests
        run: cargo test-all-features
      - name: Check formatting
        run: cargo fmt -- --check

  test-minimal-versions:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: '3.x'
      - run: |
          python -m pip install python_debian
      - name: Install cargo-hack
        run: cargo install cargo-hack
      - name: Install cargo-minimal-versions
        run: cargo install cargo-minimal-versions
      - name: Test with minimal versions (all features)
        run: cargo minimal-versions test --all-features

  test-maximal-versions:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: '3.x'
      - run: |
          python -m pip install python_debian
      - name: Update to maximal versions
        run: cargo update
      - name: Install cargo-all-features
        run: cargo install cargo-all-features
      - name: Test with maximal versions
        run: cargo test-all-features
