name: CI
on:
push:
branches: [main, develop, 'release/**']
pull_request:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 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: Type check
run: npm run typecheck
- name: Run tests
run: npm test
- name: Run tests with coverage
if: matrix.node-version == 20
run: npm run test:coverage
- name: Build
run: npm run build
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check formatting (if prettier configured)
run: |
if [ -f ".prettierrc" ] || [ -f "prettier.config.js" ]; then
npx prettier --check .
else
echo "No prettier config found, skipping format check"
fi
continue-on-error: true
- name: Lint (if eslint configured)
run: |
if [ -f ".eslintrc.json" ] || [ -f "eslint.config.js" ]; then
npx eslint .
else
echo "No eslint config found, skipping lint"
fi
continue-on-error: true