Repository navigation
ci(http-client-csharp): parallelize generation, cache NuGet packages, remove redundant builds - #12754
Open
Alan Zimmer (alzimmermsft) wants to merge 2 commits into
Conversation
… remove redundant builds Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Alan Zimmer (alzimmermsft)
requested review from
Jorge Rangel (jorgerangel-msft),
Jose Arriaga Maldonado (joseharriaga) and
m-nash
as code owners
December 4, 2026 21:54
commit: |
Contributor
|
No changes needing a change description found. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Parallel generation can silently delete child project files, and coverage collects project paths before regeneration, potentially validating stale or incomplete output.
2 open issues
What changed in this PR
Speeds up C# emitter CI through caching, parallel generation, and fewer redundant builds, without changing shared pipeline templates.
Changes:
- Adds NuGet caching and .NET CLI environment settings.
- Runs generation concurrently with configurable parallelism.
- Consolidates Spector builds and reuses existing build outputs for tests.
| File | Description |
|---|---|
packages/http-client-csharp/eng/scripts/Test-Packages.ps1 |
Removes redundant builds and enables build reuse. |
packages/http-client-csharp/eng/scripts/Get-Spector-Coverage.ps1 |
Parallelizes generation and consolidates project builds. |
packages/http-client-csharp/eng/scripts/Generation.psm1 |
Adds command collection and parallel execution helpers. |
packages/http-client-csharp/eng/scripts/Generate.ps1 |
Queues generation jobs and skips generation in launch-only mode. |
packages/http-client-csharp/eng/pipeline/templates/ci-stages.yml |
Configures NuGet caching and .NET CLI settings. |
Review effort: Balanced
…age once, install only .NET 10 - Merge generation jobs with nested output directories so parent and child specs run sequentially - Collect Spector projects after generation - Run Spector coverage only in the primary Linux test job - Pass 2x processor count generation parallelism on CI - Install only .NET 10 and avoid the cspell failure Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Brings CI improvements similar to #12752 (Java) to the C# emitter. Changes are scoped to
packages/http-client-csharp; shared emitter pipeline templates are untouched.Changes
eng/pipeline/templates/ci-stages.yml): setsNUGET_PACKAGESand adds aCache@2step keyed on OS +eng/nuget.config+Packages.Data.props+Directory.Build.targets+*.csproj. Also setsDOTNET_NOLOGO,DOTNET_CLI_TELEMETRY_OPTOUT,DOTNET_SKIP_FIRST_TIME_EXPERIENCE.Generation.psm1): newGet-SpecGenerationCommands/Invoke-ParallelGenerationhelpers. Parallelism defaults to processor count, override withCSHARP_GENERATION_PARALLELISM. Output is only printed in full for failed specs. ExistingGenerate-Versioning/Generate-Srv-Drivenremain forTest-Spector.ps1.Generate.ps1(RegenCheck): Sample-TypeSpec and Spector specs generate in parallel.-LaunchOnlyno longer generates versioning/srv-driven specs.Get-Spector-Coverage.ps1: new-SkipBuildswitch; parallel generation; one parallel build of a temporary.slnxreplaces the serial per-project builds;dotnet test --no-build.CSHARP_RUN_SPECTOR_COVERAGE; Windows and secondary-Node jobs skip it. Only .NET 10 is installed. CI passes-GenerationParallelism= 2x processor count; local default parallelism is unchanged.http/type/unionand.../discriminated/extends) are merged and run sequentially, outer folder first, because generation deletes project files under its output directory.Test-Packages.ps1: unit tests usedotnet test --no-buildafternpm run build; coverage runs with-SkipBuild; GenerationChecks drops a redundantnpm run build(Generate.ps1 builds what it needs).Local validation (16 cores, Windows)
Generate.ps1(full): ~6.8 min, no git diff (previously ~33 min serially).Get-Spector-Coverage.ps1 -SkipBuild(full): 11.2 min; 971 passed, 10 skipped (previously estimated 45+ min).npm run coppasses.Notes / follow-ups