name: Run linters

on:
  push:
    branches: [main]
    tags: v*
  pull_request:

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: Install latest stable toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true

    - name: Install clippy
      run: rustup component add clippy

    - name: Run clippy
      uses: actions-rs/clippy-check@v1
      with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-targets -- --deny warnings
