name: Checks

on:
  push:
    branches:
      - main
  pull_request: ~

jobs:
  test:
    name: Test
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4

      - name: Install latest stable
        uses: metalbear-co/setup-rust-toolchain@a8d42d5aa259519dac1faeee20e37c1fb43453a3
        with:
          components: rustfmt,clippy

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

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

      - name: Run tests default
        run: cargo test
      - name: Run tests rustls-tls-webpki-roots
        run: cargo test --no-default-features --features rustls-tls-webpki-roots
      - name: Run tests native-tls-vendored
        run: cargo test --no-default-features --features native-tls-vendored
      - name: Run tests native-tls
        run: cargo test --no-default-features --features native-tls