Skip to content

Commit 45d4318

Browse files
authored
Merge pull request github#11272 from erik-krogh/clean-cache
CI: clean up the cache when compiling on main
2 parents ba894e2 + e4b0d8d commit 45d4318

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/compile-queries.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,16 @@ jobs:
5656
# do full compile if running on main - this populates the cache
5757
if : ${{ github.event_name != 'pull_request' }}
5858
shell: bash
59-
run: codeql query compile -j0 */ql/src --keep-going --warnings=error
59+
run: |
60+
# Move all the existing cache into another folder, so we only preserve the cache for the current queries.
61+
mkdir -p ${COMBINED_CACHE_DIR}
62+
rm */ql/src/.cache/{lock,size}
63+
# copy the contents of the .cache folders into the combined cache folder.
64+
cp -r */ql/src/.cache/* ${COMBINED_CACHE_DIR}/
65+
# clean up the .cache folders
66+
rm -rf */ql/src/.cache/*
67+
68+
# compile the queries
69+
codeql query compile -j0 */ql/src --keep-going --warnings=error --compilation-cache ${COMBINED_CACHE_DIR}
70+
env:
71+
COMBINED_CACHE_DIR: ${{ github.workspace }}/compilation-dir

0 commit comments

Comments
 (0)