Skip to content

Commit c9d4e1d

Browse files
authored
Merge branch 'main' into mbg/ci/no-more-draft-prs
2 parents 85bb4c6 + ade8366 commit c9d4e1d

9 files changed

Lines changed: 3072 additions & 2469 deletions

File tree

.github/workflows/__multi-language-autodetect.yml

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

.github/workflows/__swift-custom-build.yml

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

lib/entry-points.js

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

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"follow-redirects": "^1.16.0",
3737
"get-folder-size": "^5.0.0",
3838
"https-proxy-agent": "^7.0.6",
39-
"js-yaml": "^4.2.0",
39+
"js-yaml": "^5.0.0",
4040
"jsonschema": "1.5.0",
4141
"long": "^5.3.2",
4242
"node-forge": "^1.4.0",

pr-checks/checks/multi-language-autodetect.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ operatingSystems:
44
- ubuntu
55
- os: macos
66
runner-image: macos-latest-xlarge
7+
# Older CodeQL CLI versions only support Swift up to 6.1, which requires Xcode 16. That is
8+
# not available on macOS 26, so run these versions on macOS 15 where we select Xcode 16
9+
# below. See https://github.com/actions/runner-images/issues/14167.
10+
- os: macos
11+
runner-image: macos-15-xlarge
12+
codeql-versions:
13+
- stable-v2.19.4
14+
- stable-v2.20.7
15+
- stable-v2.21.4
16+
- stable-v2.22.4
717
env:
818
CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI: true
919
installGo: true
@@ -18,7 +28,8 @@ steps:
1828
python-version: "3.13"
1929

2030
- name: Use Xcode 16
21-
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
31+
# Only the older CodeQL CLI versions need Xcode 16, and these run on macOS 15.
32+
if: matrix.os == 'macos-15-xlarge'
2233
run: sudo xcode-select -s "/Applications/Xcode_16.app"
2334

2435
- uses: ./../action/init

pr-checks/checks/swift-custom-build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ installDotNet: true
1111
env:
1212
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
1313
steps:
14-
- name: Use Xcode 16
15-
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
16-
run: sudo xcode-select -s "/Applications/Xcode_16.app"
1714
- uses: ./../action/init
1815
id: init
1916
with:

pr-checks/sync.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ type OperatingSystem =
5454
os: OperatingSystemIdentifier;
5555
/** Optional runner image label. */
5656
"runner-image"?: string;
57+
/**
58+
* Optional CodeQL versions to run on this entry. If specified, this entry runs only these
59+
* versions. A sibling entry for the same OS that omits `codeql-versions` runs all versions
60+
* not claimed by any sibling entry. This allows pinning specific CodeQL versions to a
61+
* particular runner image while letting the remaining versions default to another.
62+
*/
63+
"codeql-versions"?: string[];
5764
};
5865

5966
/**
@@ -352,6 +359,28 @@ function generateJobMatrix(
352359
): Array<Record<string, any>> {
353360
let matrix: Array<Record<string, any>> = [];
354361

362+
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];
363+
364+
// For each OS, collect the CodeQL versions explicitly claimed by entries that specify
365+
// `codeql-versions`. A sibling entry for the same OS that omits `codeql-versions` runs all
366+
// versions not in this set.
367+
const claimedVersionsByOs = new Map<string, Set<string>>();
368+
for (const operatingSystemConfig of operatingSystems) {
369+
if (typeof operatingSystemConfig === "string") {
370+
continue;
371+
}
372+
const entryVersions = operatingSystemConfig["codeql-versions"];
373+
if (!entryVersions) {
374+
continue;
375+
}
376+
const claimed =
377+
claimedVersionsByOs.get(operatingSystemConfig.os) ?? new Set<string>();
378+
for (const entryVersion of entryVersions) {
379+
claimed.add(entryVersion);
380+
}
381+
claimedVersionsByOs.set(operatingSystemConfig.os, claimed);
382+
}
383+
355384
for (const version of checkSpecification.versions ?? defaultTestVersions) {
356385
if (version === "latest") {
357386
throw new Error(
@@ -364,7 +393,6 @@ function generateJobMatrix(
364393
"macos-latest",
365394
"windows-latest",
366395
];
367-
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];
368396

369397
for (const operatingSystemConfig of operatingSystems) {
370398
const operatingSystem =
@@ -379,6 +407,19 @@ function generateJobMatrix(
379407
continue;
380408
}
381409

410+
// An entry that specifies `codeql-versions` runs only those versions. A sibling entry for
411+
// the same OS that omits `codeql-versions` runs all versions not claimed by its siblings.
412+
const entryVersions =
413+
typeof operatingSystemConfig === "string"
414+
? undefined
415+
: operatingSystemConfig["codeql-versions"];
416+
const runsThisVersion = entryVersions
417+
? entryVersions.includes(version)
418+
: !claimedVersionsByOs.get(operatingSystem)?.has(version);
419+
if (!runsThisVersion) {
420+
continue;
421+
}
422+
382423
const runnerImagesForOs =
383424
typeof operatingSystemConfig === "string" ||
384425
operatingSystemConfig["runner-image"] === undefined

src/analyze.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ extensions:
281281
.join(checkoutPath, range.path)
282282
.replaceAll(path.sep, "/");
283283

284-
// Using yaml.dump() with `forceQuotes: true` ensures that all special
284+
// Using yaml.dump() with `quoteStyle: "double"` ensures that all special
285285
// characters are escaped, and that the path is always rendered as a
286286
// quoted string on a single line.
287287
return (
288-
` - [${yaml.dump(filename, { forceQuotes: true }).trim()}, ` +
288+
` - [${yaml.dump(filename, { quoteStyle: "single" }).trim()}, ` +
289289
`${range.startLine}, ${range.endLine}]\n`
290290
);
291291
})

0 commit comments

Comments
 (0)