name: CI

on: [push, pull_request]

jobs:
  check:
    name: Check on v1.41
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v4

      - name: Install stable toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: 1.41.1

      - name: Run cargo check
        run: cargo check --all-features

  test:
    name: Test on stable
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v4

      - name: Install stable toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Run cargo fmt
        run: cargo fmt --all -- --check

      - name: Run cargo clippy
        run: cargo clippy --all-features -- -D warnings

      - name: Run cargo test
        run: cargo test --all-features
