9
9
outputs :
10
10
cache-dir :
11
11
description : " The directory where the cache was stored"
12
- value : ${{ steps.fill -compilation-dir.outputs.compdir }}
12
+ value : ${{ steps.output -compilation-dir.outputs.compdir }}
13
13
14
14
runs :
15
15
using : composite
27
27
if : ${{ github.event_name == 'pull_request' }}
28
28
uses : actions/cache/restore@v3
29
29
with :
30
- path : ' **/.cache'
30
+ path : |
31
+ **/.cache
32
+ ~/.codeql/compile-cache
31
33
key : codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
32
34
restore-keys : |
33
35
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
@@ -37,12 +39,22 @@ runs:
37
39
if : ${{ github.event_name != 'pull_request' }}
38
40
uses : actions/cache@v3
39
41
with :
40
- path : ' **/.cache'
42
+ path : |
43
+ **/.cache
44
+ ~/.codeql/compile-cache
41
45
key : codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
42
46
restore-keys : | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
43
47
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
44
48
codeql-compile-${{ inputs.key }}-main-
49
+ - name : Output-compilationdir
50
+ id : output-compilation-dir
51
+ shell : bash
52
+ run : |
53
+ echo "compdir=${COMBINED_CACHE_DIR}" >> $GITHUB_OUTPUT
54
+ env :
55
+ COMBINED_CACHE_DIR : ${{ runner.temp }}/compilation-dir
45
56
- name : Fill compilation cache directory
57
+ id : fill-compilation-dir
46
58
uses : actions/github-script@v6
47
59
env :
48
60
COMBINED_CACHE_DIR : ${{ runner.temp }}/compilation-dir
58
70
59
71
const fs = require("fs");
60
72
const path = require("path");
73
+ const os = require("os");
61
74
62
75
// the first argv is the cache folder to create.
63
76
const COMBINED_CACHE_DIR = process.env.COMBINED_CACHE_DIR;
@@ -97,6 +110,17 @@ runs:
97
110
console.log(`Found .cache dir at ${dir}`);
98
111
}
99
112
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
+
100
124
// mkdir -p ${COMBINED_CACHE_DIR}
101
125
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
102
126
0 commit comments