|
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 | 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 }}- |
|
66 | 70 |
|
67 | 71 | const fs = require("fs"); |
68 | 72 | const path = require("path"); |
| 73 | + const os = require("os"); |
69 | 74 |
|
70 | 75 | // the first argv is the cache folder to create. |
71 | 76 | const COMBINED_CACHE_DIR = process.env.COMBINED_CACHE_DIR; |
@@ -105,6 +110,17 @@ runs: |
105 | 110 | console.log(`Found .cache dir at ${dir}`); |
106 | 111 | } |
107 | 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 | +
|
108 | 124 | // mkdir -p ${COMBINED_CACHE_DIR} |
109 | 125 | fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true }); |
110 | 126 |
|
|
0 commit comments