ci.yml•3.44 kB
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
lint-and-build:
name: Lint and Build
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.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check TypeScript compilation
run: npx tsc --noEmit
- name: Build project
run: npm run build
- name: Verify build artifacts
run: |
test -f dist/servers/arxiv-server.js || exit 1
test -f dist/servers/semantic-scholar-server.js || exit 1
test -f dist/servers/pubmed-server.js || exit 1
echo "✅ All server files built successfully"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: dist/
retention-days: 7
test:
name: Test on Node.js ${{ matrix.node-version }}
needs: lint-and-build
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
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: Build project
run: npm run build
- name: Test arXiv server startup
shell: bash
run: |
timeout 5 node dist/servers/arxiv-server.js || true
echo "✅ arXiv server starts successfully"
- name: Test Semantic Scholar server startup
shell: bash
run: |
timeout 5 node dist/servers/semantic-scholar-server.js || true
echo "✅ Semantic Scholar server starts successfully"
- name: Test PubMed server startup
shell: bash
run: |
timeout 5 node dist/servers/pubmed-server.js || true
echo "✅ PubMed server starts successfully"
package-test:
name: Package Test
needs: lint-and-build
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.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Test package
run: npm pack --dry-run
- name: Verify package contents
run: |
npm pack
tar -tzf researchmcp-*.tgz | grep -E 'dist/servers/(arxiv|semantic-scholar|pubmed)-server.js'
echo "✅ Package contains all required files"
- name: Check package size
run: |
SIZE=$(stat -c%s researchmcp-*.tgz)
MAX_SIZE=$((5 * 1024 * 1024)) # 5MB
if [ $SIZE -gt $MAX_SIZE ]; then
echo "❌ Package too large: $SIZE bytes (max: $MAX_SIZE bytes)"
exit 1
fi
echo "✅ Package size OK: $SIZE bytes"