From 0450c2dc47f7708033d4ea8e7bb1a7899bd43d53 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Mon, 5 Oct 2026 14:29:12 -0700 Subject: [PATCH 1/2] Consolidate compiler cache pipeline templates Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7d94fa-dc25-46f7-955a-ee0f685b10e0 --- .../coreclr/templates/build-cache-stats.yml | 76 +++++++++++++++++++ .../jit-hardware-intrinsics-common.yml | 8 +- .../coreclr/templates/roslyn-cache-stats.yml | 24 ------ .../coreclr/templates/sccache-stats.yml | 20 ----- ...tup-sccache.yml => setup-build-caches.yml} | 47 ++++++++++-- .../coreclr/templates/setup-roslyn-cache.yml | 30 -------- eng/pipelines/global-build.yml | 4 +- eng/pipelines/runtime.yml | 48 ++++++------ 8 files changed, 145 insertions(+), 112 deletions(-) create mode 100644 eng/pipelines/coreclr/templates/build-cache-stats.yml delete mode 100644 eng/pipelines/coreclr/templates/roslyn-cache-stats.yml delete mode 100644 eng/pipelines/coreclr/templates/sccache-stats.yml rename eng/pipelines/coreclr/templates/{setup-sccache.yml => setup-build-caches.yml} (58%) delete mode 100644 eng/pipelines/coreclr/templates/setup-roslyn-cache.yml diff --git a/eng/pipelines/coreclr/templates/build-cache-stats.yml b/eng/pipelines/coreclr/templates/build-cache-stats.yml new file mode 100644 index 00000000000000..684b9e455e3169 --- /dev/null +++ b/eng/pipelines/coreclr/templates/build-cache-stats.yml @@ -0,0 +1,76 @@ +parameters: + archType: 'x64' + osGroup: 'linux' + buildConfig: '' + runtimeFlavor: '' + runtimeVariant: '' + helixQueues: '' + targetRid: '' + nameSuffix: '' + platform: '' + shouldContinueOnError: false + osSubgroup: '' + enableWindowsRoslynCache: false + +steps: + # Roslyn compiler cache + - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx'), and(eq(parameters.osGroup, 'windows'), eq(parameters.enableWindowsRoslynCache, true))), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: + - ${{ if ne(parameters.osGroup, 'windows') }}: + - script: | + set -euo pipefail + + dotnet="$(Build.SourcesDirectory)/.dotnet/dotnet" + if [[ -z "${ROSLYN_CACHE_PATH:-}" || + -z "${ROSLYN_CACHE_BUILD_START:-}" || + ! -x "$dotnet" ]]; then + echo "Roslyn compiler cache statistics are unavailable." + exit 0 + fi + + sdkVersion="$("$dotnet" --version)" + compilerServer="$(Build.SourcesDirectory)/.dotnet/sdk/$sdkVersion/Roslyn/bincore/VBCSCompiler.dll" + if [[ ! -f "$compilerServer" ]]; then + echo "Roslyn compiler server not found at $compilerServer." + exit 0 + fi + + "$dotnet" "$compilerServer" \ + "-cachestats:${ROSLYN_CACHE_BUILD_START}" \ + "-cachepath:${ROSLYN_CACHE_PATH}" || true + displayName: Roslyn compiler cache stats + condition: always() + + - ${{ if eq(parameters.osGroup, 'windows') }}: + - pwsh: | + $dotnet = Join-Path "$(Build.SourcesDirectory)" ".dotnet\dotnet.exe" + if ([string]::IsNullOrEmpty($env:ROSLYN_CACHE_PATH) -or + [string]::IsNullOrEmpty($env:ROSLYN_CACHE_BUILD_START) -or + -not (Test-Path -PathType Leaf $dotnet)) { + Write-Host "Roslyn compiler cache statistics are unavailable." + exit 0 + } + + $sdkVersion = (& $dotnet --version).Trim() + $compilerServer = Join-Path "$(Build.SourcesDirectory)" ".dotnet\sdk\$sdkVersion\Roslyn\bincore\VBCSCompiler.dll" + if (-not (Test-Path -PathType Leaf $compilerServer)) { + Write-Host "Roslyn compiler server not found at $compilerServer." + exit 0 + } + + & $dotnet $compilerServer ` + "-cachestats:$env:ROSLYN_CACHE_BUILD_START" ` + "-cachepath:$env:ROSLYN_CACHE_PATH" + + if ($LASTEXITCODE -ne 0) { + Write-Warning "Roslyn compiler cache statistics exited with code $LASTEXITCODE." + } + + exit 0 + displayName: Roslyn compiler cache stats + condition: always() + + # sccache native compiler cache + - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: + - script: sccache --show-stats || true + displayName: Sccache stats + condition: always() diff --git a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml index b5583adf875692..d372def3fac119 100644 --- a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml +++ b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml @@ -25,9 +25,9 @@ jobs: buildArgs: -s clr+libs -c $(_BuildConfig) timeoutInMinutes: 360 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot @@ -56,9 +56,9 @@ jobs: buildArgs: -s clr.aot+libs.native+libs.sfx -c $(_BuildConfig) timeoutInMinutes: 360 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot diff --git a/eng/pipelines/coreclr/templates/roslyn-cache-stats.yml b/eng/pipelines/coreclr/templates/roslyn-cache-stats.yml deleted file mode 100644 index cf9dc92a01b316..00000000000000 --- a/eng/pipelines/coreclr/templates/roslyn-cache-stats.yml +++ /dev/null @@ -1,24 +0,0 @@ -steps: - - script: | - set -euo pipefail - - dotnet="$(Build.SourcesDirectory)/.dotnet/dotnet" - if [[ -z "${ROSLYN_CACHE_PATH:-}" || - -z "${ROSLYN_CACHE_BUILD_START:-}" || - ! -x "$dotnet" ]]; then - echo "Roslyn compiler cache statistics are unavailable." - exit 0 - fi - - sdkVersion="$("$dotnet" --version)" - compilerServer="$(Build.SourcesDirectory)/.dotnet/sdk/$sdkVersion/Roslyn/bincore/VBCSCompiler.dll" - if [[ ! -f "$compilerServer" ]]; then - echo "Roslyn compiler server not found at $compilerServer." - exit 0 - fi - - "$dotnet" "$compilerServer" \ - "-cachestats:${ROSLYN_CACHE_BUILD_START}" \ - "-cachepath:${ROSLYN_CACHE_PATH}" || true - displayName: Roslyn compiler cache stats - condition: always() diff --git a/eng/pipelines/coreclr/templates/sccache-stats.yml b/eng/pipelines/coreclr/templates/sccache-stats.yml deleted file mode 100644 index 86bd555e568609..00000000000000 --- a/eng/pipelines/coreclr/templates/sccache-stats.yml +++ /dev/null @@ -1,20 +0,0 @@ -parameters: - archType: 'x64' - osGroup: 'linux' - buildConfig: '' - runtimeFlavor: '' - runtimeVariant: '' - helixQueues: '' - targetRid: '' - nameSuffix: '' - platform: '' - shouldContinueOnError: false - osSubgroup: '' - -steps: - - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: - - template: /eng/pipelines/coreclr/templates/roslyn-cache-stats.yml - - - script: sccache --show-stats || true - displayName: Sccache stats - condition: always() diff --git a/eng/pipelines/coreclr/templates/setup-sccache.yml b/eng/pipelines/coreclr/templates/setup-build-caches.yml similarity index 58% rename from eng/pipelines/coreclr/templates/setup-sccache.yml rename to eng/pipelines/coreclr/templates/setup-build-caches.yml index cf703d5da6501b..813e4c18225aa3 100644 --- a/eng/pipelines/coreclr/templates/setup-sccache.yml +++ b/eng/pipelines/coreclr/templates/setup-build-caches.yml @@ -10,20 +10,51 @@ parameters: platform: '' shouldContinueOnError: false osSubgroup: '' + enableWindowsRoslynCache: false # sccache version. Keep the version in sync across platforms so all jobs # cache against the same compiler-launcher behavior. sccacheVersion: '0.15.0' steps: - - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: - - template: /eng/pipelines/coreclr/templates/setup-roslyn-cache.yml - parameters: - osGroup: ${{ parameters.osGroup }} - osSubgroup: ${{ parameters.osSubgroup }} - archType: ${{ parameters.archType }} - nameSuffix: ${{ parameters.nameSuffix }} + # Roslyn compiler cache + - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx'), and(eq(parameters.osGroup, 'windows'), eq(parameters.enableWindowsRoslynCache, true))), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: + # Cache entries restored by pull request builds come only from the pull + # request itself or its target branch. This lets rolling builds seed the + # cache without allowing pull requests to modify caches used by main. + # + # Keep Debug and Release entries separate so rolling builds can seed both + # configurations without competing for the same immutable cache key. + # Roslyn's own deterministic key accounts for legs that override the + # matrix configuration in their build arguments. + - task: Cache@2 + displayName: Roslyn compiler cache + continueOnError: true + inputs: + key: roslyn | v2 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(buildConfigUpper)" | "$(Build.BuildId)" + path: $(Pipeline.Workspace)/.roslyn-cache + restoreKeys: | + roslyn | v2 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(buildConfigUpper)" + roslyn | v1 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} + + - ${{ if ne(parameters.osGroup, 'windows') }}: + - script: | + set -euo pipefail + echo "##vso[task.setvariable variable=ROSLYN_CACHE_PATH]$(Pipeline.Workspace)/.roslyn-cache" + echo "##vso[task.setvariable variable=ROSLYN_CACHE_BUILD_START]$(date -u +"%Y-%m-%dT%H:%M:%SZ")" + displayName: Configure Roslyn compiler cache + + - ${{ if eq(parameters.osGroup, 'windows') }}: + - pwsh: | + $cachePath = Join-Path "$(Pipeline.Workspace)" ".roslyn-cache" + $buildStart = [DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ") + Write-Host "##vso[task.setvariable variable=ROSLYN_CACHE_PATH]$cachePath" + Write-Host "##vso[task.setvariable variable=ROSLYN_CACHE_BUILD_START]$buildStart" + displayName: Configure Roslyn compiler cache + + # sccache native compiler cache + - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: # Set up the Azure Pipeline Cache for sccache's local cache directory. # Use a rolling key so each build can update the cache; restoreKeys # falls back to the most recent saved entry. @@ -32,7 +63,7 @@ steps: # the *managed* Configuration (Debug for PRs, Release for rolling # builds), but sccache only caches native (C/C++) compilations whose # flags are controlled by RuntimeConfiguration (-rc), which is - # constant per leg regardless of buildConfig. Omitting it lets PR + # constant per leg regardless of buildConfig. Omitting it lets PR # builds warm-start from rolling-build caches saved in the main scope. # # osGroup/osSubgroup/archType keep each platform's cache isolated so diff --git a/eng/pipelines/coreclr/templates/setup-roslyn-cache.yml b/eng/pipelines/coreclr/templates/setup-roslyn-cache.yml deleted file mode 100644 index 091e8dcbc9f8cc..00000000000000 --- a/eng/pipelines/coreclr/templates/setup-roslyn-cache.yml +++ /dev/null @@ -1,30 +0,0 @@ -parameters: - archType: 'x64' - osGroup: 'linux' - nameSuffix: '' - osSubgroup: '' - -steps: - # Cache entries restored by pull request builds come only from the pull - # request itself or its target branch. This lets rolling builds seed the - # cache without allowing pull requests to modify caches used by main. - # - # Keep Debug and Release entries separate so rolling builds can seed both - # configurations without competing for the same immutable cache key. - # Roslyn's own deterministic key accounts for legs that override the - # matrix configuration in their build arguments. - - task: Cache@2 - displayName: Roslyn compiler cache - continueOnError: true - inputs: - key: roslyn | v2 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(buildConfigUpper)" | "$(Build.BuildId)" - path: $(Pipeline.Workspace)/.roslyn-cache - restoreKeys: | - roslyn | v2 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} | "$(buildConfigUpper)" - roslyn | v1 | ${{ parameters.osGroup }}${{ parameters.osSubgroup }} | ${{ parameters.archType }} | ${{ parameters.nameSuffix }} - - - script: | - set -euo pipefail - echo "##vso[task.setvariable variable=ROSLYN_CACHE_PATH]$(Pipeline.Workspace)/.roslyn-cache" - echo "##vso[task.setvariable variable=ROSLYN_CACHE_BUILD_START]$(date -u +"%Y-%m-%dT%H:%M:%SZ")" - displayName: Configure Roslyn compiler cache diff --git a/eng/pipelines/global-build.yml b/eng/pipelines/global-build.yml index b22878baa187d4..f40cd1e3ceabee 100644 --- a/eng/pipelines/global-build.yml +++ b/eng/pipelines/global-build.yml @@ -135,9 +135,9 @@ extends: buildArgs: -subset clr.native+libs.native+host.native -c $(_BuildConfig) timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml condition: or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 0bb91cf46e6477..3ef7fc4710f524 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -96,9 +96,9 @@ extends: buildArgs: -s clr+libs+host+packs -rc Release -lc Release -c $(_BuildConfig) timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml condition: >- or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), @@ -116,9 +116,9 @@ extends: buildArgs: -s clr+libs+host+packs -rc Release -c Release -lc $(_BuildConfig) timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml condition: >- or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), @@ -337,9 +337,9 @@ extends: buildArgs: -s clr+libs+libs.tests+host+packs -rc Release -c $(_BuildConfig) /p:ArchiveTests=true timeoutInMinutes: 180 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/libraries/helix.yml parameters: creator: dotnet-bot @@ -383,9 +383,9 @@ extends: buildArgs: -s clr+libs+libs.tests+host+packs -rc Release -c $(_BuildConfig) /p:ArchiveTests=true timeoutInMinutes: 180 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -447,9 +447,9 @@ extends: buildArgs: -s clr+libs+host+packs -c $(_BuildConfig) timeoutInMinutes: 180 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/installer/helix-queues-setup.yml parameters: creator: dotnet-bot @@ -487,9 +487,9 @@ extends: buildArgs: -s clr+libs+libs.tests -c $(_BuildConfig) -rc Checked /p:ArchiveTests=true timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml - template: /eng/pipelines/common/upload-artifact-step.yml parameters: @@ -537,9 +537,9 @@ extends: buildArgs: -s clr+clr.wasmjit+libs -c $(_BuildConfig) -rc Checked timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml - template: /eng/pipelines/common/upload-artifact-step.yml parameters: @@ -613,9 +613,9 @@ extends: buildArgs: -s clr+libs -c $(_BuildConfig) -rc Checked timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml - template: /eng/pipelines/common/upload-artifact-step.yml parameters: @@ -686,9 +686,9 @@ extends: buildArgs: -s clr+libs+libs.tests -rc $(_BuildConfig) -c Release /p:ArchiveTests=true timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/common/upload-artifact-step.yml parameters: rootFolder: $(Build.SourcesDirectory)/artifacts/bin @@ -799,9 +799,9 @@ extends: buildArgs: -s clr+libs+host+packs+tools.cdac -c $(_BuildConfig) -rc Checked --bootstrap timeoutInMinutes: 120 preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml condition: >- or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), @@ -915,9 +915,9 @@ extends: nameSuffix: NativeAOT buildArgs: -s clr.aot+libs+tools.illink -c $(_BuildConfig) -rc $(_BuildConfig) -lc Release /p:RunAnalyzers=false preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml parameters: creator: dotnet-bot @@ -957,10 +957,10 @@ extends: buildArgs: -s clr.aot+libs+libs.tests -c $(_BuildConfig) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true /p:ArchiveTests=true /p:RunAnalyzers=false timeoutInMinutes: 240 # Doesn't actually take long, but we've seen the ARM64 Helix queue often get backlogged for 2+ hours preBuildSteps: - - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml # extra steps, run tests postBuildSteps: - - template: /eng/pipelines/coreclr/templates/sccache-stats.yml + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/libraries/helix.yml parameters: creator: dotnet-bot From b5d98af14a2e0c7b24259adefde2824a55263c4c Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Mon, 5 Oct 2026 14:36:08 -0700 Subject: [PATCH 2/2] Enable Roslyn compiler caching on Windows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7d94fa-dc25-46f7-955a-ee0f685b10e0 --- eng/pipelines/coreclr/templates/build-cache-stats.yml | 3 +-- eng/pipelines/coreclr/templates/setup-build-caches.yml | 3 +-- eng/pipelines/runtime.yml | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/coreclr/templates/build-cache-stats.yml b/eng/pipelines/coreclr/templates/build-cache-stats.yml index 684b9e455e3169..98c7cf4e8d2c32 100644 --- a/eng/pipelines/coreclr/templates/build-cache-stats.yml +++ b/eng/pipelines/coreclr/templates/build-cache-stats.yml @@ -10,11 +10,10 @@ parameters: platform: '' shouldContinueOnError: false osSubgroup: '' - enableWindowsRoslynCache: false steps: # Roslyn compiler cache - - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx'), and(eq(parameters.osGroup, 'windows'), eq(parameters.enableWindowsRoslynCache, true))), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: + - ${{ if or(eq(parameters.osGroup, 'windows'), and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64')))) }}: - ${{ if ne(parameters.osGroup, 'windows') }}: - script: | set -euo pipefail diff --git a/eng/pipelines/coreclr/templates/setup-build-caches.yml b/eng/pipelines/coreclr/templates/setup-build-caches.yml index 813e4c18225aa3..024bf54ee24785 100644 --- a/eng/pipelines/coreclr/templates/setup-build-caches.yml +++ b/eng/pipelines/coreclr/templates/setup-build-caches.yml @@ -10,7 +10,6 @@ parameters: platform: '' shouldContinueOnError: false osSubgroup: '' - enableWindowsRoslynCache: false # sccache version. Keep the version in sync across platforms so all jobs # cache against the same compiler-launcher behavior. @@ -18,7 +17,7 @@ parameters: steps: # Roslyn compiler cache - - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx'), and(eq(parameters.osGroup, 'windows'), eq(parameters.enableWindowsRoslynCache, true))), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: + - ${{ if or(eq(parameters.osGroup, 'windows'), and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd'), eq(parameters.osGroup, 'openbsd'), eq(parameters.osGroup, 'osx')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64')))) }}: # Cache entries restored by pull request builds come only from the pull # request itself or its target branch. This lets rolling builds seed the # cache without allowing pull requests to modify caches used by main. diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 3ef7fc4710f524..7b68b0198c6a55 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -378,6 +378,7 @@ extends: - linux_x64 - linux_musl_x64 - osx_arm64 + - windows_x64 jobParameters: nameSuffix: CoreCLR_AllSubsets buildArgs: -s clr+libs+libs.tests+host+packs -rc Release -c $(_BuildConfig) /p:ArchiveTests=true @@ -403,7 +404,10 @@ extends: nameSuffix: CoreCLR_AllSubsets buildArgs: -s clr+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true timeoutInMinutes: 180 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-build-caches.yml postBuildSteps: + - template: /eng/pipelines/coreclr/templates/build-cache-stats.yml - template: /eng/pipelines/libraries/helix.yml parameters: helixBuildConfig: Release