quantus-cli 1.3.4

Command line interface and library for interacting with the Quantus Network
---
name: Continuous Integration

on:
  pull_request:
    paths-ignore:
      - "docs/**"
      - "*.md"
      - "LICENSE"
  push:
    branches:
      - main
    paths-ignore:
      - "docs/**"
      - "*.md"
      - "LICENSE"

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

env:
  CARGO_INCREMENTAL: 0
  CARGO_TERM_COLOR: always

jobs:
  fast-checks:
    name: 🏁 Fast Checks (Format)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install required components
        run: rustup component add rustfmt --toolchain nightly
      - name: Install taplo
        run: cargo install taplo-cli --locked
      - name: Run format checks
        run: |
          taplo format --check --config taplo.toml
          cargo +nightly fmt --all -- --check

  build-and-test-matrix:
    name: 🛠️ Build & Test Matrix
    needs: fast-checks
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
        rust:
          - stable
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust ${{ matrix.rust }}
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - name: Install dependencies (Ubuntu)
        if: matrix.os == 'ubuntu-latest'
        run: |
          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
          sudo rm -f /etc/apt/sources.list.d/azure-cli.list
          sudo apt-get update -yqq
          sudo apt-get install -yqq --no-install-recommends \
            libclang-dev \
            protobuf-compiler
      - name: Install dependencies (macOS)
        if: matrix.os == 'macos-latest'
        run: |
          brew install protobuf
      - name: Build (all targets)
        run: cargo build --locked
      - name: Build (library only)
        run: cargo build --lib --locked
      - name: Test (all targets)
        run: cargo test --locked

  analysis:
    name: 🤖 Analysis (Clippy & Doc)
    needs: fast-checks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rust-src
      - name: Install dependencies
        run: |
          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
          sudo rm -f /etc/apt/sources.list.d/azure-cli.list
          sudo apt-get update -yqq
          sudo apt-get install -yqq --no-install-recommends \
            libclang-dev \
            protobuf-compiler
      - name: Run clippy (all targets)
        run: SKIP_CIRCUIT_BUILD=1 cargo clippy --all-targets --locked -- -D warnings
      - name: Run clippy (library only)
        run: SKIP_CIRCUIT_BUILD=1 cargo clippy --lib --locked -- -D warnings
      - name: Generate documentation
        run: SKIP_CIRCUIT_BUILD=1 cargo doc --locked --no-deps
      - name: Check documentation (with private items)
        run: SKIP_CIRCUIT_BUILD=1 cargo doc --locked --no-deps --document-private-items

  security-audit:
    name: 🔒 Security Audit
    needs: fast-checks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install cargo-audit
        run: cargo install cargo-audit --locked
      - name: Run security audit
        run: cargo audit

  examples:
    name: 📚 Examples
    needs: fast-checks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable
      - name: Install dependencies
        run: |
          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
          sudo rm -f /etc/apt/sources.list.d/azure-cli.list
          sudo apt-get update -yqq
          sudo apt-get install -yqq --no-install-recommends \
            libclang-dev \
            protobuf-compiler
      - name: Build examples
        run: |
          cargo build --examples --locked
      - name: Check example compilation
        run: |
          for example in examples/*.rs; do
            example_name=$(basename "$example" .rs)
            echo "Checking example: $example_name"
            cargo check --example "$example_name" --locked
          done