name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  RUSTFLAGS: "-Dwarnings" # Make sure CI fails on all warnings

jobs:
  CI:
    name: CI
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Use cache
        uses: Swatinem/rust-cache@v2

      - name: Run clippy
        run: cargo clippy

      - name: Run clippy with mcp3461 feature
        run: cargo clippy --features mcp3461

      - name: Run clippy with all features
        run: cargo clippy --all-features

      - name: Check formatting
        run: cargo fmt --check

      - name: Run tests
        run: cargo test --features mcp3562r