name: Rust

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6
    - name: Install all-features
      run: cargo install cargo-all-features
    - name: Build
      run: cargo build-all-features -- --workspace
      env:
        RUSTFLAGS: -Dwarnings
    - name: Run tests
      run: cargo test-all-features -- --workspace
      env:
        RUSTFLAGS: -Dwarnings

  minimal-versions:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6
    - name: Install cargo-minimal-versions
      run: cargo install cargo-minimal-versions
    - name: Install cargo-hack
      run: cargo install cargo-hack
    - name: Test with minimal versions
      run: cargo minimal-versions --direct test
