name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x, 24.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for TurboRepo caching
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build packages
run: npm run build
- name: Run tests
run: npm test
- name: Generate test coverage
if: matrix.node-version == '24.x'
run: |
# Run tests with coverage for packages that have tests
cd packages/core && npm run test:coverage || true
cd ../server && npm run test:coverage || true
cd ../cli && npm run test:coverage || true
- name: Upload coverage to Codecov
if: matrix.node-version == '24.x'
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/core/coverage/lcov.info,./packages/server/coverage/lcov.info,./packages/cli/coverage/lcov.info
lint:
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'
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-20.x-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-20.x-
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Check formatting
run: npm run format -- --check
continue-on-error: true # Don't fail CI on formatting issues initially
- name: Run linting
run: npm run lint
continue-on-error: true # Don't fail CI on linting issues initially