From 4c1004b1ce7e94f71b7ad8330f831f9bec75fd6a Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Fri, 5 Apr 2024 10:26:36 +1100 Subject: [PATCH] Use correct GHA workflow syntax in new cache-clearing action --- .../clear_self_hosted_persistent_caches.yaml | 116 +++++++++--------- .../generate_github_workflows.py | 11 +- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/.github/workflows/clear_self_hosted_persistent_caches.yaml b/.github/workflows/clear_self_hosted_persistent_caches.yaml index 0c494b12251..ecbb9300f82 100644 --- a/.github/workflows/clear_self_hosted_persistent_caches.yaml +++ b/.github/workflows/clear_self_hosted_persistent_caches.yaml @@ -4,64 +4,64 @@ jobs: -- name: clear_linux_arm64 - runs-on: - - self-hosted - - Linux - - ARM64 - steps: - - name: df before - run: df -h - - name: Deleting ~/Library/Caches - run: du -sh ~/Library/Caches || true; rm -rf ~/Library/Caches - - name: Deleting ~/.cache - run: du -sh ~/.cache || true; rm -rf ~/.cache - - name: Deleting ~/.nce - run: du -sh ~/.nce || true; rm -rf ~/.nce - - name: Deleting ~/.rustup - run: du -sh ~/.rustup || true; rm -rf ~/.rustup - - name: Deleting ~/.pex - run: du -sh ~/.pex || true; rm -rf ~/.pex - - name: df after - run: df -h -- name: clear_macos10_15_x86_64 - runs-on: - - self-hosted - - macOS-10.15-X64 - steps: - - name: df before - run: df -h - - name: Deleting ~/Library/Caches - run: du -sh ~/Library/Caches || true; rm -rf ~/Library/Caches - - name: Deleting ~/.cache - run: du -sh ~/.cache || true; rm -rf ~/.cache - - name: Deleting ~/.nce - run: du -sh ~/.nce || true; rm -rf ~/.nce - - name: Deleting ~/.rustup - run: du -sh ~/.rustup || true; rm -rf ~/.rustup - - name: Deleting ~/.pex - run: du -sh ~/.pex || true; rm -rf ~/.pex - - name: df after - run: df -h -- name: clear_macos11_arm64 - runs-on: - - self-hosted - - macOS-11-ARM64 - steps: - - name: df before - run: df -h - - name: Deleting ~/Library/Caches - run: du -sh ~/Library/Caches || true; rm -rf ~/Library/Caches - - name: Deleting ~/.cache - run: du -sh ~/.cache || true; rm -rf ~/.cache - - name: Deleting ~/.nce - run: du -sh ~/.nce || true; rm -rf ~/.nce - - name: Deleting ~/.rustup - run: du -sh ~/.rustup || true; rm -rf ~/.rustup - - name: Deleting ~/.pex - run: du -sh ~/.pex || true; rm -rf ~/.pex - - name: df after - run: df -h + clean_linux_arm64: + runs-on: + - self-hosted + - Linux + - ARM64 + steps: + - name: df before + run: df -h + - name: Deleting ~/Library/Caches + run: du -sh ~/Library/Caches || true; rm -rf ~/Library/Caches + - name: Deleting ~/.cache + run: du -sh ~/.cache || true; rm -rf ~/.cache + - name: Deleting ~/.nce + run: du -sh ~/.nce || true; rm -rf ~/.nce + - name: Deleting ~/.rustup + run: du -sh ~/.rustup || true; rm -rf ~/.rustup + - name: Deleting ~/.pex + run: du -sh ~/.pex || true; rm -rf ~/.pex + - name: df after + run: df -h + clean_macos10_15_x86_64: + runs-on: + - self-hosted + - macOS-10.15-X64 + steps: + - name: df before + run: df -h + - name: Deleting ~/Library/Caches + run: du -sh ~/Library/Caches || true; rm -rf ~/Library/Caches + - name: Deleting ~/.cache + run: du -sh ~/.cache || true; rm -rf ~/.cache + - name: Deleting ~/.nce + run: du -sh ~/.nce || true; rm -rf ~/.nce + - name: Deleting ~/.rustup + run: du -sh ~/.rustup || true; rm -rf ~/.rustup + - name: Deleting ~/.pex + run: du -sh ~/.pex || true; rm -rf ~/.pex + - name: df after + run: df -h + clean_macos11_arm64: + runs-on: + - self-hosted + - macOS-11-ARM64 + steps: + - name: df before + run: df -h + - name: Deleting ~/Library/Caches + run: du -sh ~/Library/Caches || true; rm -rf ~/Library/Caches + - name: Deleting ~/.cache + run: du -sh ~/.cache || true; rm -rf ~/.cache + - name: Deleting ~/.nce + run: du -sh ~/.nce || true; rm -rf ~/.nce + - name: Deleting ~/.rustup + run: du -sh ~/.rustup || true; rm -rf ~/.rustup + - name: Deleting ~/.pex + run: du -sh ~/.pex || true; rm -rf ~/.pex + - name: df after + run: df -h name: Clear persistent caches on long-lived self-hosted runners 'on': workflow_dispatch: {} diff --git a/src/python/pants_release/generate_github_workflows.py b/src/python/pants_release/generate_github_workflows.py index 1b320aa8008..b5865012d96 100644 --- a/src/python/pants_release/generate_github_workflows.py +++ b/src/python/pants_release/generate_github_workflows.py @@ -1570,8 +1570,10 @@ def gen_goals(use_default_version: bool) -> Sequence[object]: return PublicReposOutput(jobs=jobs, inputs=inputs, run_name=run_name) -def clear_self_hosted_persistent_caches_jobs() -> list[dict[str, Any]]: - def make_job(platform: Platform) -> dict[str, Any]: +def clear_self_hosted_persistent_caches_jobs() -> Jobs: + jobs = {} + + for platform in sorted(SELF_HOSTED, key=lambda p: p.value): helper = Helper(platform) clear_steps = [ @@ -1589,8 +1591,7 @@ def make_job(platform: Platform) -> dict[str, Any]: "~/.pex", ] ] - return { - "name": helper.job_name("clear"), + jobs[helper.job_name("clean")] = { "runs-on": helper.runs_on(), "steps": [ {"name": "df before", "run": "df -h"}, @@ -1599,7 +1600,7 @@ def make_job(platform: Platform) -> dict[str, Any]: ], } - return [make_job(platform) for platform in sorted(SELF_HOSTED, key=lambda p: p.value)] + return jobs # ----------------------------------------------------------------------