npm test ran every file one after another (--test-concurrency=1, from when there were three files). It now runs as many files at once as there are cores (TEST_JOBS=1 for the old way), and --shard i/n picks one of n parts of about equal time, balanced by tests/durations.json (npm run test:timings). CI runs four parts and the build side by side; a final 'test' job is green only when all are, so the check keeps its name. A newer push to a PR cancels the older run.
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# A newer push to the same pull request makes the older run pointless: cancel it instead of queueing behind it.
|
|
# Runs on main always finish.
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
# The tests in four parts of about equal time, each on its own runner, each running as many files at once as
|
|
# it has cores (scripts/test.js; the split comes from tests/durations.json).
|
|
part:
|
|
name: test ${{ matrix.part }}/4
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
part: [1, 2, 3, 4]
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm test -- --shard ${{ matrix.part }}/4
|
|
|
|
build:
|
|
name: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- name: Build (not deployed — only releases deploy)
|
|
run: npm run build
|
|
|
|
# The one check to look at, named as before: green only when every part and the build are.
|
|
test:
|
|
needs: [part, build]
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Every part and the build passed
|
|
run: |
|
|
echo "parts: ${{ needs.part.result }}, build: ${{ needs.build.result }}"
|
|
test "${{ needs.part.result }}" = success && test "${{ needs.build.result }}" = success
|
|
|
|
translations:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- name: Translation coverage
|
|
run: node scripts/i18n-check.js --summary "$GITHUB_STEP_SUMMARY"
|