as8510 0.1.0

An async no_std driver for the AS8510 SPI current and voltage sensor
Documentation
name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      # Checkout the repository
      - name: Checkout code
        uses: actions/checkout@v4

      # Install Rust toolchain with target for embedded
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: thumbv7em-none-eabihf  # ARM Cortex-M4/M7; adjust as needed
          components: rustfmt, clippy

      # Cache Rust dependencies
      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

      # Install dependencies (embedded-hal-async)
      - name: Install dependencies
        run: cargo add embedded-hal-async

      # Check code formatting
      - name: Run cargo fmt
        run: cargo fmt --all -- --check

      # Run Clippy for linting
      - name: Run Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      # Build for the host (no tests since they're minimal)
      - name: Build for host
        run: cargo build --verbose

      # Run unit tests (host, skipping doctests)
      - name: Run tests
        run: cargo test --no-run --verbose  # Only build tests, don’t run due to doctest issues

      # Build for embedded target (no_std)
      - name: Build for thumbv7em-none-eabihf
        run: cargo build --target thumbv7em-none-eabihf --verbose

      # Check documentation generation
      - name: Generate documentation
        run: cargo doc --no-deps --verbose