Skip to content

ci: speed up CI pipeline and parallelize tests#3833

Open
joheredi wants to merge 1 commit intoAzure:mainfrom
joheredi:ci/speedup-pipeline-and-tests
Open

ci: speed up CI pipeline and parallelize tests#3833
joheredi wants to merge 1 commit intoAzure:mainfrom
joheredi:ci/speedup-pipeline-and-tests

Conversation

@joheredi
Copy link
Member

@joheredi joheredi commented Mar 9, 2026

Summary

Three independent improvements to CI and test performance:

1. CI Pipeline: Targeted builds with pnpm caching

  • New install.yml template with Cache@2 for pnpm store and PUPPETEER_SKIP_DOWNLOAD=true
  • New build-autorest.yml and build-typespec-emitter.yml — scoped build templates that only compile the packages each downstream job actually needs
  • Updated ci.yml so downstream jobs use targeted builds instead of full monorepo pnpm build
  • Updated nightly-prepare.yml with caching and targeted build

Impact: Every downstream CI job avoids rebuilding the entire monorepo. Combined with pnpm store caching, this reduces install+build time significantly per job.

2. Modular Scenario Tests: Parallel execution via file-level sharding

  • Replaced the monolithic scenarios.spec.ts (which funneled all 282 scenario tests through one Mocha file) with 34 directory-level wrapper specs under test/modularUnit/scenario-specs/
  • Extracted reusable harness into scenarioHarness.ts
  • Enabled mocha --parallel --jobs 4 for scenario wrapper specs
  • Added auto-generation script (regen-scenario-specs) and verification guard (check:scenario-specs) to prevent new scenario directories from being silently missed

Impact: Scenario tests now run across 4 parallel Mocha workers instead of a single serial file. Validated: 476 scenario tests passing, 69 core tests passing.

3. Integration Tests: Parallel RLC + Modular suites

  • test:standard and test:azure now run their RLC (port 3000) and Modular (port 3002) integration suites in parallel via npm-run-all --parallel
  • Made generation worker count configurable via GEN_WORKERS env var (defaults to 4)

Safety verification:

  • RLC and Modular use different ports (3000 vs 3002) ✅
  • They write to separate output directories ✅
  • tsp-spector server stop -p <port> is port-specific ✅
  • temp/specs/ is read-only during generation ✅

Impact: ~2x speedup for the integration test phase within each CI job.

Files changed

Area Files
CI templates install.yml, build-autorest.yml, build-typespec-emitter.yml, build.yml, ci.yml, smoke-test.yml, nightly-prepare.yml
Scenario parallelization scenarioHarness.ts, scenario-specs/*.spec.ts (34 files), modular-scenario-specs.ts, generate-modular-scenario-specs.ts, check-modular-scenario-specs.ts
Integration parallelization package.json, gen-cadl-ranch.js

Testing

  • pnpm build
  • pnpm format
  • npm run unit-test:modular — 69 core + 476 scenario tests passing ✅
  • npm run check:scenario-specs — 34 files up to date ✅
  • Targeted build commands (pnpm --filter) validated for all 3 packages ✅

Three independent improvements to CI and test performance:

1. CI pipeline: Add pnpm store caching and targeted build templates
   - New install.yml with Cache@2 for pnpm store and PUPPETEER_SKIP_DOWNLOAD
   - New build-autorest.yml and build-typespec-emitter.yml for scoped builds
   - Downstream CI jobs now build only the packages they need instead of
     full monorepo builds

2. Modular scenario tests: Split into parallel shards
   - Replace monolithic scenarios.spec.ts with 34 directory-level wrapper specs
   - Enable mocha --parallel --jobs 4 for scenario test execution
   - Add auto-generation script and verification guard to prevent drift
   - New scripts: regen-scenario-specs, check:scenario-specs

3. Integration tests: Parallelize RLC and Modular suites
   - Run RLC (port 3000) and Modular (port 3002) in parallel within
     test:standard and test:azure since they use different ports and
     output directories
   - Make generation worker count configurable via GEN_WORKERS env var

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HRLC P1 priority 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants