ci: trim PR critical path

This commit is contained in:
Peter Steinberger 2026-03-13 20:38:03 +00:00
parent 8c21284c1c
commit 5c07207dd1
2 changed files with 15 additions and 15 deletions

View File

@ -81,7 +81,7 @@ jobs:
# Build dist once for Node-relevant changes and share it with downstream jobs. # Build dist once for Node-relevant changes and share it with downstream jobs.
build-artifacts: build-artifacts:
needs: [docs-scope, changed-scope] needs: [docs-scope, changed-scope]
if: needs.docs-scope.outputs.docs_only != 'true' && needs.changed-scope.outputs.run_node == 'true' if: github.event_name == 'push' && needs.docs-scope.outputs.docs_only != 'true' && needs.changed-scope.outputs.run_node == 'true'
runs-on: blacksmith-16vcpu-ubuntu-2404 runs-on: blacksmith-16vcpu-ubuntu-2404
steps: steps:
- name: Checkout - name: Checkout
@ -166,25 +166,25 @@ jobs:
task: test task: test
command: pnpm canvas:a2ui:bundle && bunx vitest run --config vitest.unit.config.ts command: pnpm canvas:a2ui:bundle && bunx vitest run --config vitest.unit.config.ts
steps: steps:
- name: Skip bun lane on push - name: Skip bun lane on pull requests
if: github.event_name == 'push' && matrix.runtime == 'bun' if: github.event_name == 'pull_request' && matrix.runtime == 'bun'
run: echo "Skipping bun test lane on push events." run: echo "Skipping Bun compatibility lane on pull requests."
- name: Checkout - name: Checkout
if: github.event_name != 'push' || matrix.runtime != 'bun' if: github.event_name != 'pull_request' || matrix.runtime != 'bun'
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
submodules: false submodules: false
- name: Setup Node environment - name: Setup Node environment
if: matrix.runtime != 'bun' || github.event_name != 'push' if: matrix.runtime != 'bun' || github.event_name != 'pull_request'
uses: ./.github/actions/setup-node-env uses: ./.github/actions/setup-node-env
with: with:
install-bun: "${{ matrix.runtime == 'bun' }}" install-bun: "${{ matrix.runtime == 'bun' }}"
use-sticky-disk: "false" use-sticky-disk: "false"
- name: Configure Node test resources - name: Configure Node test resources
if: (github.event_name != 'push' || matrix.runtime != 'bun') && matrix.task == 'test' && matrix.runtime == 'node' if: (github.event_name != 'pull_request' || matrix.runtime != 'bun') && matrix.task == 'test' && matrix.runtime == 'node'
env: env:
SHARD_COUNT: ${{ matrix.shard_count || '' }} SHARD_COUNT: ${{ matrix.shard_count || '' }}
SHARD_INDEX: ${{ matrix.shard_index || '' }} SHARD_INDEX: ${{ matrix.shard_index || '' }}
@ -199,7 +199,7 @@ jobs:
fi fi
- name: Run ${{ matrix.task }} (${{ matrix.runtime }}) - name: Run ${{ matrix.task }} (${{ matrix.runtime }})
if: matrix.runtime != 'bun' || github.event_name != 'push' if: matrix.runtime != 'bun' || github.event_name != 'pull_request'
run: ${{ matrix.command }} run: ${{ matrix.command }}
# Types, lint, and format check. # Types, lint, and format check.
@ -252,7 +252,7 @@ jobs:
compat-node22: compat-node22:
name: "compat-node22" name: "compat-node22"
needs: [docs-scope, changed-scope] needs: [docs-scope, changed-scope]
if: needs.docs-scope.outputs.docs_only != 'true' && needs.changed-scope.outputs.run_node == 'true' if: github.event_name == 'push' && needs.docs-scope.outputs.docs_only != 'true' && needs.changed-scope.outputs.run_node == 'true'
runs-on: blacksmith-16vcpu-ubuntu-2404 runs-on: blacksmith-16vcpu-ubuntu-2404
steps: steps:
- name: Checkout - name: Checkout

View File

@ -19,11 +19,11 @@ The CI runs on every push to `main` and every pull request. It uses smart scopin
| `changed-scope` | Detect which areas changed (node/macos/android/windows) | Non-doc changes | | `changed-scope` | Detect which areas changed (node/macos/android/windows) | Non-doc changes |
| `check` | TypeScript types, lint, format | Non-docs, node changes | | `check` | TypeScript types, lint, format | Non-docs, node changes |
| `check-docs` | Markdown lint + broken link check | Docs changed | | `check-docs` | Markdown lint + broken link check | Docs changed |
| `code-analysis` | LOC threshold check (1000 lines) | PRs only |
| `secrets` | Detect leaked secrets | Always | | `secrets` | Detect leaked secrets | Always |
| `build-artifacts` | Build dist once, share with other jobs | Non-docs, node changes | | `build-artifacts` | Build dist once, share with `release-check` | Pushes to `main`, node changes |
| `release-check` | Validate npm pack contents | After build | | `release-check` | Validate npm pack contents | Pushes to `main` after build |
| `checks` | Node/Bun tests + protocol check | Non-docs, node changes | | `checks` | Node tests + protocol check on PRs; Bun compat on push | Non-docs, node changes |
| `compat-node22` | Minimum supported Node runtime compatibility | Pushes to `main`, node changes |
| `checks-windows` | Windows-specific tests | Non-docs, windows-relevant changes | | `checks-windows` | Windows-specific tests | Non-docs, windows-relevant changes |
| `macos` | Swift lint/build/test + TS tests | PRs with macos changes | | `macos` | Swift lint/build/test + TS tests | PRs with macos changes |
| `android` | Gradle build + tests | Non-docs, android changes | | `android` | Gradle build + tests | Non-docs, android changes |
@ -33,8 +33,8 @@ The CI runs on every push to `main` and every pull request. It uses smart scopin
Jobs are ordered so cheap checks fail before expensive ones run: Jobs are ordered so cheap checks fail before expensive ones run:
1. `docs-scope` + `changed-scope` + `check` + `secrets` (parallel, cheap gates first) 1. `docs-scope` + `changed-scope` + `check` + `secrets` (parallel, cheap gates first)
2. `build-artifacts` + `release-check` 2. PRs: `checks` (Linux Node test split into 2 shards), `checks-windows`, `macos`, `android`
3. `checks` (Linux Node test split into 2 shards), `checks-windows`, `macos`, `android` 3. Pushes to `main`: `build-artifacts` + `release-check` + Bun compat + `compat-node22`
Scope logic lives in `scripts/ci-changed-scope.mjs` and is covered by unit tests in `src/scripts/ci-changed-scope.test.ts`. Scope logic lives in `scripts/ci-changed-scope.mjs` and is covered by unit tests in `src/scripts/ci-changed-scope.test.ts`.