From 8b7fcc0058e570f30bbfe8f7e10fef4965823f09 Mon Sep 17 00:00:00 2001 From: Andrii Tsok Date: Sat, 18 Apr 2026 19:02:29 +0000 Subject: [PATCH] feat(env-setup): add free_disk_space toggle for disk-constrained runners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub-hosted ubuntu runners start with ~14 GB free but ship pre-loaded with Android SDK, .NET, Haskell, and several GB of Docker images that a typical Rust/Nx build never touches. On the mcpg workspace the cold full-rebuild hit disk-full during the build step (tests + llvm-cov instrumentation + sccache staging + 28-crate target/debug + wasm target exceeded the ceiling) even after dropping redundant build targets. Opt-in via `free_disk_space: true` in `.environment.yml`. When set, runs jlumbroso/free-disk-space@v1.3.1 right after the parser — before any install/compile step — with a conservative profile: android: true ~11 GB dotnet: true ~2 GB haskell: true ~5 GB docker-images: true ~3 GB tool-cache: false keep Node/Python/Go pre-installs swap-storage: false keep swap (Rust linker still benefits) large-packages: false slow, marginal gain Expected: ~18–20 GB free after the step vs ~14 GB baseline — more than enough headroom for the mcpg workload. Co-Authored-By: Claude Opus 4.7 (1M context) --- actions/environment-setup/action.yml | 21 +++++++++++++++++++ actions/environment-setup/schema.json | 5 +++++ .../environment-setup/scripts/parse-config.sh | 6 ++++++ 3 files changed, 32 insertions(+) diff --git a/actions/environment-setup/action.yml b/actions/environment-setup/action.yml index 834fecf..d3f3065 100644 --- a/actions/environment-setup/action.yml +++ b/actions/environment-setup/action.yml @@ -185,6 +185,27 @@ runs: CONFIG_FILE: ${{ inputs.config }} run: ${{ github.action_path }}/scripts/parse-config.sh "$CONFIG_FILE" + # ══════════════════════════════════════════════════════════════════════════ + # 🧹 FREE DISK SPACE (optional, Linux only) + # ══════════════════════════════════════════════════════════════════════════ + # Runs before any heavy install/compile steps so they see a fresh ~10–14 GB. + # GitHub-hosted ubuntu runners pre-install Android SDK, .NET, Haskell, large + # Docker images, etc. — none of which we need for a typical Rust/Nx build. + # Gated on `free_disk_space: true` in .environment.yml so the action remains + # opt-in (the cleanup takes ~30–60s and isn't needed for small workloads). + + - name: Free disk space + if: steps.config.outputs.free_disk_space == 'true' && runner.os == 'Linux' + uses: jlumbroso/free-disk-space@v1.3.1 + with: + tool-cache: false # keep actions/cache, Node, Python, Go pre-installs + android: true + dotnet: true + haskell: true + large-packages: false # slow and we don't need most of it gone + swap-storage: false # keep swap — Rust linker still benefits + docker-images: true + # ══════════════════════════════════════════════════════════════════════════ # ✅ VALIDATE CI ENV VARS (cargo-critical) # ══════════════════════════════════════════════════════════════════════════ diff --git a/actions/environment-setup/schema.json b/actions/environment-setup/schema.json index 7f6f195..965e961 100644 --- a/actions/environment-setup/schema.json +++ b/actions/environment-setup/schema.json @@ -173,6 +173,11 @@ ] }, + "free_disk_space": { + "type": "boolean", + "description": "Free ~10–14 GB by purging pre-installed runner images content (Android SDK, .NET, Haskell, Docker images we won't use, etc.) via jlumbroso/free-disk-space. Runs first in the setup flow before any other step. Linux runners only." + }, + "services": { "type": "object", "description": "External daemons installed onto the runner's PATH so tests can spawn them as subprocesses (via Command::new(\"redis-server\") etc.). Each key toggles a specific service binary. Linux runners only for now.", diff --git a/actions/environment-setup/scripts/parse-config.sh b/actions/environment-setup/scripts/parse-config.sh index 9f156ec..cd3e1f3 100755 --- a/actions/environment-setup/scripts/parse-config.sh +++ b/actions/environment-setup/scripts/parse-config.sh @@ -96,6 +96,12 @@ fi out "has_config=true" echo "📖 Parsing $CONFIG_FILE..." +# ------------------------------------------------------------------------------ +# Top-level knob: free disk space +# ------------------------------------------------------------------------------ +FREE_DISK=$(yq_get '.free_disk_space' "false") +out "free_disk_space=$FREE_DISK" + # ------------------------------------------------------------------------------ # Node.js # ------------------------------------------------------------------------------