From 9e95a28460c829503ee570c8c20f66e56d1da00d Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 13:22:00 +0000 Subject: [PATCH 01/18] Free disk space on Windows 2025 runners --- .github/workflows/ci.yml | 8 +- src/ci/github-actions/jobs.yml | 4 +- src/ci/scripts/free-disk-space-linux.sh | 265 ++++++++++++++++++++ src/ci/scripts/free-disk-space-windows.ps1 | 32 +++ src/ci/scripts/free-disk-space.sh | 268 +-------------------- 5 files changed, 313 insertions(+), 264 deletions(-) create mode 100755 src/ci/scripts/free-disk-space-linux.sh create mode 100644 src/ci/scripts/free-disk-space-windows.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc8ac539a3a09..35ec528b9ddba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,6 +109,12 @@ jobs: echo "$HOME/.cargo/bin" >> $GITHUB_PATH fi + # Always print disk usage, even for jobs that don't free up disk space. + - name: print disk usage + run: | + echo "disk usage:" + df -h + - name: disable git crlf conversion run: git config --global core.autocrlf false @@ -117,7 +123,7 @@ jobs: with: fetch-depth: 2 - # Free up disk space on Linux by removing preinstalled components that + # Free up disk space on Linux and Windows by removing preinstalled components that # we do not need. We do this to enable some of the less resource # intensive jobs to run on free runners, which however also have # less disk space. diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 0a6ebe44b3d73..e60d1f7b674c6 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -31,13 +31,15 @@ runners: <<: *base-job - &job-windows - os: windows-2022 + os: windows-2025 + free_disk: true <<: *base-job # NOTE: windows-2025 has less disk space available than windows-2022, # because the D drive is missing. - &job-windows-25 os: windows-2025 + free_disk: true <<: *base-job - &job-windows-8c diff --git a/src/ci/scripts/free-disk-space-linux.sh b/src/ci/scripts/free-disk-space-linux.sh new file mode 100755 index 0000000000000..32649fe0d9b34 --- /dev/null +++ b/src/ci/scripts/free-disk-space-linux.sh @@ -0,0 +1,265 @@ +#!/bin/bash +set -euo pipefail + +# Free disk space on Linux GitHub action runners +# Script inspired by https://github.com/jlumbroso/free-disk-space + +isX86() { + local arch + arch=$(uname -m) + if [ "$arch" = "x86_64" ]; then + return 0 + else + return 1 + fi +} + +# Check if we're on a GitHub hosted runner. +# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted". +isGitHubRunner() { + # `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string". + if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then + return 0 + else + return 1 + fi +} + +# print a line of the specified character +printSeparationLine() { + for ((i = 0; i < 80; i++)); do + printf "%s" "$1" + done + printf "\n" +} + +# compute available space +# REF: https://unix.stackexchange.com/a/42049/60849 +# REF: https://stackoverflow.com/a/450821/408734 +getAvailableSpace() { + df -a | awk 'NR > 1 {avail+=$4} END {print avail}' +} + +# make Kb human readable (assume the input is Kb) +# REF: https://unix.stackexchange.com/a/44087/60849 +formatByteCount() { + numfmt --to=iec-i --suffix=B --padding=7 "${1}000" +} + +# macro to output saved space +printSavedSpace() { + # Disk space before the operation + local before=${1} + local title=${2:-} + + local after + after=$(getAvailableSpace) + local saved=$((after - before)) + + if [ "$saved" -lt 0 ]; then + echo "::warning::Saved space is negative: $saved. Using '0' as saved space." + saved=0 + fi + + echo "" + printSeparationLine "*" + if [ -n "${title}" ]; then + echo "=> ${title}: Saved $(formatByteCount "$saved")" + else + echo "=> Saved $(formatByteCount "$saved")" + fi + printSeparationLine "*" + echo "" +} + +# macro to print output of df with caption +printDF() { + local caption=${1} + + printSeparationLine "=" + echo "${caption}" + echo "" + echo "$ df -h" + echo "" + df -h + printSeparationLine "=" +} + +removeUnusedFilesAndDirs() { + local to_remove=( + "/usr/share/java" + ) + + if isGitHubRunner; then + to_remove+=( + "/usr/local/aws-sam-cli" + "/usr/local/doc/cmake" + "/usr/local/julia"* + "/usr/local/lib/android" + "/usr/local/share/chromedriver-"* + "/usr/local/share/chromium" + "/usr/local/share/cmake-"* + "/usr/local/share/edge_driver" + "/usr/local/share/emacs" + "/usr/local/share/gecko_driver" + "/usr/local/share/icons" + "/usr/local/share/powershell" + "/usr/local/share/vcpkg" + "/usr/local/share/vim" + "/usr/share/apache-maven-"* + "/usr/share/gradle-"* + "/usr/share/kotlinc" + "/usr/share/miniconda" + "/usr/share/php" + "/usr/share/ri" + "/usr/share/swift" + + # binaries + "/usr/local/bin/azcopy" + "/usr/local/bin/bicep" + "/usr/local/bin/ccmake" + "/usr/local/bin/cmake-"* + "/usr/local/bin/cmake" + "/usr/local/bin/cpack" + "/usr/local/bin/ctest" + "/usr/local/bin/helm" + "/usr/local/bin/kind" + "/usr/local/bin/kustomize" + "/usr/local/bin/minikube" + "/usr/local/bin/packer" + "/usr/local/bin/phpunit" + "/usr/local/bin/pulumi-"* + "/usr/local/bin/pulumi" + "/usr/local/bin/stack" + + # Haskell runtime + "/usr/local/.ghcup" + + # Azure + "/opt/az" + "/usr/share/az_"* + ) + + if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then + # Environment variable set by GitHub Actions + to_remove+=( + "${AGENT_TOOLSDIRECTORY}" + ) + else + echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal." + fi + else + # Remove folders and files present in AWS CodeBuild + to_remove+=( + # binaries + "/usr/local/bin/ecs-cli" + "/usr/local/bin/eksctl" + "/usr/local/bin/kubectl" + + "${HOME}/.gradle" + "${HOME}/.dotnet" + "${HOME}/.goenv" + "${HOME}/.phpenv" + + ) + fi + + for element in "${to_remove[@]}"; do + if [ ! -e "$element" ]; then + # The file or directory doesn't exist. + # Maybe it was removed in a newer version of the runner or it's not present in a + # specific architecture (e.g. ARM). + echo "::warning::Directory or file $element does not exist, skipping." + fi + done + + # Remove all files and directories at once to save time. + sudo rm -rf "${to_remove[@]}" +} + +execAndMeasureSpaceChange() { + local operation=${1} # Function to execute + local title=${2} + + local before + before=$(getAvailableSpace) + $operation + + printSavedSpace "$before" "$title" +} + +# Remove large packages +# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh +cleanPackages() { + local packages=( + '^aspnetcore-.*' + '^dotnet-.*' + '^llvm-.*' + '^mongodb-.*' + 'firefox' + 'libgl1-mesa-dri' + 'mono-devel' + 'php.*' + ) + + if isGitHubRunner; then + packages+=( + azure-cli + ) + + if isX86; then + packages+=( + 'google-chrome-stable' + 'google-cloud-cli' + 'google-cloud-sdk' + 'powershell' + ) + fi + else + packages+=( + 'google-chrome-stable' + ) + fi + + sudo apt-get -qq remove -y --fix-missing "${packages[@]}" + + sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed" + sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed failed" +} + +# Remove Docker images. +# Ubuntu 22 runners have docker images already installed. +# They aren't present in ubuntu 24 runners. +cleanDocker() { + echo "=> Removing the following docker images:" + sudo docker image ls + echo "=> Removing docker images..." + sudo docker image prune --all --force || true +} + +# Remove Swap storage +cleanSwap() { + sudo swapoff -a || true + sudo rm -rf /mnt/swapfile || true + free -h +} + +# Display initial disk space stats + +AVAILABLE_INITIAL=$(getAvailableSpace) + +printDF "BEFORE CLEAN-UP:" +echo "" +execAndMeasureSpaceChange cleanPackages "Unused packages" +execAndMeasureSpaceChange cleanDocker "Docker images" +execAndMeasureSpaceChange cleanSwap "Swap storage" +execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories" + +# Output saved space statistic +echo "" +printDF "AFTER CLEAN-UP:" + +echo "" +echo "" + +printSavedSpace "$AVAILABLE_INITIAL" "Total saved" diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 new file mode 100644 index 0000000000000..c43039a346a21 --- /dev/null +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -0,0 +1,32 @@ +# Free disk space on Windows GitHub action runners. + +$ErrorActionPreference = 'Stop' + +Get-Volume | Out-String | Write-Output + +# Exclude directory from Defender to make this faster +Add-MpPreference -ExclusionPath C:\ + +$available = $(Get-Volume C).SizeRemaining + +$dirs = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm', +'C:\rtools45', 'C:\ghcup', 'C:\Program Files (x86)\Android', +'C:\Program Files\Google\Chrome', 'C:\Program Files (x86)\Microsoft\Edge', +'C:\Program Files\Mozilla Firefox', 'C:\Program Files\MySQL', 'C:\Julia', +'C:\Program Files\MongoDB', 'C:\Program Files\Azure Cosmos DB Emulator', +'C:\Program Files\PostgreSQL', 'C:\Program Files\Unity Hub', +'C:\Strawberry', 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk' + +foreach ($dir in $dirs) { + Remove-Item -Recurse -Force -ErrorAction Continue $dir & +} + +# Wait for deletion to finish +Get-Job -State Running | Wait-Job +# Cleanup finished jobs +Get-Job | Remove-Job + +Get-Volume | Out-String | Write-Output + +$saved = ($(Get-Volume C).SizeRemaining - $available) / 1gb +Write-Output "total space saved $saved GB" diff --git a/src/ci/scripts/free-disk-space.sh b/src/ci/scripts/free-disk-space.sh index 173f64858b371..062ad801cd8d2 100755 --- a/src/ci/scripts/free-disk-space.sh +++ b/src/ci/scripts/free-disk-space.sh @@ -1,266 +1,10 @@ #!/bin/bash set -euo pipefail -# Free disk space on Linux GitHub action runners -# Script inspired by https://github.com/jlumbroso/free-disk-space +script_dir=$(dirname "$0") -isX86() { - local arch - arch=$(uname -m) - if [ "$arch" = "x86_64" ]; then - return 0 - else - return 1 - fi -} - -# Check if we're on a GitHub hosted runner. -# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted". -isGitHubRunner() { - # `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string". - if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then - return 0 - else - return 1 - fi -} - -# print a line of the specified character -printSeparationLine() { - for ((i = 0; i < 80; i++)); do - printf "%s" "$1" - done - printf "\n" -} - -# compute available space -# REF: https://unix.stackexchange.com/a/42049/60849 -# REF: https://stackoverflow.com/a/450821/408734 -getAvailableSpace() { - df -a | awk 'NR > 1 {avail+=$4} END {print avail}' -} - -# make Kb human readable (assume the input is Kb) -# REF: https://unix.stackexchange.com/a/44087/60849 -formatByteCount() { - numfmt --to=iec-i --suffix=B --padding=7 "${1}000" -} - -# macro to output saved space -printSavedSpace() { - # Disk space before the operation - local before=${1} - local title=${2:-} - - local after - after=$(getAvailableSpace) - local saved=$((after - before)) - - if [ "$saved" -lt 0 ]; then - echo "::warning::Saved space is negative: $saved. Using '0' as saved space." - saved=0 - fi - - echo "" - printSeparationLine "*" - if [ -n "${title}" ]; then - echo "=> ${title}: Saved $(formatByteCount "$saved")" - else - echo "=> Saved $(formatByteCount "$saved")" - fi - printSeparationLine "*" - echo "" -} - -# macro to print output of df with caption -printDF() { - local caption=${1} - - printSeparationLine "=" - echo "${caption}" - echo "" - echo "$ df -h" - echo "" - df -h - printSeparationLine "=" -} - -removeUnusedFilesAndDirs() { - local to_remove=( - "/usr/share/java" - ) - - if isGitHubRunner; then - to_remove+=( - "/usr/local/aws-sam-cli" - "/usr/local/doc/cmake" - "/usr/local/julia"* - "/usr/local/lib/android" - "/usr/local/share/chromedriver-"* - "/usr/local/share/chromium" - "/usr/local/share/cmake-"* - "/usr/local/share/edge_driver" - "/usr/local/share/emacs" - "/usr/local/share/gecko_driver" - "/usr/local/share/icons" - "/usr/local/share/powershell" - "/usr/local/share/vcpkg" - "/usr/local/share/vim" - "/usr/share/apache-maven-"* - "/usr/share/gradle-"* - "/usr/share/kotlinc" - "/usr/share/miniconda" - "/usr/share/php" - "/usr/share/ri" - "/usr/share/swift" - - # binaries - "/usr/local/bin/azcopy" - "/usr/local/bin/bicep" - "/usr/local/bin/ccmake" - "/usr/local/bin/cmake-"* - "/usr/local/bin/cmake" - "/usr/local/bin/cpack" - "/usr/local/bin/ctest" - "/usr/local/bin/helm" - "/usr/local/bin/kind" - "/usr/local/bin/kustomize" - "/usr/local/bin/minikube" - "/usr/local/bin/packer" - "/usr/local/bin/phpunit" - "/usr/local/bin/pulumi-"* - "/usr/local/bin/pulumi" - "/usr/local/bin/stack" - - # Haskell runtime - "/usr/local/.ghcup" - - # Azure - "/opt/az" - "/usr/share/az_"* - ) - - if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then - # Environment variable set by GitHub Actions - to_remove+=( - "${AGENT_TOOLSDIRECTORY}" - ) - else - echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal." - fi - else - # Remove folders and files present in AWS CodeBuild - to_remove+=( - # binaries - "/usr/local/bin/ecs-cli" - "/usr/local/bin/eksctl" - "/usr/local/bin/kubectl" - - "${HOME}/.gradle" - "${HOME}/.dotnet" - "${HOME}/.goenv" - "${HOME}/.phpenv" - - ) - fi - - for element in "${to_remove[@]}"; do - if [ ! -e "$element" ]; then - # The file or directory doesn't exist. - # Maybe it was removed in a newer version of the runner or it's not present in a - # specific architecture (e.g. ARM). - echo "::warning::Directory or file $element does not exist, skipping." - fi - done - - # Remove all files and directories at once to save time. - sudo rm -rf "${to_remove[@]}" -} - -execAndMeasureSpaceChange() { - local operation=${1} # Function to execute - local title=${2} - - local before - before=$(getAvailableSpace) - $operation - - printSavedSpace "$before" "$title" -} - -# Remove large packages -# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh -cleanPackages() { - local packages=( - '^aspnetcore-.*' - '^dotnet-.*' - '^llvm-.*' - '^mongodb-.*' - 'firefox' - 'libgl1-mesa-dri' - 'mono-devel' - 'php.*' - ) - - if isGitHubRunner; then - packages+=( - azure-cli - ) - - if isX86; then - packages+=( - 'google-chrome-stable' - 'google-cloud-cli' - 'google-cloud-sdk' - 'powershell' - ) - fi - else - packages+=( - 'google-chrome-stable' - ) - fi - - sudo apt-get -qq remove -y --fix-missing "${packages[@]}" - - sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed" - sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed failed" -} - -# Remove Docker images. -# Ubuntu 22 runners have docker images already installed. -# They aren't present in ubuntu 24 runners. -cleanDocker() { - echo "=> Removing the following docker images:" - sudo docker image ls - echo "=> Removing docker images..." - sudo docker image prune --all --force || true -} - -# Remove Swap storage -cleanSwap() { - sudo swapoff -a || true - sudo rm -rf /mnt/swapfile || true - free -h -} - -# Display initial disk space stats - -AVAILABLE_INITIAL=$(getAvailableSpace) - -printDF "BEFORE CLEAN-UP:" -echo "" - -execAndMeasureSpaceChange cleanPackages "Unused packages" -execAndMeasureSpaceChange cleanDocker "Docker images" -execAndMeasureSpaceChange cleanSwap "Swap storage" -execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories" - -# Output saved space statistic -echo "" -printDF "AFTER CLEAN-UP:" - -echo "" -echo "" - -printSavedSpace "$AVAILABLE_INITIAL" "Total saved" +if [[ "${RUNNER_OS:-}" == "Windows" ]]; then + pwsh $script_dir/free-disk-space-windows.ps1 +else + $script_dir/free-disk-space-linux.sh +fi From 7685c9180a71ebe2c1a205458c32afd35d14f12b Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 13:55:55 +0000 Subject: [PATCH 02/18] Remove redundant jobs --- src/ci/github-actions/jobs.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index e60d1f7b674c6..32793ed1704e2 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -35,17 +35,6 @@ runners: free_disk: true <<: *base-job - # NOTE: windows-2025 has less disk space available than windows-2022, - # because the D drive is missing. - - &job-windows-25 - os: windows-2025 - free_disk: true - <<: *base-job - - - &job-windows-8c - os: windows-2022-8core-32gb - <<: *base-job - - &job-windows-25-8c os: windows-2025-8core-32gb <<: *base-job From 6a6bdb515b69954600ee90176b801cd82b1f8f70 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:08:48 +0000 Subject: [PATCH 03/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index c43039a346a21..279f662cfbd68 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -5,7 +5,7 @@ $ErrorActionPreference = 'Stop' Get-Volume | Out-String | Write-Output # Exclude directory from Defender to make this faster -Add-MpPreference -ExclusionPath C:\ +#Add-MpPreference -ExclusionPath C:\ $available = $(Get-Volume C).SizeRemaining @@ -30,3 +30,5 @@ Get-Volume | Out-String | Write-Output $saved = ($(Get-Volume C).SizeRemaining - $available) / 1gb Write-Output "total space saved $saved GB" + +exit 1 From d90866df6810b2e00e339a9c9607c14e7bd4fb46 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:22:09 +0000 Subject: [PATCH 04/18] WIP --- .github/workflows/ci.yml | 3 +++ src/ci/scripts/free-disk-space-windows.ps1 | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35ec528b9ddba..6e4abfced3f98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,6 +131,9 @@ jobs: run: src/ci/scripts/free-disk-space.sh if: matrix.free_disk + - name: early exit + - run: exit 1 + # Rust Log Analyzer can't currently detect the PR number of a GitHub # Actions build on its own, so a hint in the log message is needed to # point it in the right direction. diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index 279f662cfbd68..c43039a346a21 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -5,7 +5,7 @@ $ErrorActionPreference = 'Stop' Get-Volume | Out-String | Write-Output # Exclude directory from Defender to make this faster -#Add-MpPreference -ExclusionPath C:\ +Add-MpPreference -ExclusionPath C:\ $available = $(Get-Volume C).SizeRemaining @@ -30,5 +30,3 @@ Get-Volume | Out-String | Write-Output $saved = ($(Get-Volume C).SizeRemaining - $available) / 1gb Write-Output "total space saved $saved GB" - -exit 1 From 54303560b11c92906e6d7192cb4a56d203451564 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:38:36 +0000 Subject: [PATCH 05/18] Update jobs.yml --- src/ci/github-actions/jobs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 32793ed1704e2..d2de82041e501 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -35,7 +35,7 @@ runners: free_disk: true <<: *base-job - - &job-windows-25-8c + - &job-windows-8c os: windows-2025-8core-32gb <<: *base-job From 08007710519fa8890453de3df969df6d04864940 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:38:50 +0000 Subject: [PATCH 06/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index c43039a346a21..c77b6df7eb949 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -4,9 +4,6 @@ $ErrorActionPreference = 'Stop' Get-Volume | Out-String | Write-Output -# Exclude directory from Defender to make this faster -Add-MpPreference -ExclusionPath C:\ - $available = $(Get-Volume C).SizeRemaining $dirs = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm', From f3878de9285f85f0427148f97f44f3fc7ea3ef78 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:38:59 +0000 Subject: [PATCH 07/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index c77b6df7eb949..a9939609420d0 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -20,6 +20,8 @@ foreach ($dir in $dirs) { # Wait for deletion to finish Get-Job -State Running | Wait-Job +# Print any errors +Get-Job | Receive-Job | Write-Output # Cleanup finished jobs Get-Job | Remove-Job From 5737f3aac2f0c52858961ca7ffac37d006cc782a Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:51:29 +0000 Subject: [PATCH 08/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index a9939609420d0..05a24aa7b82a8 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -12,7 +12,8 @@ $dirs = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm' 'C:\Program Files\Mozilla Firefox', 'C:\Program Files\MySQL', 'C:\Julia', 'C:\Program Files\MongoDB', 'C:\Program Files\Azure Cosmos DB Emulator', 'C:\Program Files\PostgreSQL', 'C:\Program Files\Unity Hub', -'C:\Strawberry', 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk' +'C:\Strawberry', 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk', +'C:\does not exist' foreach ($dir in $dirs) { Remove-Item -Recurse -Force -ErrorAction Continue $dir & @@ -21,7 +22,10 @@ foreach ($dir in $dirs) { # Wait for deletion to finish Get-Job -State Running | Wait-Job # Print any errors -Get-Job | Receive-Job | Write-Output +$warnings = Get-Job | Receive-Job +foreach ($warning in $warnings) { + Write-Ouptut "::warning $warning" +} # Cleanup finished jobs Get-Job | Remove-Job From b1d37993624a6419f942ed7ffff5e43992666432 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:53:33 +0000 Subject: [PATCH 09/18] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e4abfced3f98..1efb87e6354f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,7 +131,6 @@ jobs: run: src/ci/scripts/free-disk-space.sh if: matrix.free_disk - - name: early exit - run: exit 1 # Rust Log Analyzer can't currently detect the PR number of a GitHub From 3ab166d083390eaf23d694402204901e0dfefaf5 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:54:27 +0000 Subject: [PATCH 10/18] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1efb87e6354f7..d546c1396d2a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,7 +131,8 @@ jobs: run: src/ci/scripts/free-disk-space.sh if: matrix.free_disk - - run: exit 1 + - name: early exit + run: exit 1 # Rust Log Analyzer can't currently detect the PR number of a GitHub # Actions build on its own, so a hint in the log message is needed to From ad795e4b8ce69cc1faba252391e1e82b48d70f86 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 14:58:04 +0000 Subject: [PATCH 11/18] Update jobs.yml --- src/ci/github-actions/jobs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index d2de82041e501..541272dc93750 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -646,7 +646,7 @@ auto: SCRIPT: python x.py build --set rust.debug=true opt-dist && PGO_HOST=x86_64-pc-windows-msvc ./build/x86_64-pc-windows-msvc/stage0-tools-bin/opt-dist windows-ci -- python x.py dist bootstrap --include-default-paths DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift - <<: *job-windows-25-8c + <<: *job-windows-8c - name: dist-i686-msvc env: From 055ac84747d7ab299c22a5c447f9381afbd63768 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 15:34:29 +0000 Subject: [PATCH 12/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index 05a24aa7b82a8..5756e713a622e 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -22,7 +22,7 @@ foreach ($dir in $dirs) { # Wait for deletion to finish Get-Job -State Running | Wait-Job # Print any errors -$warnings = Get-Job | Receive-Job +$warnings = Get-Job | Receive-Job -ErrorAction Continue foreach ($warning in $warnings) { Write-Ouptut "::warning $warning" } From 055483d468a6603064fad271b3436641ce5622af Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 18:10:24 +0000 Subject: [PATCH 13/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index 5756e713a622e..baa7e03a1ba1f 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -6,28 +6,26 @@ Get-Volume | Out-String | Write-Output $available = $(Get-Volume C).SizeRemaining -$dirs = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm', +$dirs = 'Does not exit', +'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm', 'C:\rtools45', 'C:\ghcup', 'C:\Program Files (x86)\Android', 'C:\Program Files\Google\Chrome', 'C:\Program Files (x86)\Microsoft\Edge', 'C:\Program Files\Mozilla Firefox', 'C:\Program Files\MySQL', 'C:\Julia', 'C:\Program Files\MongoDB', 'C:\Program Files\Azure Cosmos DB Emulator', 'C:\Program Files\PostgreSQL', 'C:\Program Files\Unity Hub', 'C:\Strawberry', 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk', -'C:\does not exist' +'C:\does not exist', 'oh no' foreach ($dir in $dirs) { - Remove-Item -Recurse -Force -ErrorAction Continue $dir & + Start-ThreadJob { Remove-Item -Recurse -Force $dir } } -# Wait for deletion to finish -Get-Job -State Running | Wait-Job -# Print any errors -$warnings = Get-Job | Receive-Job -ErrorAction Continue -foreach ($warning in $warnings) { - Write-Ouptut "::warning $warning" +foreach ($job in Get-Job) { + Wait-Job $job + # Print if any, any. + Write-Output "::warning file=$PSCommandPath::$($job.Error)" + Remove-Job $job } -# Cleanup finished jobs -Get-Job | Remove-Job Get-Volume | Out-String | Write-Output From 77c5f45086c419266838e040e4fffe08fc4ecd48 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 18:30:02 +0000 Subject: [PATCH 14/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index baa7e03a1ba1f..09cf1c6df14d5 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -21,9 +21,10 @@ foreach ($dir in $dirs) { } foreach ($job in Get-Job) { - Wait-Job $job - # Print if any, any. - Write-Output "::warning file=$PSCommandPath::$($job.Error)" + Wait-Job $job > $null + if ($job.Error) { + Write-Output "::warning file=$PSCommandPath::$($job.Error)" + } Remove-Job $job } From 4ba41c19342ab37c2a46f515ee199649a10f99fe Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 18:41:05 +0000 Subject: [PATCH 15/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index 09cf1c6df14d5..db4e2219291b9 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -17,13 +17,14 @@ $dirs = 'Does not exit', 'C:\does not exist', 'oh no' foreach ($dir in $dirs) { - Start-ThreadJob { Remove-Item -Recurse -Force $dir } + Start-ThreadJob { Remove-Item -Recurse -Force -LiteralPath $dir } } foreach ($job in Get-Job) { Wait-Job $job > $null if ($job.Error) { - Write-Output "::warning file=$PSCommandPath::$($job.Error)" + $line = $job.Error.InvocationInfo.ScriptLineNumber + Write-Output "::warning file=$PSCommandPath,line=$line::$($job.Error)" } Remove-Job $job } From 72c203cea5abf7e07db1f7ae92a0f140a2b0dbbd Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 18:46:35 +0000 Subject: [PATCH 16/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index db4e2219291b9..865ffe692100d 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -17,7 +17,7 @@ $dirs = 'Does not exit', 'C:\does not exist', 'oh no' foreach ($dir in $dirs) { - Start-ThreadJob { Remove-Item -Recurse -Force -LiteralPath $dir } + Start-ThreadJob -InputObject $dir -ScriptBlock { Remove-Item -Recurse -Force -LiteralPath $dir } } foreach ($job in Get-Job) { From a79abf9555dcd7b49c02c4bd291dbe56158e0959 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 18:50:56 +0000 Subject: [PATCH 17/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index 865ffe692100d..32f5cea0d3e77 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -17,7 +17,7 @@ $dirs = 'Does not exit', 'C:\does not exist', 'oh no' foreach ($dir in $dirs) { - Start-ThreadJob -InputObject $dir -ScriptBlock { Remove-Item -Recurse -Force -LiteralPath $dir } + Start-ThreadJob -InputObject $dir -ScriptBlock { Remove-Item -Recurse -Force -LiteralPath $input } } foreach ($job in Get-Job) { From 6e7a96502fc87d504f3dcefce069f2d079853c71 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 22 Jul 2025 19:05:00 +0000 Subject: [PATCH 18/18] Update free-disk-space-windows.ps1 --- src/ci/scripts/free-disk-space-windows.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 index 32f5cea0d3e77..2483a6289c479 100644 --- a/src/ci/scripts/free-disk-space-windows.ps1 +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -17,14 +17,15 @@ $dirs = 'Does not exit', 'C:\does not exist', 'oh no' foreach ($dir in $dirs) { - Start-ThreadJob -InputObject $dir -ScriptBlock { Remove-Item -Recurse -Force -LiteralPath $input } + Start-ThreadJob -InputObject $dir { + Remove-Item -Recurse -Force -LiteralPath $input + } | Out-Null } foreach ($job in Get-Job) { - Wait-Job $job > $null + Wait-Job $job | Out-Null if ($job.Error) { - $line = $job.Error.InvocationInfo.ScriptLineNumber - Write-Output "::warning file=$PSCommandPath,line=$line::$($job.Error)" + Write-Output "::warning file=$PSCommandPath::$($job.Error)" } Remove-Job $job }