name: CI
on:
push:
branches:
- main
- 'release-please--*'
pull_request:
branches: [ main ]
permissions:
contents: read
checks: write
jobs:
lint:
name: Lint (no fix)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- run: npm ci
- run: npm run lint:check
format:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- run: npm ci
- run: npm run format:check
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- run: npm ci
- run: npm run typecheck
tests:
name: Tests with coverage (unit) – shard ${{ matrix.shard }}/4
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- run: npm ci
- name: Run tests with coverage (unit-only + JUnit)
env:
JEST_JUNIT_OUTPUT: ./coverage/junit-${{ matrix.shard }}.xml
JEST_JUNIT_CLASSNAME: "{filepath}"
run: npm run test:coverage:ci -- --reporters=default --reporters=jest-junit --shard=${{ matrix.shard }}/4 --passWithNoTests
- name: Upload test results to Codecov
if: ${{ !cancelled() && github.actor != 'dependabot[bot]' }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/junit-${{ matrix.shard }}.xml
- name: Upload coverage to Codecov
if: ${{ success() && github.actor != 'dependabot[bot]' }}
uses: codecov/codecov-action@v5
with:
files: ./coverage/lcov.info
flags: unittests
name: codecov-coverage
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Analyze bundle
run: npm run build:bundle
- name: Upload bundle analysis to Codecov
if: ${{ success() && github.actor != 'dependabot[bot]' && hashFiles('coverage/bundles/*.json') != '' }}
uses: codecov/codecov-action@v5
with:
plugin: javascript-bundle
files: ./coverage/bundles/*.json
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
aggregate:
name: Lint, Typecheck, Test (Node 20)
runs-on: ubuntu-latest
needs: [lint, format, typecheck, tests]
if: always()
steps:
- name: Evaluate job results
run: |
echo "lint: ${{ needs.lint.result }}"
echo "format: ${{ needs.format.result }}"
echo "typecheck: ${{ needs.typecheck.result }}"
echo "tests: ${{ needs.tests.result }}"
if [ "${{ needs.lint.result }}" != "success" ] || \
[ "${{ needs.format.result }}" != "success" ] || \
[ "${{ needs.typecheck.result }}" != "success" ] || \
[ "${{ needs.tests.result }}" != "success" ]; then
echo "One or more jobs failed";
exit 1;
fi