Skip to content

Commit e8e83c3

Browse files
authored
Merge branch 'main' into henrymercer/enable-features-on-ghes
2 parents 25a3829 + c7abe9c commit e8e83c3

File tree

8 files changed

+107
-25
lines changed

8 files changed

+107
-25
lines changed

.github/workflows/rebuild.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Rebuild Action
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
rebuild:
9+
name: Rebuild Action
10+
runs-on: ubuntu-latest
11+
if: github.event.label.name == 'Rebuild'
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Remove label
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PR_NUMBER: ${{ github.event.pull_request.number }}
21+
run: |
22+
gh pr edit --repo github/codeql-action "$PR_NUMBER" \
23+
--remove-label "Rebuild"
24+
25+
- name: Compile TypeScript
26+
run: |
27+
npm install
28+
npm run lint -- --fix
29+
npm run build
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: 3.11
35+
36+
- name: Generate workflows
37+
run: |
38+
cd pr-checks
39+
python -m pip install --upgrade pip
40+
pip install ruamel.yaml==0.17.31
41+
python3 sync.py
42+
43+
- name: Check for changes and push
44+
env:
45+
BRANCH: ${{ github.event.pull_request.head.ref }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
PR_NUMBER: ${{ github.event.pull_request.number }}
48+
run: |
49+
if [ ! -z "$(git status --porcelain)" ]; then
50+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
51+
git config --global user.name "github-actions[bot]"
52+
git commit -am "Rebuild"
53+
git push origin "HEAD:$BRANCH"
54+
echo "Pushed a commit to rebuild the Action." \
55+
"Please mark the PR as ready for review to trigger PR checks." |
56+
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER"
57+
gh pr ready --undo --repo github/codeql-action "$PR_NUMBER"
58+
fi

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: compile-ts
5+
name: Compile typescript
6+
files: \.[tj]s$
7+
language: system
8+
entry: npm run build
9+
pass_filenames: false
10+
- id: lint-ts
11+
name: Lint typescript code
12+
files: \.ts$
13+
language: system
14+
entry: npm run lint -- --fix
15+
- id: pr-checks-sync
16+
name: Synchronize PR check workflows
17+
files: ^.github/workflows/__.*\.yml$|^pr-checks
18+
language: system
19+
entry: python3 pr-checks/sync.py
20+
pass_filenames: false

lib/codeql.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/sync.py

100644100755
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#!/usr/bin/env python
2+
13
import ruamel.yaml
24
from ruamel.yaml.scalarstring import FoldedScalarString
3-
import os
5+
import pathlib
46
import textwrap
57

68
# The default set of CodeQL Bundle versions to use for the PR checks.
@@ -47,9 +49,11 @@ def writeHeader(checkStream):
4749
yaml = ruamel.yaml.YAML()
4850
yaml.Representer = NonAliasingRTRepresenter
4951

52+
this_dir = pathlib.Path(__file__).resolve().parent
53+
5054
allJobs = {}
51-
for file in os.listdir('checks'):
52-
with open(f"checks/{file}", 'r') as checkStream:
55+
for file in (this_dir / 'checks').glob('*.yml'):
56+
with open(file, 'r') as checkStream:
5357
checkSpecification = yaml.load(checkStream)
5458

5559
matrix = []
@@ -126,9 +130,9 @@ def writeHeader(checkStream):
126130
checkJob['env'] = checkJob.get('env', {})
127131
if 'CODEQL_ACTION_TEST_MODE' not in checkJob['env']:
128132
checkJob['env']['CODEQL_ACTION_TEST_MODE'] = True
129-
checkName = file[:len(file) - 4]
133+
checkName = file.stem
130134

131-
with open(f"../.github/workflows/__{checkName}.yml", 'w') as output_stream:
135+
with open(this_dir.parent / ".github" / "workflows" / f"__{checkName}.yml", 'w') as output_stream:
132136
writeHeader(output_stream)
133137
yaml.dump({
134138
'name': f"PR Check - {checkSpecification['name']}",

src/codeql.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import * as api from "./api-client";
1515
import type { Config } from "./config-utils";
1616
import { EnvVar } from "./environment";
1717
import {
18-
CODEQL_VERSION_INTRA_LAYER_PARALLELISM,
18+
CODEQL_VERSION_FINE_GRAINED_PARALLELISM,
1919
CodeQLDefaultVersionInfo,
2020
Feature,
2121
FeatureEnablement,
@@ -858,15 +858,15 @@ export async function getCodeQLForCmd(
858858
}
859859
if (
860860
await features.getValue(
861-
Feature.EvaluatorIntraLayerParallelismEnabled,
861+
Feature.EvaluatorFineGrainedParallelismEnabled,
862862
this,
863863
)
864864
) {
865865
codeqlArgs.push("--intra-layer-parallelism");
866866
} else if (
867867
await util.codeQlVersionAbove(
868868
this,
869-
CODEQL_VERSION_INTRA_LAYER_PARALLELISM,
869+
CODEQL_VERSION_FINE_GRAINED_PARALLELISM,
870870
)
871871
) {
872872
codeqlArgs.push("--no-intra-layer-parallelism");

src/feature-flags.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
1919
export const CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
2020

2121
/**
22-
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options, but we
23-
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
22+
* Evaluator fine-grained parallelism (aka intra-layer parallelism) is only safe to enable in 2.15.1 onwards.
23+
* (Some earlier versions recognize the command-line flag, but they contain a bug which makes it unsafe to use).
2424
*/
25-
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
25+
export const CODEQL_VERSION_FINE_GRAINED_PARALLELISM = "2.15.1";
2626

2727
export interface CodeQLDefaultVersionInfo {
2828
cliVersion: string;
@@ -49,7 +49,7 @@ export enum Feature {
4949
CppDependencyInstallation = "cpp_dependency_installation_enabled",
5050
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
5151
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
52-
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
52+
EvaluatorFineGrainedParallelismEnabled = "evaluator_fine_grained_parallelism_enabled",
5353
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
5454
QaTelemetryEnabled = "qa_telemetry_enabled",
5555
}
@@ -78,9 +78,9 @@ export const featureConfig: Record<
7878
minimumVersion: "2.11.6",
7979
defaultValue: true,
8080
},
81-
[Feature.EvaluatorIntraLayerParallelismEnabled]: {
82-
envVar: "CODEQL_EVALUATOR_INTRA_LAYER_PARALLELISM",
83-
minimumVersion: CODEQL_VERSION_INTRA_LAYER_PARALLELISM,
81+
[Feature.EvaluatorFineGrainedParallelismEnabled]: {
82+
envVar: "CODEQL_EVALUATOR_FINE_GRAINED_PARALLELISM",
83+
minimumVersion: CODEQL_VERSION_FINE_GRAINED_PARALLELISM,
8484
defaultValue: false,
8585
},
8686
[Feature.ExportDiagnosticsEnabled]: {

0 commit comments

Comments
 (0)