Skip to content

Commit

Permalink
ci(cache): add cleanup jobs
Browse files Browse the repository at this point in the history
- we are running out of cache space and the default GitHub eviction
  policy is not ideal
- these jobs should make the caching more optimal for our use-case

Signed-off-by: AtomicFS <vojtech.vesely@9elements.com>
  • Loading branch information
AtomicFS committed Oct 21, 2024
1 parent 52366f7 commit 4ebd4df
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"htmlcov",
"ldflags",
"mypy",
"opengrabeso",
"prettytable",
"stretchr",
"unxz",
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/cache-cleanup-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# Docs: https://github.com/OpenGrabeso/clean-cache
# Keep only most recent cache while working on a branch
name: cache cleanup branch
on:
push:
branches: ['**']

permissions:
actions: write
contents: read
pull-requests: read

jobs:
cache-cleanup-branch:
runs-on: ubuntu-latest
steps:
- uses: opengrabeso/clean-cache@v1
with:
post: true
keep: 1
32 changes: 32 additions & 0 deletions .github/workflows/cache-cleanup-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# Docs: https://github.com/OpenGrabeso/clean-cache
#
# As we are using caches more and more, we are getting over the GitHubs 10 GB limit.
# Unfortunately GitHub does does not have very smart cache eviction policy
# Docs: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
#
# Each pre-compiled coreboot toolchain takes up around 500 MB.
# The most space at the time of writing is taken up by coreboot toolchains. At the time of writing we
# have 7 coreboot versions, each for x86 and arm64, resulting in 7*2*500=7 GB.
# Thankfully the coreboot toolchains are not re-built that often, but they do take almost 1 hour to build - hence
# caching is a good idea.
# To make sure that the toolchains remain available as long as possible, we should start manually cleaning up the
# cache - making the eviction logic smarter.

name: cache cleanup pull request
on:
pull_request:
types:
- closed

permissions:
actions: write
contents: read
pull-requests: read

jobs:
cache-cleanup-pr:
runs-on: ubuntu-latest
steps:
- name: Clean cache for the closed/merged PR
uses: opengrabeso/clean-cache@v1

0 comments on commit 4ebd4df

Please sign in to comment.