name: CI
on:
  push:
    branches-ignore: [staging.tmp]
  pull_request:
    branches-ignore: [staging.tmp]

jobs:
  tests:
    name: Tests
    runs-on: ubuntu-latest

    strategy:
      matrix:
        rust: [1.34.0, stable, nightly]

    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          profile: minimal
          override: true
      - run: cargo test
      - run: cargo test --all-features

  clippy:
    name: "Clippy: stable"
    runs-on: ubuntu-latest
    continue-on-error: true
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          components: clippy
          override: true
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ github.token }}
  
  rustfmt:
    name: "Format: stable"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          components: rustfmt
          override: true
      - run: cargo fmt -- --check
