mirror of
https://github.com/github/codeql-action.git
synced 2026-11-05 04:29:40 +00:00
Only skip Xcode check on self-hosted runners
This commit is contained in:
12
lib/entry-points.js
generated
12
lib/entry-points.js
generated
@@ -193985,12 +193985,6 @@ async function checkRunnerSupportsTracedAnalysis(action, config, codeql) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (isSelfHostedRunner(action.env)) {
|
||||
action.logger.debug(
|
||||
"Skipping traced analysis compatibility checks because we are on a self-hosted runner."
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (config.buildMode !== void 0 && config.buildMode === "none") {
|
||||
action.logger.debug(
|
||||
"Skipping traced analysis compatibility checks because the build mode is 'none'."
|
||||
@@ -194028,6 +194022,12 @@ async function checkRunnerSupportsTracedAnalysis(action, config, codeql) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (isSelfHostedRunner(action.env)) {
|
||||
action.logger.debug(
|
||||
"Skipping traced analysis compatibility check for Xcode because we are on a self-hosted runner."
|
||||
);
|
||||
return;
|
||||
}
|
||||
const xcodeVer = xcodeVersion(action.logger);
|
||||
if (xcodeVer !== void 0 && xcodeVer.major >= UNSUPPORTED_XCODE_FOR_TRACED) {
|
||||
handleUnsupportedVersion(
|
||||
|
||||
@@ -170,38 +170,6 @@ test("checkRunnerSupportsTracedAnalysis doesn't perform checks if FF is not enab
|
||||
]);
|
||||
}));
|
||||
|
||||
test("checkRunnerSupportsTracedAnalysis doesn't perform checks on self-hosted runners", async (t) =>
|
||||
withTmpDir(async (tmpDir) => {
|
||||
const logger = new RecordingLogger();
|
||||
const env = getTestEnv();
|
||||
env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir);
|
||||
env.set(ActionsEnvVars.RUNNER_ENVIRONMENT, "self-hosted");
|
||||
const features = createFeatures([Feature.CheckUnsupportedTracedAnalysis]);
|
||||
|
||||
const codeql = await getCodeQLWithTracedStub(
|
||||
"codeql-for-testing",
|
||||
logger,
|
||||
env,
|
||||
);
|
||||
sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0"));
|
||||
|
||||
await checkRunnerSupportsTracedAnalysis(
|
||||
initAllState({
|
||||
logger,
|
||||
platform: "darwin",
|
||||
osRelease: "unexpected",
|
||||
env,
|
||||
features,
|
||||
}),
|
||||
createTestConfig({ languages: [BuiltInLanguage.go] }),
|
||||
codeql,
|
||||
);
|
||||
|
||||
checkUnexpectedLogMessages(t, logger.messages, [
|
||||
"Unable to parse Darwin kernel version, got: unexpected",
|
||||
]);
|
||||
}));
|
||||
|
||||
test("checkRunnerSupportsTracedAnalysis warns if version string is not a semver", async (t) =>
|
||||
withTmpDir(async (tmpDir) => {
|
||||
const logger = new RecordingLogger();
|
||||
@@ -355,6 +323,38 @@ test.serial(
|
||||
}),
|
||||
);
|
||||
|
||||
test("checkRunnerSupportsTracedAnalysis doesn't perform Xcode check on self-hosted runners", async (t) =>
|
||||
withTmpDir(async (tmpDir) => {
|
||||
const logger = new RecordingLogger();
|
||||
const env = getTestEnv();
|
||||
env.set(ActionsEnvVars.RUNNER_TEMP, tmpDir);
|
||||
env.set(ActionsEnvVars.RUNNER_ENVIRONMENT, "self-hosted");
|
||||
const features = createFeatures([Feature.CheckUnsupportedTracedAnalysis]);
|
||||
|
||||
const codeql = await getCodeQLWithTracedStub(
|
||||
"codeql-for-testing",
|
||||
logger,
|
||||
env,
|
||||
);
|
||||
sinon.stub(codeql, "getVersion").resolves(makeVersionInfo("2.27.0"));
|
||||
|
||||
await checkRunnerSupportsTracedAnalysis(
|
||||
initAllState({
|
||||
logger,
|
||||
platform: "darwin",
|
||||
osRelease: "27.0.0",
|
||||
env,
|
||||
features,
|
||||
}),
|
||||
createTestConfig({ languages: [BuiltInLanguage.go] }),
|
||||
codeql,
|
||||
);
|
||||
|
||||
checkUnexpectedLogMessages(t, logger.messages, [
|
||||
"Skipping traced analysis compatibility check for Xcode because we are on a self-hosted runner.",
|
||||
]);
|
||||
}));
|
||||
|
||||
// `addDiagnostic` changes global state and we must stub it, so this test must be serial.
|
||||
test.serial(
|
||||
"checkRunnerSupportsTracedAnalysis doesn't add a diagnostic if Xcode version is supported",
|
||||
|
||||
@@ -134,15 +134,6 @@ export async function checkRunnerSupportsTracedAnalysis(
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if we are on a self-hosted runner since the current Xcode version detection
|
||||
// is only validated on hosted runners.
|
||||
if (isSelfHostedRunner(action.env)) {
|
||||
action.logger.debug(
|
||||
"Skipping traced analysis compatibility checks because we are on a self-hosted runner.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// `build-mode: none` doesn't use the tracer, so it is always supported.
|
||||
if (config.buildMode !== undefined && config.buildMode === "none") {
|
||||
action.logger.debug(
|
||||
@@ -191,6 +182,15 @@ export async function checkRunnerSupportsTracedAnalysis(
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if we are on a self-hosted runner since the current Xcode version detection
|
||||
// is only validated on hosted runners.
|
||||
if (isSelfHostedRunner(action.env)) {
|
||||
action.logger.debug(
|
||||
"Skipping traced analysis compatibility check for Xcode because we are on a self-hosted runner.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determining whether the Xcode version is supported only makes sense on macOS, so we only do it
|
||||
// after determining that we are running on macOS.
|
||||
const xcodeVer = xcodeVersion(action.logger);
|
||||
|
||||
Reference in New Issue
Block a user