ci.yml•5.33 kB
name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
test:
name: Test & Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: cts_mcp/package-lock.json
- name: Install dependencies
working-directory: cts_mcp
run: npm ci
- name: Build TypeScript
working-directory: cts_mcp
run: npm run build
- name: Run tests with coverage
working-directory: cts_mcp
run: npm run test:coverage
- name: Generate coverage report
working-directory: cts_mcp
run: |
echo "## Test Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
npx jest --coverage --coverageReporters=text | tail -n 20 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./cts_mcp/coverage/coverage-final.json
flags: cts-mcp
name: cts-mcp-coverage
fail_ci_if_error: false
- name: Archive coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: cts_mcp/coverage/
retention-days: 30
performance:
name: Performance Benchmarks
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: cts_mcp/package-lock.json
- name: Install dependencies
working-directory: cts_mcp
run: npm ci
- name: Build TypeScript
working-directory: cts_mcp
run: npm run build
- name: Run performance benchmarks
working-directory: cts_mcp
run: npm run benchmark || echo "Benchmark script not yet implemented"
- name: Download baseline performance
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: performance-baseline
path: cts_mcp/benchmarks/baseline
- name: Compare performance
working-directory: cts_mcp
run: |
echo "## Performance Benchmark Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Target Performance" >> $GITHUB_STEP_SUMMARY
echo "- **Sync Tools**: <100ms (schema validation, config retrieval)" >> $GITHUB_STEP_SUMMARY
echo "- **Async Tools**: <5s (bughunter, cleanup, audit)" >> $GITHUB_STEP_SUMMARY
echo "- **Cache Operations**: <2ms (read/write)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f benchmarks/results.json ]; then
echo "### Current Results" >> $GITHUB_STEP_SUMMARY
cat benchmarks/results.json >> $GITHUB_STEP_SUMMARY
else
echo "_Benchmark implementation pending_" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload performance results
uses: actions/upload-artifact@v4
with:
name: performance-results
path: cts_mcp/benchmarks/
retention-days: 90
quality:
name: Code Quality & Linting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: cts_mcp/package-lock.json
- name: Install dependencies
working-directory: cts_mcp
run: npm ci
- name: Check TypeScript types
working-directory: cts_mcp
run: npx tsc --noEmit
- name: Run linter
working-directory: cts_mcp
run: npm run lint || echo "Linter not configured"
- name: Check code formatting
working-directory: cts_mcp
run: npm run format:check || echo "Formatter not configured"
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: cts_mcp/package-lock.json
- name: Run npm audit
working-directory: cts_mcp
run: npm audit --audit-level=moderate || true
- name: Check for vulnerable dependencies
working-directory: cts_mcp
run: |
echo "## Security Audit" >> $GITHUB_STEP_SUMMARY
npm audit --json | jq -r '.metadata | "**Vulnerabilities**: \(.vulnerabilities.total) total (\(.vulnerabilities.critical) critical, \(.vulnerabilities.high) high)"' >> $GITHUB_STEP_SUMMARY || echo "No vulnerabilities found" >> $GITHUB_STEP_SUMMARY