anza-xtask 0.2.0

Blockchain, Rebuilt for Scale
Documentation
name: CI

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

env:
  CARGO_TERM_COLOR: always

permissions:
  # Required for OIDC: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-cloud-providers#adding-permissions-settings
  id-token: write

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install clippy
        run: rustup component add clippy

      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

  fmt:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install rustfmt
        run: rustup component add rustfmt

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

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build
        run: cargo build --all-features

  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install llvm-tools
        run: rustup component add llvm-tools-preview

      - name: Install cargo-llvm-cov
        run: cargo install cargo-llvm-cov --locked

      - name: Run tests with coverage
        run: cargo llvm-cov --all-features --lcov --output-path target/lcov.info

      - name: Upload to codecov
        if: ${{ !env.ACT }}
        uses: codecov/codecov-action@v5
        with:
          files: target/lcov.info
          use_oidc: true

      - name: Generate HTML report
        if: ${{ github.event_name == 'pull_request' }}
        run: cargo llvm-cov --all-features --html --output-dir target/coverage-html

      - name: Upload HTML coverage report
        if: ${{ !env.ACT && github.event_name == 'pull_request' }}
        uses: actions/upload-artifact@v4
        with:
          name: coverage-report
          path: target/coverage-html