ferroscope 1.1.0

MCP server that enables AI assistants to debug Rust programs using LLDB and GDB
name: CI

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

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        rust: [stable, beta]
        exclude:
          # Reduce CI load - only test beta on Linux
          - os: macos-latest
            rust: beta

    steps:
    - uses: actions/checkout@v4

    - name: Install Rust
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ matrix.rust }}

    - name: Cache cargo registry
      uses: actions/cache@v4
      with:
        path: ~/.cargo/registry
        key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

    - name: Cache cargo index
      uses: actions/cache@v4
      with:
        path: ~/.cargo/git
        key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

    - name: Cache cargo build
      uses: actions/cache@v4
      with:
        path: target
        key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

    - name: Install debugger (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: sudo apt-get update && sudo apt-get install -y gdb

    - name: Check debugger availability
      run: |
        if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
          gdb --version
        elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
          lldb --version
        fi

    - name: Build
      run: cargo build --verbose

    - name: Run tests
      run: cargo test --verbose

    - name: Build examples
      run: |
        cd examples/simple_counter
        cargo build
        cd ../..

  lint:
    name: Rustfmt and Clippy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable
      with:
        toolchain: 1.87.0
        components: rustfmt, clippy

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

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

  comprehensive-test:
    name: Comprehensive Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
    
    steps:
    - uses: actions/checkout@v4

    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable

    - name: Install debugger (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: sudo apt-get update && sudo apt-get install -y gdb

    - name: Build ferroscope
      run: cargo build --release

    - name: Build test examples
      run: |
        cd examples/simple_counter
        cargo build
        cd ../..

    - name: Run comprehensive test (with timeout)
      run: |
        # Run with timeout to prevent hanging in CI
        timeout 60s cargo run --bin comprehensive-test || true
        echo "Comprehensive test completed (may have timed out safely)"

  check-publish:
    name: Check Publish
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable

    - name: Check publish
      run: cargo publish --dry-run

  windows-build:
    name: Windows Build (Compilation Only)
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v4

    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable

    - name: Build (compilation test only)
      run: cargo build --verbose
      
    - name: Note about Windows support
      run: echo "Windows compilation successful - runtime support planned for future release"