Skip to content

Commit 67f4038

Browse files
authored
Merge pull request #3903 from github/henrymercer/macos-larger-runners
PR checks: Run slowest macOS checks on larger runners
2 parents bbef5ff + 931147e commit 67f4038

7 files changed

Lines changed: 55 additions & 21 deletions

File tree

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

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

.github/workflows/__swift-autobuild.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
strategy:
7878
fail-fast: false
7979
matrix:
80-
os: [ubuntu-22.04,ubuntu-24.04,windows-2022,windows-2025,macos-14,macos-15]
80+
os: [ubuntu-22.04,ubuntu-24.04,windows-2022,windows-2025,macos-14-xlarge,macos-15-xlarge]
8181
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
8282
runs-on: ${{ matrix.os }}
8383

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"ava": "npm run transpile && ava --verbose",
1313
"test": "npm run ava -- src/",
1414
"test-debug": "npm run test -- --timeout=20m",
15-
"transpile": "tsc --build --verbose tsconfig.json"
15+
"transpile": "tsc --build --verbose tsconfig.json",
16+
"update-pr-checks": "./pr-checks/sync.sh"
1617
},
1718
"license": "MIT",
1819
"workspaces": [

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ 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-
- macos
5+
- os: macos
6+
runner-image: macos-latest-xlarge
67
env:
78
CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI: true
89
installGo: true

pr-checks/checks/swift-autobuild.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ description: "Tests creation of a Swift database using autobuild"
33
versions:
44
- nightly-latest
55
operatingSystems:
6-
- macos
6+
- os: macos
7+
runner-image: macos-latest-xlarge
78
steps:
89
- uses: ./../action/init
910
id: init

pr-checks/sync.ts

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ interface WorkflowInput {
2828
/** A partial mapping from known input names to input definitions. */
2929
type WorkflowInputs = Partial<Record<KnownInputName, WorkflowInput>>;
3030

31+
/** An operating system identifier. */
32+
type OperatingSystemIdentifier = "ubuntu" | "macos" | "windows";
33+
34+
/**
35+
* Represents an operating system matrix entry for a generated PR check workflow.
36+
*
37+
* Either a string containing the OS identifier or an object containing the OS identifier and an
38+
* optional runner image label.
39+
*/
40+
type OperatingSystem =
41+
| OperatingSystemIdentifier
42+
| {
43+
/** OS identifier. */
44+
os: OperatingSystemIdentifier;
45+
/** Optional runner image label. */
46+
"runner-image"?: string;
47+
};
48+
3149
/**
3250
* Represents PR check specifications.
3351
*/
@@ -36,8 +54,8 @@ interface Specification extends JobSpecification {
3654
inputs?: Record<string, WorkflowInput>;
3755
/** CodeQL bundle versions to test against. Defaults to `DEFAULT_TEST_VERSIONS`. */
3856
versions?: string[];
39-
/** Operating system prefixes used to select runner images (e.g. `["ubuntu", "macos"]`). */
40-
operatingSystems?: string[];
57+
/** Operating system prefixes, either as strings or with explicit runner image labels. */
58+
operatingSystems?: OperatingSystem[];
4159
/** Per-OS version overrides. If specified for an OS, only those versions are tested on that OS. */
4260
osCodeQlVersions?: Record<string, string[]>;
4361
/** Whether to use the all-platform CodeQL bundle. */
@@ -311,20 +329,33 @@ function generateJobMatrix(
311329
);
312330
}
313331

314-
const runnerImages = ["ubuntu-latest", "macos-latest", "windows-latest"];
332+
const defaultRunnerImages = [
333+
"ubuntu-latest",
334+
"macos-latest",
335+
"windows-latest",
336+
];
315337
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];
316338

317-
for (const operatingSystem of operatingSystems) {
339+
for (const operatingSystemConfig of operatingSystems) {
340+
const operatingSystem =
341+
typeof operatingSystemConfig === "string"
342+
? operatingSystemConfig
343+
: operatingSystemConfig.os;
344+
318345
// If osCodeQlVersions is set for this OS, only include the specified CodeQL versions.
319346
const allowedVersions =
320347
checkSpecification.osCodeQlVersions?.[operatingSystem];
321348
if (allowedVersions && !allowedVersions.includes(version)) {
322349
continue;
323350
}
324351

325-
const runnerImagesForOs = runnerImages.filter((image) =>
326-
image.startsWith(operatingSystem),
327-
);
352+
const runnerImagesForOs =
353+
typeof operatingSystemConfig === "string" ||
354+
operatingSystemConfig["runner-image"] === undefined
355+
? defaultRunnerImages.filter((image) =>
356+
image.startsWith(operatingSystem),
357+
)
358+
: [operatingSystemConfig["runner-image"]];
328359

329360
for (const runnerImage of runnerImagesForOs) {
330361
matrix.push({

0 commit comments

Comments
 (0)