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).
This commit is contained in:
+52
-11
@@ -5,16 +5,21 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ci-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 24.x
|
NODE_VERSION: 24.x
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
code-quality:
|
# Enumerate the workspace packages so the matrix below fans out one job per
|
||||||
name: Code quality checks
|
# package (kept dynamic so new packages are picked up automatically).
|
||||||
|
discover:
|
||||||
|
name: Discover packages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
outputs:
|
||||||
contents: read
|
packages: ${{ steps.list.outputs.packages }}
|
||||||
pull-requests: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
@@ -31,14 +36,50 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
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
|
- name: Build
|
||||||
run: pnpm build
|
run: pnpm --filter "${{ matrix.package }}..." --if-present run build
|
||||||
|
|
||||||
- name: Lint
|
# Only the browser-mode test suites (vitest `instances: chromium`) need a browser.
|
||||||
run: pnpm lint:check
|
- name: Install Playwright Chromium
|
||||||
|
if: matrix.package == '@robonen/primitives' || matrix.package == '@robonen/editor'
|
||||||
- name: Install Playwright browser
|
|
||||||
run: pnpm exec playwright install --with-deps chromium
|
run: pnpm exec playwright install --with-deps chromium
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: pnpm --filter "${{ matrix.package }}" --if-present run lint:check
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: pnpm test
|
run: pnpm --filter "${{ matrix.package }}" --if-present run test
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint:check": "eslint .",
|
"lint:check": "eslint .",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
|
"test": "vitest run",
|
||||||
"dev": "nuxt dev",
|
"dev": "nuxt dev",
|
||||||
"build": "nuxt build",
|
"build": "nuxt build",
|
||||||
"generate": "nuxt generate",
|
"generate": "nuxt generate",
|
||||||
|
|||||||
Reference in New Issue
Block a user