Skip to content

Commit e054b4b

Browse files
henrymercerCopilot
andcommitted
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>
1 parent b9c90ef commit e054b4b

5 files changed

Lines changed: 46 additions & 23 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: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@ name: "Multi-language repository"
22
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
33
operatingSystems:
44
- ubuntu
5-
# Pin to macOS 15 rather than `macos-latest`: the older CodeQL CLI versions in the
6-
# matrix only support Swift up to 6.1 (Xcode 16), which is not available on macOS 26
7-
# (ships Xcode 26 / Swift 6.2). See https://github.com/actions/runner-images/issues/14167.
5+
# Newer CodeQL CLI versions support Swift 6.2, so analyse Swift on the latest macOS runner
6+
# (currently macOS 26) with its default Xcode. This exercises the common combination of a
7+
# recent CLI on a recent runner.
8+
- os: macos
9+
runner-image: macos-latest-xlarge
10+
codeql-versions:
11+
- stable-v2.24.3
12+
- default
13+
- linked
14+
- nightly-latest
15+
# Older CodeQL CLI versions only support Swift up to 6.1, which requires Xcode 16. That is
16+
# not available on macOS 26, so run these versions on macOS 15 where we select Xcode 16
17+
# below. See https://github.com/actions/runner-images/issues/14167.
818
- os: macos
919
runner-image: macos-15-xlarge
20+
codeql-versions:
21+
- stable-v2.19.4
22+
- stable-v2.20.7
23+
- stable-v2.21.4
24+
- stable-v2.22.4
25+
- stable-v2.23.9
1026
env:
1127
CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI: true
1228
installGo: true
@@ -21,7 +37,8 @@ steps:
2137
python-version: "3.13"
2238

2339
- name: Use Xcode 16
24-
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
40+
# Only the older CodeQL CLI versions need Xcode 16, and these run on macOS 15.
41+
if: matrix.os == 'macos-15-xlarge'
2542
run: sudo xcode-select -s "/Applications/Xcode_16.app"
2643

2744
- uses: ./../action/init

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@ versions:
55
- default
66
- nightly-latest
77
operatingSystems:
8-
# Pin to macOS 15 rather than `macos-latest`: the `linked`/`default` CodeQL CLI versions
9-
# are analysed with Xcode 16, which is not available on macOS 26 (ships Xcode 26 / Swift
10-
# 6.2). See https://github.com/actions/runner-images/issues/14167.
11-
- os: macos
12-
runner-image: macos-15
8+
- macos
139
installGo: true
1410
installDotNet: true
1511
env:
1612
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
1713
steps:
18-
- name: Use Xcode 16
19-
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
20-
run: sudo xcode-select -s "/Applications/Xcode_16.app"
2114
- uses: ./../action/init
2215
id: init
2316
with:

‎pr-checks/sync.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ 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, only these versions are
59+
* tested on this runner image. This allows running different runner images for different
60+
* CodeQL versions of the same OS.
61+
*/
62+
"codeql-versions"?: string[];
5763
};
5864

5965
/**
@@ -379,6 +385,15 @@ function generateJobMatrix(
379385
continue;
380386
}
381387

388+
// If this OS entry restricts itself to specific CodeQL versions, skip other versions.
389+
const entryVersions =
390+
typeof operatingSystemConfig === "string"
391+
? undefined
392+
: operatingSystemConfig["codeql-versions"];
393+
if (entryVersions && !entryVersions.includes(version)) {
394+
continue;
395+
}
396+
382397
const runnerImagesForOs =
383398
typeof operatingSystemConfig === "string" ||
384399
operatingSystemConfig["runner-image"] === undefined

0 commit comments

Comments
 (0)