diff --git a/.github/workflows/__multi-language-autodetect.yml b/.github/workflows/__multi-language-autodetect.yml index ea9704165..4c75f5e5d 100644 --- a/.github/workflows/__multi-language-autodetect.yml +++ b/.github/workflows/__multi-language-autodetect.yml @@ -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 diff --git a/pr-checks/checks/multi-language-autodetect.yml b/pr-checks/checks/multi-language-autodetect.yml index 263dd9bc0..1608fcc6b 100644 --- a/pr-checks/checks/multi-language-autodetect.yml +++ b/pr-checks/checks/multi-language-autodetect.yml @@ -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 diff --git a/pr-checks/sync.ts b/pr-checks/sync.ts index 0ee33e4f2..035f5b34d 100755 --- a/pr-checks/sync.ts +++ b/pr-checks/sync.ts @@ -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> { let matrix: Array> = []; + 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>(); + 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(); + 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; }