mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Default macOS PR checks to latest runner, pin only old CLIs to macOS 15
Redesign the per-entry codeql-versions filter so an OS entry without a version list catches all versions not claimed by its siblings. This lets new CodeQL versions flow to macos-latest-xlarge automatically. Move v2.23.9 (which supports Swift 6.2) off the macOS 15 list and simplify the matrix filter logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/__multi-language-autodetect.yml
generated
vendored
2
.github/workflows/__multi-language-autodetect.yml
generated
vendored
@@ -77,7 +77,7 @@ jobs:
|
||||
version: stable-v2.22.4
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.23.9
|
||||
- os: macos-15-xlarge
|
||||
- os: macos-latest-xlarge
|
||||
version: stable-v2.23.9
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.24.3
|
||||
|
||||
@@ -2,16 +2,8 @@ name: "Multi-language repository"
|
||||
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
|
||||
operatingSystems:
|
||||
- ubuntu
|
||||
# Newer CodeQL CLI versions support Swift 6.2, so analyse Swift on the latest macOS runner
|
||||
# (currently macOS 26) with its default Xcode. This exercises the common combination of a
|
||||
# recent CLI on a recent runner.
|
||||
- os: macos
|
||||
runner-image: macos-latest-xlarge
|
||||
codeql-versions:
|
||||
- stable-v2.24.3
|
||||
- default
|
||||
- linked
|
||||
- nightly-latest
|
||||
# Older CodeQL CLI versions only support Swift up to 6.1, which requires Xcode 16. That is
|
||||
# not available on macOS 26, so run these versions on macOS 15 where we select Xcode 16
|
||||
# below. See https://github.com/actions/runner-images/issues/14167.
|
||||
@@ -22,7 +14,6 @@ operatingSystems:
|
||||
- stable-v2.20.7
|
||||
- stable-v2.21.4
|
||||
- stable-v2.22.4
|
||||
- stable-v2.23.9
|
||||
env:
|
||||
CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI: true
|
||||
installGo: true
|
||||
|
||||
@@ -55,9 +55,10 @@ type OperatingSystem =
|
||||
/** Optional runner image label. */
|
||||
"runner-image"?: string;
|
||||
/**
|
||||
* Optional CodeQL versions to run on this entry. If specified, only these versions are
|
||||
* tested on this runner image. This allows running different runner images for different
|
||||
* CodeQL versions of the same OS.
|
||||
* Optional CodeQL versions to run on this entry. If specified, this entry runs only these
|
||||
* versions. A sibling entry for the same OS that omits `codeql-versions` runs all versions
|
||||
* not claimed by any sibling entry. This allows pinning specific CodeQL versions to a
|
||||
* particular runner image while letting the remaining versions default to another.
|
||||
*/
|
||||
"codeql-versions"?: string[];
|
||||
};
|
||||
@@ -358,6 +359,28 @@ function generateJobMatrix(
|
||||
): Array<Record<string, any>> {
|
||||
let matrix: Array<Record<string, any>> = [];
|
||||
|
||||
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];
|
||||
|
||||
// For each OS, collect the CodeQL versions explicitly claimed by entries that specify
|
||||
// `codeql-versions`. A sibling entry for the same OS that omits `codeql-versions` runs all
|
||||
// versions not in this set.
|
||||
const claimedVersionsByOs = new Map<string, Set<string>>();
|
||||
for (const operatingSystemConfig of operatingSystems) {
|
||||
if (typeof operatingSystemConfig === "string") {
|
||||
continue;
|
||||
}
|
||||
const entryVersions = operatingSystemConfig["codeql-versions"];
|
||||
if (!entryVersions) {
|
||||
continue;
|
||||
}
|
||||
const claimed =
|
||||
claimedVersionsByOs.get(operatingSystemConfig.os) ?? new Set<string>();
|
||||
for (const entryVersion of entryVersions) {
|
||||
claimed.add(entryVersion);
|
||||
}
|
||||
claimedVersionsByOs.set(operatingSystemConfig.os, claimed);
|
||||
}
|
||||
|
||||
for (const version of checkSpecification.versions ?? defaultTestVersions) {
|
||||
if (version === "latest") {
|
||||
throw new Error(
|
||||
@@ -370,7 +393,6 @@ function generateJobMatrix(
|
||||
"macos-latest",
|
||||
"windows-latest",
|
||||
];
|
||||
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];
|
||||
|
||||
for (const operatingSystemConfig of operatingSystems) {
|
||||
const operatingSystem =
|
||||
@@ -385,12 +407,16 @@ function generateJobMatrix(
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this OS entry restricts itself to specific CodeQL versions, skip other versions.
|
||||
// An entry that specifies `codeql-versions` runs only those versions. A sibling entry for
|
||||
// the same OS that omits `codeql-versions` runs all versions not claimed by its siblings.
|
||||
const entryVersions =
|
||||
typeof operatingSystemConfig === "string"
|
||||
? undefined
|
||||
: operatingSystemConfig["codeql-versions"];
|
||||
if (entryVersions && !entryVersions.includes(version)) {
|
||||
const runsThisVersion = entryVersions
|
||||
? entryVersions.includes(version)
|
||||
: !claimedVersionsByOs.get(operatingSystem)?.has(version);
|
||||
if (!runsThisVersion) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user