on: [push, pull_request]
name: CI
jobs:
  clippy_rustfmt:
    name: Lint & Format
    runs-on: ubuntu-latest
    strategy:
      matrix:
        features:
          - default
          - ssl-openssl
          - ssl-rustls
    steps:
      - uses: actions/checkout@v2
      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --features ${{ matrix.features }}

      - name: Format
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check

  test:
    name: Build & Test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
          - nightly
          - 1.56
        features:
          - default
          - ssl-openssl
          - ssl-rustls
    steps:
      - uses: actions/checkout@v2
      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          override: true

      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --features ${{ matrix.features }}

      - name: Test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --features ${{ matrix.features }}
