name: Rust

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

env:
  RUSTFLAGS: -A warnings

jobs:
  test:
    name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        rust: [stable, nightly]

    steps:
    - uses: actions/checkout@v1

    - name: Install Rust
      shell: bash
      run: |
        if hash rustup 2>/dev/null; then
          rustup toolchain install ${{ matrix.rust }}
        else
          curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ matrix.rust }}
          mv $HOME/.cargo/bin/* /usr/local/bin
        fi

    - name: Install LLVM
      if: matrix.os == 'windows-latest'
      run: choco upgrade llvm -y

    - name: Set clang path
      if: matrix.os =='windows-latest'
      run: echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV
      shell: bash

    - name: Build
      run: cargo +${{ matrix.rust }} build

    - name: Test
      run: cargo +${{ matrix.rust }} test

    - name: Benchmark
      if: matrix.rust == 'nightly'
      run: cargo +${{ matrix.rust }} bench

name: Rust

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

env:
  RUSTFLAGS: -A warnings

jobs:
  test:
    name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        rust: [stable, nightly]

    steps:
    - uses: hecrj/setup-rust-action@v1
      with:
        rust-version: ${{ matrix.rust }}
        targets: ${{ matrix.target }}
        components: 'rustfmt, clippy'

    - uses: actions/checkout@v2

    - name: Install LLVM
      if: matrix.os == 'windows-latest'
      run: choco upgrade llvm -y

    - name: Set clang path
      if: matrix.os =='windows-latest'
      run: echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV
      shell: bash

    - name: Cargo fmt
      run: cargo +${{ matrix.rust }} fmt --all -- --check
      if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'

    - name: Cargo clippy
      run: cargo +${{ matrix.rust }} clippy --all-targets --workspace
      if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'

    - name: Build
      run: cargo +${{ matrix.rust }} build

    - name: Test
      run: cargo +${{ matrix.rust }} test

    - name: Benchmark
      if: matrix.rust == 'nightly'
      run: cargo +${{ matrix.rust }} bench

Add clippy and fmt checks to CI
Add clippy and fmt checks to CI

Let's keep it clean and consistent.
