Files
tools/.github/workflows/ci.yaml
T
robonen f40cc55497 ci: run build, lint and test in parallel per package
Replace the single monorepo CI job with a dynamic matrix: a discover job enumerates workspace packages, then one job per package builds it (with its workspace deps), lints and tests in parallel (fail-fast: false). Chromium is installed only for the browser-mode suites (primitives, editor). Adds a 'test' script to @robonen/docs so its suite runs under the per-package model (the root vitest projects list isn't used by CI anymore).
2026-06-08 16:50:34 +07:00

86 lines
2.4 KiB
YAML

name: CI
on:
pull_request:
branches:
- master
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 24.x
jobs:
# Enumerate the workspace packages so the matrix below fans out one job per
# package (kept dynamic so new packages are picked up automatically).
discover:
name: Discover packages
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.list.outputs.packages }}
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: List workspace packages
id: list
run: echo "packages=$(pnpm -r ls --depth -1 --json | jq -c '[.[] | select(.name != "tools") | .name]')" >> "$GITHUB_OUTPUT"
# One job per package — build (with its workspace deps), lint and test run in
# parallel across packages. fail-fast: false so every package is reported.
check:
name: ${{ matrix.package }}
needs: discover
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.discover.outputs.packages) }}
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Build the package and the workspace deps it relies on (incl. @robonen/eslint,
# which every package's lint config imports from its built dist).
- name: Build
run: pnpm --filter "${{ matrix.package }}..." --if-present run build
# Only the browser-mode test suites (vitest `instances: chromium`) need a browser.
- name: Install Playwright Chromium
if: matrix.package == '@robonen/primitives' || matrix.package == '@robonen/editor'
run: pnpm exec playwright install --with-deps chromium
- name: Lint
run: pnpm --filter "${{ matrix.package }}" --if-present run lint:check
- name: Test
run: pnpm --filter "${{ matrix.package }}" --if-present run test