Documentation
name: Test suite
on:
  push:
    branches:
      - main
  pull_request:

jobs:
  style:
    name: Enforce style
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          # use nightly rustfmt for unstable options
          toolchain: nightly
          override: true
          components: rustfmt
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check
  test:
    name: Run tests
    needs: style
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        rust:
          - stable
          - nightly
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - uses: actions-rs/cargo@v1
        with:
          command: test
      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features
      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --no-default-features