name: Cargo tests
on:
  push:
    branches:
      - master
  pull_request:
jobs:
  clippy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          components: clippy
          override: true
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

  format:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          components: rustfmt
          override: true
      - uses: mbrobbel/rustfmt-check@master
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

  cargo-test:
    strategy:
      fail-fast: false
      matrix:
        rust:
          - stable
          - beta
          - nightly
        os:
          - ubuntu-latest
          - macos-latest

    runs-on: ${{ matrix.os }}

    env:
      RUSTFLAGS: "-Dwarnings"

    steps:
      - uses: actions/checkout@v2

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{matrix.rust}}

      - uses: actions/cache@v2
        with:
          path: |
            target
          key: ${{ runner.os }}-cargo-${{ matrix.rust }}

      - name: Run tests
        run: cargo test

name: Cargo tests
on:
  push:
    branches:
      - master
  pull_request:
jobs:
  clippy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          components: clippy
          override: true
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

  format:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          components: rustfmt
          override: true
      - uses: mbrobbel/rustfmt-check@master
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

  cargo-test:
    strategy:
      fail-fast: false
      matrix:
        rust:
          - stable
          - beta
          - nightly
        os:
          - ubuntu-latest
          - macos-latest

    runs-on: ${{ matrix.os }}

    env:
      RUSTFLAGS: "-Dwarnings"

    steps:
      - uses: actions/checkout@v2

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{matrix.rust}}

      - name: Run tests
        run: cargo test

Remove caching due to macos not liking that
Remove caching due to macos not liking that