name: Rust Checks
on:
push:
branches:
- main
paths:
- '**.rs'
- '**.yml'
- 'rust-toolchain'
- 'tests/**'
pull_request:
branches:
- main
paths:
- '**.rs'
- '**.yml'
- 'rust-toolchain'
- 'tests/**'
jobs:
everything:
name: Rust Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rustfmt, clippy
- uses: actions/cache@v2 with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check if sources are properly formatted
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Checking if clippy is happy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings
- name: Check if test passes
uses: actions-rs/cargo@v1
with:
command: test
args: --all