name: Quality Checks

on:
  workflow_call:

jobs:
  check:
    name: Quality Checks
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        targets: [aarch64-unknown-none-softfloat, aarch64-unknown-none]

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly-2025-08-15
          components: rust-src, clippy, rustfmt
          targets: ${{ matrix.targets }}

      - name: Check rust version
        run: rustc --version --verbose

      - name: Check code format
        run: cargo fmt --all -- --check

      - name: Build
        run: cargo build --target ${{ matrix.targets }}

      - name: Run clippy
        run: cargo clippy --target ${{ matrix.targets }} -- -D warnings

      - name: Build documentation
        run: cargo doc --no-deps --target ${{ matrix.targets }}