Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix more sccache problems on windows runners for external PRs (#48980)

Conrad Irwin8976b33a8eff
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e7782fac655..de1572da86e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -159,7 +159,7 @@ jobs:
run: cargo nextest run --workspace --no-fail-fast
shell: pwsh
- name: steps::show_sccache_stats
- run: '& $env:RUSTC_WRAPPER --show-stats; exit 0'
+ run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
shell: pwsh
- name: steps::cleanup_cargo_config
if: always()
@@ -278,7 +278,7 @@ jobs:
run: ./script/clippy.ps1
shell: pwsh
- name: steps::show_sccache_stats
- run: '& $env:RUSTC_WRAPPER --show-stats; exit 0'
+ run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
shell: pwsh
timeout-minutes: 60
check_scripts:
diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml
index 5645fb987d4..3770d26dcf9 100644
--- a/.github/workflows/release_nightly.yml
+++ b/.github/workflows/release_nightly.yml
@@ -67,7 +67,7 @@ jobs:
run: cargo nextest run --workspace --no-fail-fast
shell: pwsh
- name: steps::show_sccache_stats
- run: '& $env:RUSTC_WRAPPER --show-stats; exit 0'
+ run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
shell: pwsh
- name: steps::cleanup_cargo_config
if: always()
@@ -110,7 +110,7 @@ jobs:
run: ./script/clippy.ps1
shell: pwsh
- name: steps::show_sccache_stats
- run: '& $env:RUSTC_WRAPPER --show-stats; exit 0'
+ run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
shell: pwsh
timeout-minutes: 60
bundle_linux_aarch64:
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
index e218dc64389..f504ea3357d 100644
--- a/.github/workflows/run_tests.yml
+++ b/.github/workflows/run_tests.yml
@@ -176,7 +176,7 @@ jobs:
run: ./script/clippy.ps1
shell: pwsh
- name: steps::show_sccache_stats
- run: '& $env:RUSTC_WRAPPER --show-stats; exit 0'
+ run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
shell: pwsh
timeout-minutes: 60
clippy_linux:
@@ -303,7 +303,7 @@ jobs:
run: cargo nextest run --workspace --no-fail-fast${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
shell: pwsh
- name: steps::show_sccache_stats
- run: '& $env:RUSTC_WRAPPER --show-stats; exit 0'
+ run: if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0
shell: pwsh
- name: steps::cleanup_cargo_config
if: always()
diff --git a/tooling/xtask/src/tasks/workflows/steps.rs b/tooling/xtask/src/tasks/workflows/steps.rs
index 7c31aec6565..8489208f899 100644
--- a/tooling/xtask/src/tasks/workflows/steps.rs
+++ b/tooling/xtask/src/tasks/workflows/steps.rs
@@ -232,8 +232,11 @@ pub fn setup_sccache(platform: Platform) -> Step<Run> {
pub fn show_sccache_stats(platform: Platform) -> Step<Run> {
match platform {
// Use $env:RUSTC_WRAPPER (absolute path) because GITHUB_PATH changes
- // don't take effect until the next step in PowerShell
- Platform::Windows => named::pwsh("& $env:RUSTC_WRAPPER --show-stats; exit 0"),
+ // don't take effect until the next step in PowerShell.
+ // Check if RUSTC_WRAPPER is set first (it won't be for fork PRs without secrets).
+ Platform::Windows => {
+ named::pwsh("if ($env:RUSTC_WRAPPER) { & $env:RUSTC_WRAPPER --show-stats }; exit 0")
+ }
Platform::Linux | Platform::Mac => named::bash("sccache --show-stats || true"),
}
}