Skip to content

Commit 389b7ce

Browse files
committed
support the new shared compilation cache directory
1 parent f6fdf45 commit 389b7ce

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/actions/cache-query-compilation/action.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ runs:
2727
if: ${{ github.event_name == 'pull_request' }}
2828
uses: actions/cache/restore@v3
2929
with:
30-
path: '**/.cache'
30+
path: |
31+
**/.cache
32+
~/.codeql/compile-cache
3133
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
3234
restore-keys: |
3335
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
@@ -37,7 +39,9 @@ runs:
3739
if: ${{ github.event_name != 'pull_request' }}
3840
uses: actions/cache@v3
3941
with:
40-
path: '**/.cache'
42+
path: |
43+
**/.cache
44+
~/.codeql/compile-cache
4145
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
4246
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
4347
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
@@ -66,6 +70,7 @@ runs:
6670
6771
const fs = require("fs");
6872
const path = require("path");
73+
const os = require("os");
6974
7075
// the first argv is the cache folder to create.
7176
const COMBINED_CACHE_DIR = process.env.COMBINED_CACHE_DIR;
@@ -105,6 +110,17 @@ runs:
105110
console.log(`Found .cache dir at ${dir}`);
106111
}
107112
113+
const globalCacheDir = path.join(os.homedir(), ".codeql", "compile-cache");
114+
if (fs.existsSync(globalCacheDir)) {
115+
console.log("Found global home dir: " + globalCacheDir);
116+
cacheDirs.push(globalCacheDir);
117+
}
118+
119+
if (cacheDirs.length === 0) {
120+
console.log("No cache dirs found");
121+
return;
122+
}
123+
108124
// mkdir -p ${COMBINED_CACHE_DIR}
109125
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
110126

0 commit comments

Comments
 (0)