test.ymlโข4.37 kB
name: Test MCP Server
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: |
# Install build tools for native compilation
sudo apt-get update -qq
sudo apt-get install -y build-essential python3
# Try make install first
if ! make install; then
echo "โ Make install failed, trying npm install..."
npm install
fi
# Rebuild native bindings for tree-sitter with proper error handling
echo "๐จ Rebuilding tree-sitter native bindings..."
if ! npm rebuild tree-sitter; then
echo "โ ๏ธ Tree-sitter rebuild failed, but continuing (tests handle graceful fallback)"
fi
- name: Test Node.js compatibility
run: |
make node-compat
echo "Testing server health check..."
node dist/src/index.js --test
- name: Run unit tests
run: make test
- name: Build the project
run: npm run build
- name: Test MCP server health check
run: |
echo "Testing MCP server health check..."
if npm run health; then
echo "โ
MCP server health check passed"
else
echo "โ MCP server health check failed"
exit 1
fi
- name: Test MCP server functionality
run: |
echo "Testing MCP server functionality..."
# Use our validation script to check build output
if [ -f "scripts/validate-build.js" ]; then
echo "Running comprehensive build validation..."
node scripts/validate-build.js
fi
# Check that the built server contains expected MCP tools (basic validation)
echo "Checking for MCP tool implementations..."
# Check core tools
if grep -q "analyze_project" dist/src/index.js; then
echo "โ
analyze_project tool found"
else
echo "โ analyze_project tool not found"
exit 1
fi
# Check new planning tools
if grep -q "mcp_planning" dist/src/index.js; then
echo "โ
mcp_planning tool found"
else
echo "โ mcp_planning tool not found"
exit 1
fi
if grep -q "interactive_adr_planning" dist/src/index.js; then
echo "โ
interactive_adr_planning tool found"
else
echo "โ interactive_adr_planning tool not found"
exit 1
fi
if grep -q "ListToolsRequestSchema" dist/src/index.js; then
echo "โ
ListToolsRequestSchema handler found"
else
echo "โ ListToolsRequestSchema handler not found"
exit 1
fi
echo "โ
MCP server functionality validated"
- name: Test MCP functionality with Inspector
continue-on-error: true
run: |
echo "Running comprehensive MCP functionality tests..."
# Install bc for floating point calculations in test script
sudo apt-get install -y bc
# Run MCP functionality tests using @modelcontextprotocol/inspector
if npm run test:mcp; then
echo "โ
MCP Inspector tests passed"
else
echo "โ MCP Inspector tests failed"
# Still allow pipeline to continue as these are integration tests
echo "Note: MCP Inspector tests failed but pipeline continues"
fi
# Display test results if available
if [ -f "mcp-test-results.json" ]; then
echo "๐ MCP Test Results:"
cat mcp-test-results.json | jq '.' || cat mcp-test-results.json
fi
- name: Upload coverage reports
if: matrix.node-version == '20'
uses: codecov/codecov-action@v5
with:
file: ./coverage/lcov.info
fail_ci_if_error: false