name: CI Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Test on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
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: Run linter (if configured)
run: npm run lint --if-present
continue-on-error: true
- name: Build TypeScript
run: npm run build
- name: Run tests
run: npm test
- name: Run tests with coverage
run: npm run test:coverage
if: matrix.node-version == '20.x'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.node-version == '20.x'
with:
file: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella
continue-on-error: true
build:
name: Build and Package Check
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
run: npm run build
- name: Check package can be packed
run: npm pack --dry-run --ignore-scripts
- name: Verify dist directory exists
run: |
if [ ! -d "dist" ]; then
echo "Error: dist directory not found"
exit 1
fi
echo "✓ dist directory exists"
- name: Verify main entry point exists
run: |
if [ ! -f "dist/index.js" ]; then
echo "Error: dist/index.js not found"
exit 1
fi
echo "✓ dist/index.js exists"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7
mock-mode-test:
name: Test with Mock Bruno CLI
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: Create mock mode config
run: |
echo '{
"useMockCLI": true,
"mockCLIDelay": 50,
"logging": {
"level": "info"
}
}' > bruno-mcp.config.json
- name: Run tests in mock mode
run: npm test
env:
BRUNO_MCP_CONFIG: ./bruno-mcp.config.json