diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4fb1c23ed30..97d1a5876e2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -906,7 +906,7 @@ jobs: if: ${{ !cancelled() && (needs.test.result == 'success' || needs.test.result == 'failure') }} uses: ./.github/workflows/unit-selection-evidence.yml with: - rebuild_plan: true + rebuild_plan: ${{ !(vars.ORCA_UNIT_SELECTION_MODE == 'selected' && github.event.pull_request.draft == true) }} # Isolate two browser/mobile files to avoid every unit shard paying for their installs; test the same shipped bundle plus render/census. mobile_web_app: diff --git a/.github/workflows/unit-module-cache-benchmark.yml b/.github/workflows/unit-module-cache-benchmark.yml index e1f4ab645f4..58f3e3d4040 100644 --- a/.github/workflows/unit-module-cache-benchmark.yml +++ b/.github/workflows/unit-module-cache-benchmark.yml @@ -11,31 +11,23 @@ concurrency: cancel-in-progress: true jobs: - unit_plan: - uses: ./.github/workflows/unit-plan.yml - with: - defer_shadow: true - baseline: - needs: unit_plan uses: ./.github/workflows/unit-tests.yml with: - node_versions: '["24"]' + node_versions: '["24.22.1"]' runner: ubuntu-24.04-arm - shards: ${{ needs.unit_plan.outputs.shards }} - download_selection_plan: false + shards: '[{"index":1,"count":5},{"index":2,"count":5},{"index":3,"count":5},{"index":4,"count":5},{"index":5,"count":5}]' artifact_prefix: baseline-unit phase_diagnostics: true run_relay_integration: false producer: - needs: [unit_plan, baseline] + needs: baseline uses: ./.github/workflows/unit-tests.yml with: - node_versions: '["24"]' + node_versions: '["24.22.1"]' runner: ubuntu-24.04-arm - shards: ${{ needs.unit_plan.outputs.shards }} - download_selection_plan: false + shards: '[{"index":1,"count":5},{"index":2,"count":5},{"index":3,"count":5},{"index":4,"count":5},{"index":5,"count":5}]' artifact_prefix: producer-unit module_cache: cold module_cache_namespace: ${{ github.run_id }}-${{ github.run_attempt }} @@ -44,13 +36,12 @@ jobs: run_relay_integration: false warm: - needs: [unit_plan, producer] + needs: producer uses: ./.github/workflows/unit-tests.yml with: - node_versions: '["24"]' + node_versions: '["24.22.1"]' runner: ubuntu-24.04-arm - shards: ${{ needs.unit_plan.outputs.shards }} - download_selection_plan: false + shards: '[{"index":1,"count":5},{"index":2,"count":5},{"index":3,"count":5},{"index":4,"count":5},{"index":5,"count":5}]' artifact_prefix: warm-unit module_cache: warm module_cache_namespace: ${{ github.run_id }}-${{ github.run_attempt }} diff --git a/.github/workflows/unit-module-cache.yml b/.github/workflows/unit-module-cache.yml index 6962fc20927..82cbd107017 100644 --- a/.github/workflows/unit-module-cache.yml +++ b/.github/workflows/unit-module-cache.yml @@ -1,32 +1,13 @@ name: Unit transform cache producer # Cold full unit run on main that publishes per-shard Vitest transform caches. -# Match PR architecture and GitHub's cache store; Vitest invalidates edited source modules. +# Dispatch only: PR shards run on hosted runners, which cannot read this Blacksmith-store cache. on: workflow_dispatch: - schedule: - - cron: '23 3 * * *' - push: - branches: [main] - paths: - - 'package.json' - - 'pnpm-lock.yaml' - - 'pnpm-workspace.yaml' - - '.npmrc' - - 'config/.bun-version' - - 'config/pnpmfile.cjs' - - 'config/patches/**' - - 'config/vitest.config.ts' - - 'config/tsconfig*.json' - - 'config/scripts/vitest*' - - 'config/scripts/ci-unit-*' - - 'config/scripts/run-vitest.mjs' - - '.github/workflows/unit-module-cache.yml' - - '.github/workflows/unit-tests.yml' concurrency: group: unit-module-cache-${{ github.ref }} - cancel-in-progress: false + cancel-in-progress: true permissions: contents: read @@ -35,8 +16,6 @@ jobs: unit_plan: if: github.ref == 'refs/heads/main' uses: ./.github/workflows/unit-plan.yml - with: - defer_shadow: true test: needs: unit_plan @@ -44,9 +23,8 @@ jobs: with: # Match the PR unit matrix so the cache key's runtime and shard fields line up. node_versions: '["24"]' - runner: ubuntu-24.04-arm + runner: blacksmith-8vcpu-ubuntu-2404 shards: ${{ needs.unit_plan.outputs.shards }} module_cache: cold - download_selection_plan: false artifact_prefix: cache-producer-unit run_relay_integration: false diff --git a/config/scripts/pr-workflow-parallelism.test.mjs b/config/scripts/pr-workflow-parallelism.test.mjs index be109e1da70..bc6a6d80fa0 100644 --- a/config/scripts/pr-workflow-parallelism.test.mjs +++ b/config/scripts/pr-workflow-parallelism.test.mjs @@ -5,11 +5,35 @@ import { describe, expect, it } from 'vitest' const workflow = parse(readFileSync('.github/workflows/pr.yml', 'utf8')) const unitTestWorkflow = parse(readFileSync('.github/workflows/unit-tests.yml', 'utf8')) +const planWorkflow = parse(readFileSync('.github/workflows/unit-plan.yml', 'utf8')) const evidenceWorkflow = parse( readFileSync('.github/workflows/unit-selection-evidence.yml', 'utf8') ) describe('PR workflow parallelism', () => { + it.each([ + ['shadow', false, true], + ['shadow', true, true], + ['selected', false, true], + ['selected', true, false], + ['', true, true] + ])('plans only once for mode %s, draft %s', (mode, draft, deferred) => { + const evaluate = (expression, context) => runInNewContext(expression.slice(3, -2), context) + const context = { + vars: { ORCA_UNIT_SELECTION_MODE: mode }, + github: { event: { pull_request: { draft } } } + } + const inputs = { + defer_shadow: workflow.jobs.unit_plan.with.defer_shadow, + selection_mode: evaluate(workflow.jobs.unit_plan.with.selection_mode, context) + } + expect(evaluate(planWorkflow.jobs.plan.env.DEFER_SHADOW, { ...context, inputs })).toBe(deferred) + expect(evaluate(workflow.jobs.test.with.download_selection_plan, context)).toBe(!deferred) + expect(evaluate(workflow.jobs.unit_selection_evidence.with.rebuild_plan, context)).toBe( + deferred + ) + }) + it('enforces import boundaries in the required static-analysis checks', () => { const guard = workflow.jobs.preflight.steps.find((step) => step.run?.includes('bun config/scripts/check-import-boundaries.mjs')