name: Full Rust codebase checks

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-D warnings"

on:
  workflow_call:

jobs:
  run:
    name: Run checks
    runs-on: ubuntu-latest
    steps:

    - name: Checkout source code
      uses: actions/checkout@v3

    - name: Install rust toolchain
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: stable
        components: clippy, rustfmt

    - name: Run cargo fmt
      run: cargo fmt -- --check

    # - name: Run clippy
    #   run: cargo clippy --all-targets

    - name: Run cargo check
      run: cargo check --workspace --examples --tests --benches --bins
