Skip to content

Commit 7d973c6

Browse files
committed
add cache cleanup workflow and recompress
- .github/workflows/cmake.yml: recompress cache before sending. - this may or may not help since zstd is already used by the cache action. - .github/workflows/cleanup-caches.yml: add from documentation to cleanup 100 caches on PR close. Signed-off-by: Aiden Woodruff <[email protected]>
1 parent 65052ba commit 7d973c6

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Cleanup caches on closed PRs
2+
# From https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
3+
on:
4+
pull_request:
5+
types: [ closed ]
6+
jobs:
7+
cleanup:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
actions: write
11+
steps:
12+
- name: Cleanup
13+
run: |
14+
echo "Fetching list of cache keys"
15+
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
16+
17+
## Setting this to not fail the workflow while deleting cache keys.
18+
set +e
19+
echo "Deleting caches..."
20+
for cacheKey in $cacheKeysForPR
21+
do
22+
gh cache delete $cacheKey
23+
done
24+
echo "Done"
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
GH_REPO: ${{ github.repository }}
28+
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge

.github/workflows/cmake.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,8 @@ jobs:
125125
ctest --test-dir ${{github.workspace}}/example/mpi-nompi/build
126126
--output-on-failure
127127
128-
- name: CCache statistics
129-
run: ccache -sv
128+
- name: CCache statistics and recompression
129+
run: |
130+
ccache -sv
131+
CCACHE_COMPRESSLEVEL=5 ccache -X
132+

0 commit comments

Comments
 (0)