Skip to content

Commit

Permalink
Improve cache-clean action, remove cache-rebuild
Browse files Browse the repository at this point in the history
Select level of cleaning required
Rebuild happens in due course, no need for a specific action.
  • Loading branch information
mikee47 committed Jul 15, 2024
1 parent 25be61b commit 89b0806
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 102 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/cache-clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ name: Cache clean

on:
workflow_dispatch:
inputs:
clean_opt:
description: 'Level of cleaning required'
type: choice
default: push-requests
options:
- pull-requests
- ccache
- idf-tools
- ccache+idf

jobs:
cleanup:
Expand All @@ -12,7 +22,26 @@ jobs:
gh extension install actions/gh-actions-cache
echo "Fetching list of cache keys"
cacheKeys=$(gh actions-cache list -R $REPO -L 100 | grep -v develop | cut -f 1 )
case $CLEAN_OPT in
pull-requests)
filter="-v develop"
;;
ccache)
filter="ccache"
;;
idf-tools)
filter="idf"
;;
ccache+idf)
filter="ccache\|idf"
;;
*)
echo "Unknown option '$CLEAN_OPT'"
exit 1
;;
esac
cacheKeys=$(gh actions-cache list -R $REPO -L 100 | grep $filter | cut -f 1 )
echo "Deleting caches..."
set +e
Expand All @@ -23,3 +52,4 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
CLEAN_OPT: ${{ inputs.clean_opt }}
97 changes: 0 additions & 97 deletions .github/workflows/cache-rebuild.yml

This file was deleted.

28 changes: 24 additions & 4 deletions Tools/ci/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,31 @@ Github actions
See ``.github/workflows``.

Cache clean
Dispatch workflow to remove caches for pull requests, but leave those for the default (develop) branch intact.
Dispatch workflow as convenient way to clean action cache. Cleaning levels are:

- pull-requests
Any items created by pull requests, excludes anything in develop branch.
Normally pull requests will make use of caches present in the develop branch, but if there isn't one it will create its own. This becomes redundant when merged to develop.

Such caches should be expired automatically, but this option can be used to remove them.

- ccache
All ccache items. Use if pull requests are taking too long to build.

- idf-tools
All IDF tool. Use before merging to develop if IDF toolchains have been updated.

- ccache+idf
All ccache and IDF tool caches.

Note that cleaning can always be done locally using ``gh``::

gh cache list # For fork
gh cache list -R SmingHub/Sming
gh cache delete --all -R SmingHub/Sming

etc.

Cache rebuild
Dispatch workflow to rebuild the esp32 idf/tool caches.
By default, cleans only idf/esp32 caches but has option to perform full clean.

CodeQL
Performs code quality analysis when develop branch is updated.
Expand Down

0 comments on commit 89b0806

Please sign in to comment.