Documentation
name: Test

on:
  push:
    branches:
      - master
      - ci/**
      - staging
      - trying
  pull_request:
    paths:
      - '.github/*'
      - '**.rs'
      - '**/Cargo.*'
      - '.cargo/*'
      - '**/*.md'

jobs:
  test:
    name: Test
    strategy:
      matrix:
        rust:
          - stable
          - beta
        experimental:
          - false
        include:
          - rust: nightly
            experimental: true
    continue-on-error: ${{ matrix.experimental }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          default: true
      - uses: actions-rs/cargo@v1
        name: "test with all features"
        with:
          command: test
          args: --all-features --all-targets
      - uses: actions-rs/cargo@v1
        name: "doctest"
        with:
          command: test
          args: --all-features --doc
      - uses: actions-rs/cargo@v1
        name: "check with --no-default-features"
        with:
          command: check
          args: --no-default-features
      - uses: actions-rs/cargo@v1
        name: "cargo fmt"
        if: ${{ matrix.rust == 'stable' }}
        with:
          command: fmt
          args: -- --check
      - uses: actions-rs/clippy-check@v1
        name: "cargo clippy"
        if: ${{ matrix.rust == 'stable' }}
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-features