Improve Claude Code Reviewer to handle large files #129
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved. | |
| # SPDX-License-Identifier: MIT | |
| # This workflow tests the MCP (Model Context Protocol) bridge functionality | |
| # Tests include: HTTP-native bridge, JSON-RPC protocol, Jira integration, and performance | |
| # Platform: Windows and Linux | |
| name: MCP Bridge Tests | |
| on: | |
| workflow_call: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| merge_group: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-mcp-windows: | |
| name: MCP Tests (Windows) | |
| runs-on: windows-latest | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| run: | | |
| irm https://astral.sh/uv/install.ps1 | iex | |
| echo "$env:USERPROFILE\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Install dependencies | |
| run: | | |
| uv pip install --system -e .[dev,mcp] | |
| uv pip install --system pytest pytest-timeout | |
| shell: pwsh | |
| - name: Note about Lemonade | |
| run: | | |
| Write-Host "ℹ️ Running MCP tests without Lemonade server" | |
| Write-Host " LLM queries will return connection errors but MCP bridge functionality will be tested" | |
| shell: pwsh | |
| - name: Start MCP Bridge | |
| run: | | |
| # Start MCP bridge using gaia CLI | |
| # Use --no-lemonade-check since Lemonade is not running in CI | |
| Write-Host "Starting MCP bridge using gaia CLI..." | |
| gaia mcp start --background --port 8765 --no-lemonade-check | |
| # Wait for bridge to start and check health | |
| Write-Host "Waiting for MCP bridge to start..." | |
| $maxAttempts = 15 | |
| $attempt = 0 | |
| $ready = $false | |
| while ($attempt -lt $maxAttempts) { | |
| Start-Sleep -Seconds 2 | |
| $attempt++ | |
| try { | |
| $response = Invoke-RestMethod -Uri "http://localhost:8765/health" -TimeoutSec 3 -ErrorAction Stop | |
| if ($response.status -eq "healthy") { | |
| Write-Host "✅ MCP bridge is running and healthy (attempt $attempt)" | |
| $ready = $true | |
| break | |
| } | |
| } catch { | |
| Write-Host "Attempt $attempt/$maxAttempts - waiting for MCP bridge..." | |
| } | |
| } | |
| if (-not $ready) { | |
| Write-Host "❌ MCP bridge failed to start after $maxAttempts attempts" | |
| Write-Host "Log file contents:" | |
| if (Test-Path "gaia.mcp.log") { | |
| Get-Content "gaia.mcp.log" | |
| } | |
| # Check if process is running | |
| Get-Process -Name python -ErrorAction SilentlyContinue | Format-Table | |
| exit 1 | |
| } | |
| shell: pwsh | |
| - name: Run MCP Tests | |
| env: | |
| CI: true | |
| run: | | |
| # Run MCP tests using gaia CLI (expected to fail without Lemonade) | |
| Write-Host "Testing MCP bridge functionality..." | |
| gaia mcp test | |
| # Don't fail on this test - it's expected to have LLM errors without Lemonade | |
| Write-Host "Note: LLM queries return errors without Lemonade (expected in CI)" | |
| # Run basic validation tests | |
| Write-Host "Running basic validation..." | |
| python tests/mcp/test_mcp_simple.py | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| # Run integration tests | |
| Write-Host "Running MCP integration tests..." | |
| python tests/mcp/test_mcp_integration.py | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| # Run comprehensive HTTP validation tests | |
| Write-Host "Running comprehensive HTTP validation..." | |
| python tests/mcp/test_mcp_http_validation.py | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| Write-Host "✅ All MCP tests passed" | |
| shell: pwsh | |
| - name: Stop MCP Bridge | |
| if: always() | |
| run: | | |
| # Stop MCP bridge using gaia CLI | |
| gaia mcp stop | |
| shell: pwsh | |
| test-mcp-linux: | |
| name: MCP Tests (Linux) | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Free disk space | |
| uses: ./.github/actions/free-disk-space | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Install dependencies | |
| run: | | |
| uv pip install --system -e .[dev,mcp] | |
| uv pip install --system pytest pytest-timeout | |
| - name: Note about Lemonade | |
| run: | | |
| echo "ℹ️ Running MCP tests without Lemonade server" | |
| echo " LLM queries will return connection errors but MCP bridge functionality will be tested" | |
| - name: Start MCP Bridge | |
| run: | | |
| # Start MCP bridge using gaia CLI | |
| echo "Starting MCP bridge..." | |
| gaia mcp start --background --port 8765 --no-lemonade-check | |
| # Wait for bridge to start and verify with gaia mcp status | |
| echo "Waiting for MCP bridge to start..." | |
| sleep 5 | |
| if gaia mcp status --port 8765 2>&1 | grep -q "MCP server is running and accessible"; then | |
| echo "✅ MCP bridge is running and accessible" | |
| else | |
| echo "⚠️ MCP status check - showing full output:" | |
| gaia mcp status --port 8765 || true | |
| fi | |
| - name: Run MCP Tests | |
| env: | |
| CI: true | |
| run: | | |
| # Run MCP tests using gaia CLI (expected to fail without Lemonade) | |
| echo "Testing MCP bridge functionality..." | |
| gaia mcp test || true | |
| echo "Note: LLM queries return errors without Lemonade (expected in CI)" | |
| # Run basic validation tests | |
| echo "Running basic validation..." | |
| python tests/mcp/test_mcp_simple.py | |
| # Run integration tests | |
| echo "Running MCP integration tests..." | |
| python tests/mcp/test_mcp_integration.py | |
| # Run comprehensive HTTP validation tests | |
| echo "Running comprehensive HTTP validation..." | |
| python tests/mcp/test_mcp_http_validation.py | |
| echo "✅ All MCP tests passed" | |
| - name: Stop MCP Bridge | |
| if: always() | |
| run: | | |
| # Stop MCP bridge using gaia CLI | |
| gaia mcp stop || true | |
| - name: Upload MCP Bridge Logs | |
| if: failure() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: mcp-bridge-logs-linux | |
| path: mcp_bridge.log | |
| # Summary job | |
| mcp-test-summary: | |
| name: MCP Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [test-mcp-windows, test-mcp-linux] | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| echo "=== MCP Bridge Test Summary ===" | |
| echo "Windows Tests: ${{ needs.test-mcp-windows.result }}" | |
| echo "Linux Tests: ${{ needs.test-mcp-linux.result }}" | |
| echo "" | |
| # Check if all tests were skipped (draft PR without ready_for_ci label) | |
| if [[ "${{ needs.test-mcp-windows.result }}" == "skipped" && | |
| "${{ needs.test-mcp-linux.result }}" == "skipped" ]]; then | |
| echo "⏭️ All MCP tests skipped (draft PR - add 'ready_for_ci' label to run)" | |
| exit 0 | |
| fi | |
| # Helper function to check if result is acceptable (success or skipped) | |
| check_result() { | |
| [[ "$1" == "success" || "$1" == "skipped" ]] | |
| } | |
| # Check if all results are acceptable (success or skipped) | |
| if check_result "${{ needs.test-mcp-windows.result }}" && | |
| check_result "${{ needs.test-mcp-linux.result }}"; then | |
| echo "✅ All MCP tests passed!" | |
| echo "Coverage:" | |
| echo " ✅ HTTP-native bridge functionality" | |
| echo " ✅ JSON-RPC protocol compliance" | |
| echo " ✅ LLM agent integration" | |
| echo " ✅ Tool registration and discovery" | |
| echo " ✅ Error handling (404, invalid JSON-RPC, unknown tools)" | |
| echo " ✅ CORS headers validation" | |
| echo " ✅ Performance testing with warm-up" | |
| echo " ✅ Integration testing" | |
| echo " ✅ Cross-platform compatibility (Windows & Linux)" | |
| echo " ⏭️ Jira tests skipped (requires authentication)" | |
| else | |
| echo "❌ Some MCP tests failed" | |
| exit 1 | |
| fi |