1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-13 07:13:47 +01:00
This commit is contained in:
J. Nick Koston
2025-10-10 07:33:17 -10:00
parent f89bdeb876
commit 5cb87c5baf
2 changed files with 32 additions and 7 deletions

View File

@@ -435,13 +435,10 @@ jobs:
matrix: matrix:
components: ${{ fromJson(needs.test-build-components-splitter.outputs.matrix) }} components: ${{ fromJson(needs.test-build-components-splitter.outputs.matrix) }}
steps: steps:
- name: Free up disk space - name: Show disk space
run: | run: |
echo "Disk space before cleanup:" echo "Available disk space:"
df -h df -h
echo "Starting background cleanup process..."
python3 -c "import os; os.fork() or os.execvp('sudo', ['sudo', 'rm', '-rf', '/usr/share/dotnet', '/usr/local/lib/android', '/opt/ghc', '/opt/hostedtoolcache/CodeQL'])"
echo "Cleanup running in background, continuing with workflow..."
- name: List components - name: List components
run: echo ${{ matrix.components }} run: echo ${{ matrix.components }}
@@ -462,8 +459,13 @@ jobs:
- name: Validate and compile components with intelligent grouping - name: Validate and compile components with intelligent grouping
run: | run: |
. venv/bin/activate . venv/bin/activate
mkdir -p build_cache # Use /mnt for build files (70GB available vs ~29GB on /)
export PLATFORMIO_BUILD_CACHE_DIR=$PWD/build_cache mkdir -p /mnt/build_cache
export PLATFORMIO_BUILD_CACHE_DIR=/mnt/build_cache
# Also move test_build_components/build to /mnt
mkdir -p /mnt/test_build_components_build
ln -s /mnt/test_build_components_build tests/test_build_components/build
# Convert space-separated components to comma-separated for Python script # Convert space-separated components to comma-separated for Python script
components_csv=$(echo "${{ matrix.components }}" | tr ' ' ',') components_csv=$(echo "${{ matrix.components }}" | tr ' ' ',')

View File

@@ -18,6 +18,7 @@ from __future__ import annotations
import argparse import argparse
from collections import defaultdict from collections import defaultdict
import hashlib import hashlib
import os
from pathlib import Path from pathlib import Path
import subprocess import subprocess
import sys import sys
@@ -38,6 +39,20 @@ from script.analyze_component_buses import (
from script.merge_component_configs import merge_component_configs from script.merge_component_configs import merge_component_configs
def show_disk_space_if_ci(esphome_command: str) -> None:
"""Show disk space usage if running in CI during compile.
Args:
esphome_command: The esphome command being run (config/compile/clean)
"""
if os.environ.get("GITHUB_ACTIONS") and esphome_command == "compile":
print("\n" + "=" * 80)
print("Disk Space After Build:")
print("=" * 80)
subprocess.run(["df", "-h"], check=False)
print("=" * 80 + "\n")
def find_component_tests( def find_component_tests(
components_dir: Path, component_pattern: str = "*" components_dir: Path, component_pattern: str = "*"
) -> dict[str, list[Path]]: ) -> dict[str, list[Path]]:
@@ -200,6 +215,10 @@ def run_esphome_test(
try: try:
result = subprocess.run(cmd, check=False) result = subprocess.run(cmd, check=False)
success = result.returncode == 0 success = result.returncode == 0
# Show disk space after build in CI during compile
show_disk_space_if_ci(esphome_command)
if not success and not continue_on_fail: if not success and not continue_on_fail:
# Print command immediately for failed tests # Print command immediately for failed tests
print(f"\n{'=' * 80}") print(f"\n{'=' * 80}")
@@ -309,6 +328,10 @@ def run_grouped_test(
try: try:
result = subprocess.run(cmd, check=False) result = subprocess.run(cmd, check=False)
success = result.returncode == 0 success = result.returncode == 0
# Show disk space after build in CI during compile
show_disk_space_if_ci(esphome_command)
if not success and not continue_on_fail: if not success and not continue_on_fail:
# Print command immediately for failed tests # Print command immediately for failed tests
print(f"\n{'=' * 80}") print(f"\n{'=' * 80}")