mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
support the new shared compilation cache directory
This commit is contained in:
@@ -27,7 +27,9 @@ runs:
|
|||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
uses: actions/cache/restore@v3
|
uses: actions/cache/restore@v3
|
||||||
with:
|
with:
|
||||||
path: '**/.cache'
|
path: |
|
||||||
|
**/.cache
|
||||||
|
~/.codeql/compile-cache
|
||||||
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
|
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
|
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
|
||||||
@@ -37,7 +39,9 @@ runs:
|
|||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: '**/.cache'
|
path: |
|
||||||
|
**/.cache
|
||||||
|
~/.codeql/compile-cache
|
||||||
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
|
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
|
||||||
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
|
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
|
||||||
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
|
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
|
||||||
@@ -66,6 +70,7 @@ runs:
|
|||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const os = require("os");
|
||||||
|
|
||||||
// the first argv is the cache folder to create.
|
// the first argv is the cache folder to create.
|
||||||
const COMBINED_CACHE_DIR = process.env.COMBINED_CACHE_DIR;
|
const COMBINED_CACHE_DIR = process.env.COMBINED_CACHE_DIR;
|
||||||
@@ -105,6 +110,17 @@ runs:
|
|||||||
console.log(`Found .cache dir at ${dir}`);
|
console.log(`Found .cache dir at ${dir}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const globalCacheDir = path.join(os.homedir(), ".codeql", "compile-cache");
|
||||||
|
if (fs.existsSync(globalCacheDir)) {
|
||||||
|
console.log("Found global home dir: " + globalCacheDir);
|
||||||
|
cacheDirs.push(globalCacheDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cacheDirs.length === 0) {
|
||||||
|
console.log("No cache dirs found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// mkdir -p ${COMBINED_CACHE_DIR}
|
// mkdir -p ${COMBINED_CACHE_DIR}
|
||||||
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
|
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user