blockwatch 0.3.0

Language agnostic linter that keeps your code and documentation in sync and valid
Documentation
name: Rust

permissions:
  contents: read
  id-token: write
  pull-requests: write

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

env:
  CARGO_TERM_COLOR: always

jobs:
  tests:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: llvm-tools-preview, clippy, rustfmt
      - name: Cache ~/.cargo/bin
        uses: actions/cache@v5
        with:
          path: ~/.cargo/bin/
          key: ${{ runner.os }}-cargo-bin
      - name: Install cargo-llvm-cov
        run: |
          if [ ! -f ~/.cargo/bin/cargo-llvm-cov ]; then
            cargo install cargo-llvm-cov
          else
            echo "cargo-llvm-cov found in cache."
          fi
      - name: Build
        run: cargo build
      - name: Check formatting
        run: cargo fmt --check
      - name: Run Clippy lint
        run: cargo clippy -- -D warnings
      - name: Run tests
        run: cargo llvm-cov --lcov --output-path coverage.lcov
      - name: Upload coverage report to Codecov
        uses: codecov/codecov-action@v6
        with:
          files: coverage.lcov
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true