ci.yml•1.6 kB
name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use 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: Type check
run: npm run type-check
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test build output
run: |
npm start &
sleep 10
curl -f http://localhost:3000/health || exit 1
pkill -f "node dist/server.js"
docker:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: docker build -t ts-template-mcp-server .
- name: Test Docker image
run: |
docker run -d --name mcp-test -p 3000:3000 ts-template-mcp-server
sleep 10
curl -f http://localhost:3000/health || exit 1
docker stop mcp-test
docker rm mcp-test
deploy:
runs-on: ubuntu-latest
needs: [test, docker]
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to production
run: echo "Deploy to production would happen here"
# Add your deployment steps here