mirror of
https://github.com/github/codeql-action.git
synced 2026-04-27 09:18:47 +00:00
Rename getMemoryFlagValue
This commit is contained in:
@@ -1040,7 +1040,7 @@ const getOverlayDatabaseModeMacro = test.macro({
|
||||
.stub(actionsUtil, "isAnalyzingPullRequest")
|
||||
.returns(setup.isPullRequest);
|
||||
|
||||
sinon.stub(util, "getMemoryFlagValue").returns(setup.memoryFlagValue);
|
||||
sinon.stub(util, "getCodeQLMemoryLimit").returns(setup.memoryFlagValue);
|
||||
|
||||
// Set up CodeQL mock
|
||||
const codeql = mockCodeQLVersion(setup.codeqlVersion);
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ import {
|
||||
cloneObject,
|
||||
isDefined,
|
||||
checkDiskUsage,
|
||||
getMemoryFlagValue,
|
||||
getCodeQLMemoryLimit,
|
||||
} from "./util";
|
||||
|
||||
export * from "./config/db-config";
|
||||
@@ -664,7 +664,7 @@ async function runnerSupportsOverlayAnalysis(
|
||||
return false;
|
||||
}
|
||||
|
||||
const memoryFlagValue = getMemoryFlagValue(ramInput, logger);
|
||||
const memoryFlagValue = getCodeQLMemoryLimit(ramInput, logger);
|
||||
if (memoryFlagValue < OVERLAY_MINIMUM_MEMORY_MB) {
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${OverlayDatabaseMode.None} ` +
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ import {
|
||||
codeQlVersionAtLeast,
|
||||
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
DEFAULT_DEBUG_DATABASE_NAME,
|
||||
getMemoryFlagValue,
|
||||
getCodeQLMemoryLimit,
|
||||
getRequiredEnvParam,
|
||||
getThreadsFlagValue,
|
||||
initializeEnvironment,
|
||||
@@ -538,7 +538,7 @@ async function run() {
|
||||
core.exportVariable(
|
||||
"CODEQL_RAM",
|
||||
process.env["CODEQL_RAM"] ||
|
||||
getMemoryFlagValue(getOptionalInput("ram"), logger).toString(),
|
||||
getCodeQLMemoryLimit(getOptionalInput("ram"), logger).toString(),
|
||||
);
|
||||
core.exportVariable(
|
||||
"CODEQL_THREADS",
|
||||
|
||||
+5
-5
@@ -309,13 +309,13 @@ function getCgroupMemoryLimitBytes(
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the codeql `--ram` flag as configured by the `ram` input.
|
||||
* If no value was specified, the total available memory will be used minus a
|
||||
* Get the maximum amount of memory CodeQL is allowed to use. If no limit has been
|
||||
* configured by the user, then the total available memory will be used minus a
|
||||
* threshold reserved for the OS.
|
||||
*
|
||||
* @returns {number} the amount of RAM to use, in megabytes
|
||||
* @returns {number} the amount of RAM CodeQL is allowed to use, in megabytes
|
||||
*/
|
||||
export function getMemoryFlagValue(
|
||||
export function getCodeQLMemoryLimit(
|
||||
userInput: string | undefined,
|
||||
logger: Logger,
|
||||
): number {
|
||||
@@ -337,7 +337,7 @@ export function getMemoryFlag(
|
||||
userInput: string | undefined,
|
||||
logger: Logger,
|
||||
): string {
|
||||
const megabytes = getMemoryFlagValue(userInput, logger);
|
||||
const megabytes = getCodeQLMemoryLimit(userInput, logger);
|
||||
return `--ram=${megabytes}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user