scribe-cli 0.5.1

Advanced code analysis and repository exploration library with AI-powered insights
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        rust: [stable, beta, nightly]
        exclude:
          # Reduce matrix size by excluding some combinations
          - os: windows-latest
            rust: beta
          - os: macos-latest
            rust: beta
    
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      with:
        toolchain: ${{ matrix.rust }}
        components: rustfmt, clippy
        
    - name: Cache Cargo registry
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.rust }}-cargo-
          ${{ runner.os }}-cargo-
          
    - name: Build workspace
      run: cargo build --workspace --bins --lib --tests
      
    - name: Run tests
      run: cargo test --workspace --all-features
      
    - name: Run doctests
      run: cargo test --workspace --doc

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      with:
        components: clippy
        
    - name: Cache Cargo registry
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ubuntu-clippy-cargo-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ubuntu-clippy-cargo-
          
    - name: Run clippy
      run: cargo clippy --bins --lib --tests --all-features -- -D warnings

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      with:
        components: rustfmt
        
    - name: Check formatting
      run: cargo fmt --all -- --check

  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      
    - name: Cache Cargo registry
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ubuntu-check-cargo-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ubuntu-check-cargo-
          
    - name: Check workspace
      run: cargo check --workspace --bins --lib --tests --all-features

  benchmark:
    name: Benchmarks
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request'
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      
    - name: Cache Cargo registry
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ubuntu-bench-cargo-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ubuntu-bench-cargo-
          
    - name: Run benchmarks
      run: cargo bench --workspace --all-features

  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      with:
        components: llvm-tools-preview
        
    - name: Install cargo-llvm-cov
      uses: taiki-e/install-action@cargo-llvm-cov
      
    - name: Cache Cargo registry
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ubuntu-coverage-cargo-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ubuntu-coverage-cargo-
          
    - name: Generate code coverage
      run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info
      
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v3
      with:
        files: lcov.info
        fail_ci_if_error: true

  msrv:
    name: Minimum Supported Rust Version
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      
    - name: Install Rust toolchain (MSRV)
      uses: dtolnay/rust-toolchain@stable
      with:
        # Based on rust-toolchain.toml, we'll use stable
        # In a real project, you might want to test against an older version
        toolchain: "1.70.0"  # Example MSRV
        
    - name: Cache Cargo registry
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
          target
        key: ubuntu-msrv-cargo-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ubuntu-msrv-cargo-
          
    - name: Check with MSRV
      run: cargo check --workspace --all-features

  # Ensure all jobs pass for branch protection
  ci-success:
    name: CI Success
    runs-on: ubuntu-latest
    needs: [test, clippy, fmt, check, coverage]
    if: always()
    steps:
    - name: Check all jobs
      run: |
        if [[ "${{ needs.test.result }}" == "success" && \
              "${{ needs.clippy.result }}" == "success" && \
              "${{ needs.fmt.result }}" == "success" && \
              "${{ needs.check.result }}" == "success" && \
              "${{ needs.coverage.result }}" == "success" ]]; then
          echo "All CI checks passed!"
          exit 0
        else
          echo "Some CI checks failed"
          exit 1
        fi