on: [push, pull_request]

name: Continuous integration

jobs:
  check-test:
    name: Check and test crate
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo check --all-targets
      - run: cargo test

  clippy-fmt:
    name: Run Clippy and format code
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - run: cargo clippy --all-targets -- -D warnings
      - run: cargo fmt --all --check
