Skip to content

V0.12.1 (#106)

V0.12.1 (#106) #17

Workflow file for this run

# Copyright(C) 2024-2025 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"]
paths:
- "src/gaia/mcp/**"
- "tests/mcp/**"
- "src/gaia/cli.py"
- ".github/workflows/test_mcp.yml"
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "src/gaia/mcp/**"
- "tests/mcp/**"
- "src/gaia/cli.py"
- ".github/workflows/test_mcp.yml"
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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev,mcp]
pip install pytest pytest-timeout
- 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
Write-Host "Starting MCP bridge using gaia CLI..."
gaia mcp start --background --port 8765
# Wait for bridge to start
Write-Host "Waiting for MCP bridge to start..."
Start-Sleep -Seconds 5
# Check status
gaia mcp status
$status = gaia mcp status 2>&1
if ($status -match "accessible") {
Write-Host "✅ MCP bridge is running"
} else {
Write-Host "❌ MCP bridge is not accessible"
Write-Host "Log file contents:"
if (Test-Path "gaia.mcp.log") {
Get-Content "gaia.mcp.log"
}
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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev,mcp]
pip install 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 using gaia CLI..."
gaia mcp start --background --port 8765
# Wait for bridge to start
echo "Waiting for MCP bridge to start..."
sleep 5
# Check status
gaia mcp status
if gaia mcp status 2>&1 | grep -q "accessible"; then
echo "✅ MCP bridge is running"
else
echo "❌ MCP bridge is not accessible"
echo "Log file contents:"
[ -f "gaia.mcp.log" ] && cat gaia.mcp.log
exit 1
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@v4
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 ""
if [[ "${{ needs.test-mcp-windows.result }}" == "success" &&
"${{ needs.test-mcp-linux.result }}" == "success" ]]; 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