Address review: split macOS Swift checks by CodeQL version

Rather than pinning every macOS job to macOS 15, only run the older CodeQL CLI
versions (which need Xcode 16, and so macOS 15) there. Newer versions, which
support Swift 6.2, run on the latest macOS runner with its default Xcode, so we
keep exercising the common latest-CLI-on-latest-runner combination.

To express this, `sync.ts` now supports an optional per-OS-entry
`codeql-versions` filter, used by `multi-language-autodetect` to send old
versions to `macos-15-xlarge` and new versions to `macos-latest-xlarge`.

`swift-custom-build` only runs `linked`/`default`/`nightly`, which all support
Swift 6.2, so it no longer needs the Xcode 16 step or a macOS 15 pin.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Henry Mercer
2026-06-23 16:39:54 +01:00
parent b9c90effa0
commit e054b4b848
5 changed files with 46 additions and 23 deletions

View File

@@ -81,19 +81,19 @@ jobs:
version: stable-v2.23.9
- os: ubuntu-latest
version: stable-v2.24.3
- os: macos-15-xlarge
- os: macos-latest-xlarge
version: stable-v2.24.3
- os: ubuntu-latest
version: default
- os: macos-15-xlarge
- os: macos-latest-xlarge
version: default
- os: ubuntu-latest
version: linked
- os: macos-15-xlarge
- os: macos-latest-xlarge
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: macos-15-xlarge
- os: macos-latest-xlarge
version: nightly-latest
name: Multi-language repository
if: github.triggering_actor != 'dependabot[bot]'
@@ -130,7 +130,8 @@ jobs:
python-version: '3.13'
- name: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
# Only the older CodeQL CLI versions need Xcode 16, and these run on macOS 15.
if: matrix.os == 'macos-15-xlarge'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init

View File

@@ -59,11 +59,11 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-15
- os: macos-latest
version: linked
- os: macos-15
- os: macos-latest
version: default
- os: macos-15
- os: macos-latest
version: nightly-latest
name: Swift analysis using a custom build command
if: github.triggering_actor != 'dependabot[bot]'
@@ -91,9 +91,6 @@ jobs:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init
id: init
with:

View File

@@ -2,11 +2,27 @@ name: "Multi-language repository"
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
operatingSystems:
- ubuntu
# Pin to macOS 15 rather than `macos-latest`: the older CodeQL CLI versions in the
# matrix only support Swift up to 6.1 (Xcode 16), which is not available on macOS 26
# (ships Xcode 26 / Swift 6.2). See https://github.com/actions/runner-images/issues/14167.
# 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.
- os: macos
runner-image: macos-15-xlarge
codeql-versions:
- stable-v2.19.4
- 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
@@ -21,7 +37,8 @@ steps:
python-version: "3.13"
- name: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
# Only the older CodeQL CLI versions need Xcode 16, and these run on macOS 15.
if: matrix.os == 'macos-15-xlarge'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init

View File

@@ -5,19 +5,12 @@ versions:
- default
- nightly-latest
operatingSystems:
# Pin to macOS 15 rather than `macos-latest`: the `linked`/`default` CodeQL CLI versions
# are analysed with Xcode 16, which is not available on macOS 26 (ships Xcode 26 / Swift
# 6.2). See https://github.com/actions/runner-images/issues/14167.
- os: macos
runner-image: macos-15
- macos
installGo: true
installDotNet: true
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps:
- name: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init
id: init
with:

View File

@@ -54,6 +54,12 @@ type OperatingSystem =
os: OperatingSystemIdentifier;
/** 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.
*/
"codeql-versions"?: string[];
};
/**
@@ -379,6 +385,15 @@ function generateJobMatrix(
continue;
}
// If this OS entry restricts itself to specific CodeQL versions, skip other versions.
const entryVersions =
typeof operatingSystemConfig === "string"
? undefined
: operatingSystemConfig["codeql-versions"];
if (entryVersions && !entryVersions.includes(version)) {
continue;
}
const runnerImagesForOs =
typeof operatingSystemConfig === "string" ||
operatingSystemConfig["runner-image"] === undefined