Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ci: Clean workspace members more eagerly (#53427)
Piotr Osiewiczc69a91baf83c
diff --git a/.github/actions/run_tests/action.yml b/.github/actions/run_tests/action.ymlindex 610c334a65c..9448dfebb0e 100644--- a/.github/actions/run_tests/action.yml+++ b/.github/actions/run_tests/action.yml@@ -13,11 +13,8 @@ runs:node-version: "18"- name: Limit target directory size- env:- MAX_SIZE: ${{ runner.os == 'macOS' && 300 || 100 }}shell: bash -euxo pipefail {0}- # Use the variable in the run command- run: script/clear-target-dir-if-larger-than ${{ env.MAX_SIZE }}+ run: script/clear-target-dir-if-larger-than 350 200- name: Run testsshell: bash -euxo pipefail {0}diff --git a/.github/workflows/deploy_collab.yml b/.github/workflows/deploy_collab.ymlindex 5a3eff18681..b689f303365 100644--- a/.github/workflows/deploy_collab.yml+++ b/.github/workflows/deploy_collab.yml@@ -68,7 +68,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 250+ run: ./script/clear-target-dir-if-larger-than 350 200- name: deploy_collab::tests::run_collab_testsrun: cargo nextest run --package collab --no-fail-fastservices:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 1001081ae4b..9a164557d20 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -33,7 +33,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: steps::setup_sccacherun: ./script/setup-sccacheenv:@@ -83,7 +83,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 250+ run: ./script/clear-target-dir-if-larger-than 350 200- name: steps::setup_sccacherun: ./script/setup-sccacheenv:@@ -126,7 +126,7 @@ jobs:with:node-version: '20'- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than.ps1 250+ run: ./script/clear-target-dir-if-larger-than.ps1 350 200shell: pwsh- name: steps::setup_sccacherun: ./script/setup-sccache.ps1@@ -452,7 +452,7 @@ jobs:with:token: ${{ secrets.SENTRY_AUTH_TOKEN }}- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: run_bundling::bundle_mac::bundle_macrun: ./script/bundle-mac aarch64-apple-darwin- name: '@actions/upload-artifact Zed-aarch64.dmg'@@ -497,7 +497,7 @@ jobs:with:token: ${{ secrets.SENTRY_AUTH_TOKEN }}- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: run_bundling::bundle_mac::bundle_macrun: ./script/bundle-mac x86_64-apple-darwin- name: '@actions/upload-artifact Zed-x86_64.dmg'diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.ymlindex 30d0e1fbf9c..1adb283cc25 100644--- a/.github/workflows/release_nightly.yml+++ b/.github/workflows/release_nightly.yml@@ -43,7 +43,7 @@ jobs:with:node-version: '20'- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than.ps1 250+ run: ./script/clear-target-dir-if-larger-than.ps1 350 200shell: pwsh- name: steps::setup_sccacherun: ./script/setup-sccache.ps1@@ -220,7 +220,7 @@ jobs:with:token: ${{ secrets.SENTRY_AUTH_TOKEN }}- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: run_bundling::bundle_mac::bundle_macrun: ./script/bundle-mac aarch64-apple-darwin- name: '@actions/upload-artifact Zed-aarch64.dmg'@@ -271,7 +271,7 @@ jobs:with:token: ${{ secrets.SENTRY_AUTH_TOKEN }}- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: run_bundling::bundle_mac::bundle_macrun: ./script/bundle-mac x86_64-apple-darwin- name: '@actions/upload-artifact Zed-x86_64.dmg'diff --git a/.github/workflows/run_bundling.yml b/.github/workflows/run_bundling.ymlindex 71b2e4d5fa0..05a951588bf 100644--- a/.github/workflows/run_bundling.yml+++ b/.github/workflows/run_bundling.yml@@ -116,7 +116,7 @@ jobs:with:token: ${{ secrets.SENTRY_AUTH_TOKEN }}- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: run_bundling::bundle_mac::bundle_macrun: ./script/bundle-mac aarch64-apple-darwin- name: '@actions/upload-artifact Zed-aarch64.dmg'@@ -160,7 +160,7 @@ jobs:with:token: ${{ secrets.SENTRY_AUTH_TOKEN }}- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: run_bundling::bundle_mac::bundle_macrun: ./script/bundle-mac x86_64-apple-darwin- name: '@actions/upload-artifact Zed-x86_64.dmg'diff --git a/.github/workflows/run_cron_unit_evals.yml b/.github/workflows/run_cron_unit_evals.ymlindex 7bb7f79473e..7cc0d40760a 100644--- a/.github/workflows/run_cron_unit_evals.yml+++ b/.github/workflows/run_cron_unit_evals.yml@@ -40,7 +40,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 250+ run: ./script/clear-target-dir-if-larger-than 350 200- name: steps::setup_sccacherun: ./script/setup-sccacheenv:diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.ymlindex 13d036b1286..ce7b789731b 100644--- a/.github/workflows/run_tests.yml+++ b/.github/workflows/run_tests.yml@@ -324,7 +324,7 @@ jobs:with:node-version: '20'- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than.ps1 250+ run: ./script/clear-target-dir-if-larger-than.ps1 350 200shell: pwsh- name: steps::setup_sccacherun: ./script/setup-sccache.ps1@@ -379,7 +379,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 250+ run: ./script/clear-target-dir-if-larger-than 350 200- name: steps::setup_sccacherun: ./script/setup-sccacheenv:@@ -430,7 +430,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 300+ run: ./script/clear-target-dir-if-larger-than 350 200- name: steps::setup_sccacherun: ./script/setup-sccacheenv:diff --git a/.github/workflows/run_unit_evals.yml b/.github/workflows/run_unit_evals.ymlindex 1bf75188832..4b70d15012c 100644--- a/.github/workflows/run_unit_evals.yml+++ b/.github/workflows/run_unit_evals.yml@@ -43,7 +43,7 @@ jobs:- name: steps::cargo_install_nextestuses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c- name: steps::clear_target_dir_if_large- run: ./script/clear-target-dir-if-larger-than 250+ run: ./script/clear-target-dir-if-larger-than 350 200- name: steps::setup_sccacherun: ./script/setup-sccacheenv:diff --git a/script/clear-target-dir-if-larger-than b/script/clear-target-dir-if-larger-thanindex 6041c0f5be0..0949cef4acd 100755--- a/script/clear-target-dir-if-larger-than+++ b/script/clear-target-dir-if-larger-than@@ -2,8 +2,8 @@set -euxo pipefail-if [[ $# -ne 1 ]]; then- echo "usage: $0 <MAX_SIZE_IN_GB>"+if [[ $# -lt 1 || $# -gt 2 ]]; then+ echo "usage: $0 <MAX_SIZE_IN_GB> [SMALL_CLEAN_SIZE_IN_GB]"exit 1fi@@ -13,6 +13,12 @@ if ! [[ -d target ]]; thenfimax_size_gb=$1+small_clean_size_gb=${2:-}++if [[ -n "${small_clean_size_gb}" && ${small_clean_size_gb} -ge ${max_size_gb} ]]; then+ echo "error: small clean threshold (${small_clean_size_gb}gb) must be smaller than max size (${max_size_gb}gb)"+ exit 1+ficurrent_size=$(du -s target | cut -f1)current_size_gb=$(( ${current_size} / 1024 / 1024 ))@@ -23,4 +29,7 @@ if [[ ${current_size_gb} -gt ${max_size_gb} ]]; thenecho "clearing target directory"shopt -s dotglobrm -rf target/*+elif [[ -n "${small_clean_size_gb}" && ${current_size_gb} -gt ${small_clean_size_gb} ]]; then+ echo "running cargo clean --workspace (size above small clean threshold of ${small_clean_size_gb}gb)"+ cargo clean --workspacefidiff --git a/script/clear-target-dir-if-larger-than.ps1 b/script/clear-target-dir-if-larger-than.ps1index c18c308624d..a5a32a03eb7 100644--- a/script/clear-target-dir-if-larger-than.ps1+++ b/script/clear-target-dir-if-larger-than.ps1@@ -1,6 +1,8 @@param ([Parameter(Mandatory = $true)]- [int]$MAX_SIZE_IN_GB+ [int]$MAX_SIZE_IN_GB,+ [Parameter(Mandatory = $false)]+ [int]$SMALL_CLEAN_SIZE_IN_GB = -1)$ErrorActionPreference = "Stop"@@ -12,6 +14,11 @@ if (-Not (Test-Path -Path "target")) {exit 0}+if ($SMALL_CLEAN_SIZE_IN_GB -ge 0 -and $SMALL_CLEAN_SIZE_IN_GB -ge $MAX_SIZE_IN_GB) {+ Write-Host "error: small clean threshold (${SMALL_CLEAN_SIZE_IN_GB}GB) must be smaller than max size (${MAX_SIZE_IN_GB}GB)"+ exit 1+}+$current_size_gb = (Get-ChildItem -Recurse -Force -File -Path "target" | Measure-Object -Property Length -Sum).Sum / 1GBWrite-Host "target directory size: ${current_size_gb}GB. max size: ${MAX_SIZE_IN_GB}GB"@@ -19,4 +26,7 @@ Write-Host "target directory size: ${current_size_gb}GB. max size: ${MAX_SIZE_INif ($current_size_gb -gt $MAX_SIZE_IN_GB) {Write-Host "clearing target directory"Remove-Item -Recurse -Force -Path "target\*" -ErrorAction SilentlyContinue+} elseif ($SMALL_CLEAN_SIZE_IN_GB -ge 0 -and $current_size_gb -gt $SMALL_CLEAN_SIZE_IN_GB) {+ Write-Host "running cargo clean --workspace (size above small clean threshold of ${SMALL_CLEAN_SIZE_IN_GB}GB)"+ cargo clean --workspace}diff --git a/tooling/xtask/src/tasks/workflows/steps.rs b/tooling/xtask/src/tasks/workflows/steps.rsindex 15c2614ada8..81543444ff6 100644--- a/tooling/xtask/src/tasks/workflows/steps.rs+++ b/tooling/xtask/src/tasks/workflows/steps.rs@@ -213,9 +213,9 @@ pub fn cleanup_cargo_config(platform: Platform) -> Step<Run> {pub fn clear_target_dir_if_large(platform: Platform) -> Step<Run> {match platform {- Platform::Windows => named::pwsh("./script/clear-target-dir-if-larger-than.ps1 250"),- Platform::Linux => named::bash("./script/clear-target-dir-if-larger-than 250"),- Platform::Mac => named::bash("./script/clear-target-dir-if-larger-than 300"),+ Platform::Windows => named::pwsh("./script/clear-target-dir-if-larger-than.ps1 350 200"),+ Platform::Linux => named::bash("./script/clear-target-dir-if-larger-than 350 200"),+ Platform::Mac => named::bash("./script/clear-target-dir-if-larger-than 350 200"),}}