name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Debug - List files
run: |
echo "Repository contents:"
ls -la
echo "package.json exists: $(test -f package.json && echo 'yes' || echo 'no')"
echo "package-lock.json exists: $(test -f package-lock.json && echo 'yes' || echo 'no')"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
echo "Found package-lock.json, using npm ci"
npm ci
else
echo "No package-lock.json found, using npm install"
npm install
fi
- name: Run tests
run: npm test
- name: Run lint
run: npm run lint
continue-on-error: true
- name: Test MCP server
run: npm run test:mcp
continue-on-error: true
api-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Debug - List files
run: |
echo "Repository contents:"
ls -la
echo "package.json exists: $(test -f package.json && echo 'yes' || echo 'no')"
echo "package-lock.json exists: $(test -f package-lock.json && echo 'yes' || echo 'no')"
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
echo "Found package-lock.json, using npm ci"
npm ci
else
echo "No package-lock.json found, using npm install"
npm install
fi
- name: Test API connectivity
run: npm run test:api
continue-on-error: true