on: [push, pull_request]

name: Cargo Format

jobs:
  fmt:
    name: Cargo Format
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository and submodules
        uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Install rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly
          components: rustfmt
      - name: Cargo fmt
        run: cargo +nightly fmt --all -- --check
