CI: Trim cache before saving

This commit is contained in:
Thaddeus Crews 2025-03-13 12:29:42 -05:00
parent 701505eb4f
commit de33bd2b7c
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
11 changed files with 71 additions and 63 deletions

View file

@ -897,11 +897,9 @@ def prepare_cache(env) -> None:
# Convert GiB to bytes; treat negative numbers as 0 (unlimited).
cache_limit = max(0, int(cache_limit * 1024 * 1024 * 1024))
if env["verbose"]:
print(
"Current cache limit is {} (used: {})".format(
convert_size(cache_limit) if cache_limit else "",
convert_size(get_size(cache_path)),
)
print_info(
f"Current cache size is {convert_size(get_size(cache_path))}"
+ (f" (limit: {convert_size(cache_limit)})" if cache_limit else "")
)
atexit.register(clean_cache, cache_path, cache_limit, env["verbose"])