delete caches if they get too large after a run #560
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
permissions: | |
actions: write | |
checks: write | |
contents: read | |
deployments: read | |
issues: write | |
discussions: write | |
packages: read | |
pages: write | |
pull-requests: write | |
security-events: write | |
statuses: write | |
env: | |
PANTS_CONFIG_FILES: "pants.ci.toml" | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: ["ubuntu-latest"] | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Initialize Pants | |
uses: pantsbuild/actions/init-pants@main | |
with: | |
gha-cache-key: cache0-py${{ matrix.python }} | |
named-caches-hash: ${{ hashFiles('requirements.txt') }} | |
- name: Check BUILD files | |
run: | | |
pants tailor --check update-build-files --check :: | |
- name: Format | |
run: | | |
pants fmt :: | |
- name: Run tests | |
run: | | |
pants test --use-coverage :: | |
delete-cache-if-too-big: | |
name: delete-cache | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Delete cache if too big | |
run: | | |
delete_cache_if_too_big ~/.cache/nce 512 | |
delete_cache_if_too_big ~/.cache/pants/named_caches 1024 |