ci.yml•3.17 kB
name: CI Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: TypeScript type checking
run: npx tsc --noEmit
- name: Build project
run: npm run build
- name: Test HTTP server startup
run: |
timeout 10s npm run start:http &
SERVER_PID=$!
sleep 3
# Test if server responds
if curl -f http://localhost:3000/health 2>/dev/null; then
echo "HTTP server started successfully"
else
echo "HTTP server failed to start or respond"
exit 1
fi
kill $SERVER_PID 2>/dev/null || true
- name: Test MCP inspector
run: |
timeout 5s npm run inspector -- --help || true
echo "MCP inspector test completed"
- name: Validate TOOLS.md is up to date
run: |
# Generate fresh TOOLS.md
npm run generate-docs
# Check if there are any differences
if git diff --exit-code TOOLS.md; then
echo "TOOLS.md is up to date"
else
echo "TOOLS.md is outdated. Please run 'npm run generate-docs' and commit the changes."
git diff TOOLS.md
exit 1
fi
docker-build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image (test only)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: false
load: true
tags: test-image:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Docker container
run: |
docker run --rm -d --name test-container -p 3000:3000 \
test-image:latest
sleep 5
# Test if container is running and responding using Node.js (works in distroless)
if docker exec test-container /nodejs/bin/node -e "
const http = require('http');
const options = {
hostname: 'localhost',
port: 3000,
path: '/health',
method: 'GET'
};
const req = http.request(options, (res) => {
process.exit(res.statusCode >= 200 && res.statusCode < 300 ? 0 : 1);
});
req.on('error', () => process.exit(1));
req.setTimeout(5000, () => process.exit(1));
req.end();
"; then
echo "Docker container test passed"
else
echo "Docker container test failed"
docker logs test-container
exit 1
fi
docker stop test-container