Skip to content

Merge main into releases/v2 #1905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eac8f8c
Update changelog and version after v2.21.8
github-actions[bot] Sep 19, 2023
74e25cd
Update checked-in dependencies
github-actions[bot] Sep 19, 2023
01b8760
Merge pull request #1894 from github/mergeback/v2.21.8-to-main-6a28655e
henrymercer Sep 19, 2023
8e0b1c7
Add `continueOnError: true` for debug artifact upload (#1895)
angelapwen Sep 19, 2023
5897cf7
Update default bundle to codeql-bundle-v2.14.6
github-actions[bot] Sep 20, 2023
59aaff8
Add changelog note
github-actions[bot] Sep 20, 2023
c4c0678
C++: introduce automatic installation of dependencies in the autobuilder
redsun82 Sep 18, 2023
bf21875
C++: simplify `CppDependencyInstallation` interface
redsun82 Sep 20, 2023
765807b
Add `RUNNER_ENVIRONMENT` to the list of known default setup variables
redsun82 Sep 20, 2023
ab81590
Add changelog entry
redsun82 Sep 20, 2023
53bed11
Apply suggestions from code review
redsun82 Sep 21, 2023
c21e1dd
Lint and build
redsun82 Sep 21, 2023
49aaa9a
Merge pull request #1889 from github/redsun82/cpp-autoinstall-depende…
redsun82 Sep 21, 2023
724d643
Bump min. version for evaluator parallelism feature flag
nickrolfe Sep 22, 2023
d0c18ba
Warn when workflow analyzes the same language twice
henrymercer Sep 22, 2023
3078f51
Merge pull request #1900 from github/nickrolfe/fine-grained-version
nickrolfe Sep 22, 2023
431174f
Factor out `groupLanguagesByExtractor`
henrymercer Sep 22, 2023
d1a917f
Test that workflow with two different languages doesn't produce an error
henrymercer Sep 22, 2023
0dfaf4e
Add a changelog note
henrymercer Sep 22, 2023
0de36d4
Merge branch 'main' into henrymercer/check-for-duplicated-languages
henrymercer Sep 22, 2023
650a85e
Merge pull request #1901 from github/henrymercer/check-for-duplicated…
henrymercer Sep 25, 2023
41d2ffa
Enable sub-language file coverage behind a ff
henrymercer Sep 26, 2023
c95737b
Add changelog note
henrymercer Sep 26, 2023
cc65420
Merge branch 'main' into update-bundle/codeql-bundle-v2.14.6
alexet Sep 26, 2023
e548601
Merge pull request #1897 from github/update-bundle/codeql-bundle-v2.14.6
alexet Sep 26, 2023
4818fdd
Merge pull request #1903 from github/henrymercer/sublanguage-file-cov…
henrymercer Sep 26, 2023
27cb1e1
Bump the npm group with 6 updates (#1902)
dependabot[bot] Sep 26, 2023
d8cb5a2
Update changelog for v2.21.9
github-actions[bot] Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
C++: introduce automatic installation of dependencies in the autobuilder
This introduces the possibility to automatically install dependencies
when running the C++ autobuilder on an Ubuntu runner, that will be
available with upcoming version 2.15.0.

An experimental `cpp-autoinstall-dependencies` input is added to the
`autobuild` action. When not set, the default is driven by a feature
flag.
  • Loading branch information
redsun82 committed Sep 20, 2023
commit c4c06786f2124ab40fbb23cd0f91bdb44e1809ab
11 changes: 11 additions & 0 deletions autobuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ inputs:
working directory. If this input is not set, the autobuilder runs with
$GITHUB_WORKSPACE as its working directory.
required: false
cpp-autoinstall-dependencies:
description: >-
Experimental input, the API may change in the future.
Set to true to enable trying to automatically detect and install
dependencies when running the C/C++ autobuilder, set to anything else
to explicitly disable it. This only works when running on Ubuntu and
is automatically disabled otherwise. If this input is not set the
default is currently driven by the cpp_dependency_installation_enabled
feature flag or the CODEQL_CPP_DEPENDENCY_INSTALLATION environment
variable.
required: false
runs:
using: 'node16'
main: '../lib/autobuild-action.js'
64 changes: 64 additions & 0 deletions lib/autobuild.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/autobuild.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/feature-flags.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/feature-flags.js.map

Large diffs are not rendered by default.

58 changes: 56 additions & 2 deletions src/autobuild.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { getCodeQL } from "./codeql";
import * as core from "@actions/core";

import { getOptionalInput, getTemporaryDirectory } from "./actions-util";
import { getGitHubVersion } from "./api-client";
import { CodeQL, getCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import { Language, isTracedLanguage } from "./languages";
import { Feature, Features } from "./feature-flags";
import { isTracedLanguage, Language } from "./languages";
import { Logger } from "./logging";
import { parseRepositoryNwo } from "./repository";
import { codeQlVersionAbove, getRequiredEnvParam } from "./util";

export async function determineAutobuildLanguages(
config: configUtils.Config,
Expand Down Expand Up @@ -91,13 +98,60 @@ export async function determineAutobuildLanguages(
return languages;
}

async function setupCppAutobuild(codeql: CodeQL, logger: Logger) {
const envVar = "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES";
const actionInput = getOptionalInput("cpp-autoinstall-dependencies");
const featureName = "C++ automatic installation of dependencies";
if (actionInput === "true") {
if (!(await codeQlVersionAbove(codeql, "2.15.0"))) {
logger.warning(
`${featureName} was explicitly requested but is only available starting from CodeQL version 2.15.0, disabling it`,
);
core.exportVariable(envVar, "false");
} else {
logger.info(
`${
actionInput === "true" ? "Enabling" : "Disabling"
} ${featureName} explicitly requested`,
);
core.exportVariable(envVar, actionInput);
}
} else if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted") {
logger.info(
`Disabling ${featureName} which is the default for self-hosted runners`,
);
core.exportVariable(envVar, "false");
} else {
const gitHubVersion = await getGitHubVersion();
const repositoryNwo = parseRepositoryNwo(
getRequiredEnvParam("GITHUB_REPOSITORY"),
);
const features = new Features(
gitHubVersion,
repositoryNwo,
getTemporaryDirectory(),
logger,
);
if (await features.getValue(Feature.CppDependencyInstallation, codeql)) {
logger.info(`Enabling ${featureName}`);
core.exportVariable(envVar, "true");
} else {
logger.info(`Disabling ${featureName}`);
core.exportVariable(envVar, "false");
}
}
}

export async function runAutobuild(
language: Language,
config: configUtils.Config,
logger: Logger,
) {
logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = await getCodeQL(config.codeQLCmd);
if (language === Language.cpp) {
await setupCppAutobuild(codeQL, logger);
}
await codeQL.runAutobuild(language);
logger.endGroup();
}
6 changes: 6 additions & 0 deletions src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export enum Feature {
AnalysisSummaryV2Enabled = "analysis_summary_v2_enabled",
CliConfigFileEnabled = "cli_config_file_enabled",
CodeqlJavaLombokEnabled = "codeql_java_lombok_enabled",
CppDependencyInstallation = "cpp_dependency_installation_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
Expand All @@ -74,6 +75,11 @@ export const featureConfig: Record<
minimumVersion: "2.14.0",
defaultValue: false,
},
[Feature.CppDependencyInstallation]: {
envVar: "CODEQL_CPP_DEPENDENCY_INSTALLATION",
minimumVersion: "2.15.0",
defaultValue: false,
},
[Feature.DisableKotlinAnalysisEnabled]: {
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
minimumVersion: undefined,
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy