From 31d5a59a13570c6e36d00c1ad28af52df136db7c Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 27 Nov 2026 16:25:00 +0000 Subject: [PATCH 1/6] Move the `runner-images` check to a hand-written workflow Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/__runner-images.yml | 128 -------------------------- .github/workflows/runner-images.yml | 105 +++++++++++++++++++++ pr-checks/checks/runner-images.yml | 66 ------------- pr-checks/deflake.ts | 1 + 4 files changed, 106 insertions(+), 194 deletions(-) delete mode 100644 .github/workflows/__runner-images.yml create mode 100644 .github/workflows/runner-images.yml delete mode 100644 pr-checks/checks/runner-images.yml diff --git a/.github/workflows/__runner-images.yml b/.github/workflows/__runner-images.yml deleted file mode 100644 index 8c7ce02f7c..0000000000 --- a/.github/workflows/__runner-images.yml +++ /dev/null @@ -1,128 +0,0 @@ -# Warning: This file is generated automatically, and should not be modified. -# Instead, please modify the template in the pr-checks directory and run: -# pr-checks/sync.sh -# to regenerate this file. - -name: PR Check - Runner images -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GO111MODULE: auto -on: - push: - branches: - - main - - releases/v* - pull_request: {} - merge_group: - types: - - checks_requested - schedule: - - cron: "0 5 * * *" - workflow_dispatch: - inputs: - dotnet-version: - type: string - description: The version of .NET to install - required: false - default: 9.x - go-version: - type: string - description: The version of Go to install - required: false - default: ">=1.21.0" - workflow_call: - inputs: - dotnet-version: - type: string - description: The version of .NET to install - required: false - default: 9.x - go-version: - type: string - description: The version of Go to install - required: false - default: ">=1.21.0" -defaults: - run: - shell: bash -concurrency: - cancel-in-progress: ${{ github.event_name == 'pull_request' || false }} - group: runner-images-${{github.ref}}-${{inputs.dotnet-version}}-${{inputs.go-version}} -jobs: - runner-images: - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-22.04 - version: linked - - os: ubuntu-22.04-arm - version: linked - - os: ubuntu-24.04 - version: linked - - os: ubuntu-24.04-arm - version: linked - - os: ubuntu-26.04 - version: linked - - os: ubuntu-26.04-arm - version: linked - - os: windows-2022 - version: linked - - os: windows-2025 - version: linked - - os: macos-15-large - version: linked - - os: macos-15-xlarge - version: linked - - os: macos-26-large - version: linked - - os: macos-26-xlarge - version: linked - name: Runner images - if: github.triggering_actor != 'dependabot[bot]' - permissions: - contents: read - security-events: read - timeout-minutes: 45 - runs-on: ${{ matrix.os }} - steps: - - name: Check out repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Install .NET - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 - with: - dotnet-version: ${{ inputs.dotnet-version || '9.x' }} - - name: Install Go - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 - with: - go-version: ${{ inputs.go-version || '>=1.21.0' }} - cache: false - - name: Prepare test - id: prepare-test - uses: ./.github/actions/prepare-test - with: - version: ${{ matrix.version }} - use-all-platform-bundle: "false" - setup-kotlin: "true" - - uses: ./../action/init - with: - languages: ${{ env.LANGUAGES }} - tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Build code - run: ./build.sh - - uses: ./../action/analyze - with: - upload-database: false - - name: Assert databases exist - run: | - cd "$RUNNER_TEMP/codeql_databases" - for lang in ${LANGUAGES//,/ }; do - if [[ ! -d "$lang" ]]; then - echo "Did not find a database for $lang" - exit 1 - fi - echo "Found database for $lang" - done - env: - LANGUAGES: cpp,csharp,go,java,javascript,python,ruby${{ startsWith(matrix.os, 'macos') && ',swift' || '' }} - CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/runner-images.yml b/.github/workflows/runner-images.yml new file mode 100644 index 0000000000..085dd08b2d --- /dev/null +++ b/.github/workflows/runner-images.yml @@ -0,0 +1,105 @@ +# An end-to-end integration test checking that CodeQL can analyze interpreted and compiled code on +# the GitHub-hosted runner images. +name: PR Check - Runner images +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GO111MODULE: auto +on: + push: + branches: + - main + - releases/v* + pull_request: + merge_group: + types: [checks_requested] + schedule: + - cron: "0 5 * * *" + workflow_dispatch: + +concurrency: + cancel-in-progress: ${{ github.event_name == 'pull_request' || false }} + group: ${{ github.workflow }}-${{ github.ref }} + +defaults: + run: + shell: bash + +jobs: + runner-images: + name: Runner images + if: github.triggering_actor != 'dependabot[bot]' + strategy: + fail-fast: false + matrix: + # This check runs on each image listed in + # https://github.com/actions/runner-images#available-images, except for: + # - `ubuntu-slim`, which is intended for lightweight jobs rather than builds like this one. + # - `windows-11-arm`, since CodeQL doesn't support Windows on Arm64. + # - `xcode-27`, a preview image that the `unsupported-macos` check runs on. + os: + # The Ubuntu 22.04 images have brownouts from 23 March 2027 and are retired on 17 April + # 2027, so remove them before the brownouts start. + # See https://github.com/actions/runner-images/issues/14254. + - ubuntu-22.04 + - ubuntu-22.04-arm + - ubuntu-24.04 + - ubuntu-24.04-arm + - ubuntu-26.04 + - ubuntu-26.04-arm + - windows-2022 + - windows-2025 + # Use larger runners for macOS to keep these jobs off the critical path. + - macos-15-large + - macos-15-xlarge + - macos-26-large + - macos-26-xlarge + # Other PR checks cover the supported CodeQL versions, so this check only tests the linked + # version. Linux Arm64 bundles are only available for CodeQL 2.27.0 and later, so older + # stable versions can't run on the Arm64 images. + version: [linked] + permissions: + contents: read + security-events: read + timeout-minutes: 45 + runs-on: ${{ matrix.os }} + env: + # The languages to build and analyze. CodeQL only supports Swift on macOS. + LANGUAGES: "cpp,csharp,go,java,javascript,python,ruby${{ startsWith(matrix.os, 'macos') && ',swift' || '' }}" + CODEQL_ACTION_TEST_MODE: true + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install .NET + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + dotnet-version: 9.x + - name: Install Go + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: ">=1.21.0" + # Don't cache dependencies, so that the autobuilder has to download them. + cache: false + - name: Prepare test + id: prepare-test + uses: ./.github/actions/prepare-test + with: + version: ${{ matrix.version }} + - uses: ./../action/init + with: + languages: ${{ env.LANGUAGES }} + tools: ${{ steps.prepare-test.outputs.tools-url }} + - name: Build code + run: ./build.sh + - uses: ./../action/analyze + with: + upload-database: false + - name: Assert databases exist + run: | + cd "$RUNNER_TEMP/codeql_databases" + for lang in ${LANGUAGES//,/ }; do + if [[ ! -d "$lang" ]]; then + echo "Did not find a database for $lang" + exit 1 + fi + echo "Found database for $lang" + done diff --git a/pr-checks/checks/runner-images.yml b/pr-checks/checks/runner-images.yml deleted file mode 100644 index 70354e9ada..0000000000 --- a/pr-checks/checks/runner-images.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: "Runner images" -description: "An end-to-end integration test checking that CodeQL can analyze interpreted and compiled code on the GitHub-hosted runner images" -# This check runs on each image listed in -# https://github.com/actions/runner-images#available-images, except for: -# - `ubuntu-slim`, which is intended for lightweight jobs rather than builds like this one. -# - `windows-11-arm`, since CodeQL doesn't support Windows on Arm64. -# - `xcode-27`, a preview image that the `unsupported-macos` check runs on. -operatingSystems: - # The Ubuntu 22.04 images have brownouts from 23 March 2027 and are retired on 17 April 2027, so - # remove them before the brownouts start. - # See https://github.com/actions/runner-images/issues/14254. - - os: ubuntu - runner-image: ubuntu-22.04 - - os: ubuntu - runner-image: ubuntu-22.04-arm - - os: ubuntu - runner-image: ubuntu-24.04 - - os: ubuntu - runner-image: ubuntu-24.04-arm - - os: ubuntu - runner-image: ubuntu-26.04 - - os: ubuntu - runner-image: ubuntu-26.04-arm - - os: windows - runner-image: windows-2022 - - os: windows - runner-image: windows-2025 - # Use larger runners for macOS to keep these jobs off the critical path. - - os: macos - runner-image: macos-15-large - - os: macos - runner-image: macos-15-xlarge - - os: macos - runner-image: macos-26-large - - os: macos - runner-image: macos-26-xlarge -# Other PR checks cover the supported CodeQL versions, so this check only tests the linked version. -# Linux Arm64 bundles are only available for CodeQL 2.27.0 and later, so older stable versions -# can't run on the Arm64 images. -versions: - - linked -installGo: true -installDotNet: true -# The languages to build and analyze. CodeQL only supports Swift on macOS. -env: - LANGUAGES: "cpp,csharp,go,java,javascript,python,ruby${{ startsWith(matrix.os, 'macos') && ',swift' || '' }}" -steps: - - uses: ./../action/init - with: - languages: ${{ env.LANGUAGES }} - tools: ${{ steps.prepare-test.outputs.tools-url }} - - name: Build code - run: ./build.sh - - uses: ./../action/analyze - with: - upload-database: false - - name: Assert databases exist - run: | - cd "$RUNNER_TEMP/codeql_databases" - for lang in ${LANGUAGES//,/ }; do - if [[ ! -d "$lang" ]]; then - echo "Did not find a database for $lang" - exit 1 - fi - echo "Found database for $lang" - done diff --git a/pr-checks/deflake.ts b/pr-checks/deflake.ts index a682ae2028..0e0b38bed0 100644 --- a/pr-checks/deflake.ts +++ b/pr-checks/deflake.ts @@ -26,6 +26,7 @@ const NON_GENERATED_WORKFLOWS_TO_RERUN = [ "CodeQL action", "PR Check - Debug artifact upload", "PR Check - Debug artifacts after failure", + "PR Check - Runner images", "PR Checks", "Query filters tests", "Test that the workaround for python 3.12 on windows works", From 02e47096422c177c5f1e40f00d71908105f95937 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 27 Nov 2026 16:25:28 +0000 Subject: [PATCH 2/6] Read the `runner-images` check's images from a file when it runs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/runner-images.yml | 44 ++++++++++++++--------------- pr-checks/runner-images.yml | 30 ++++++++++++++++++++ 2 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 pr-checks/runner-images.yml diff --git a/.github/workflows/runner-images.yml b/.github/workflows/runner-images.yml index 085dd08b2d..aca46494d9 100644 --- a/.github/workflows/runner-images.yml +++ b/.github/workflows/runner-images.yml @@ -25,34 +25,34 @@ defaults: shell: bash jobs: + read-runner-images: + name: Read runner images + if: github.triggering_actor != 'dependabot[bot]' + permissions: + contents: read + timeout-minutes: 5 + # A lightweight runner is enough for this job, and this one has `yq` installed. + runs-on: ubuntu-slim + outputs: + images: ${{ steps.read.outputs.images }} + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Read runner images + id: read + # Assigning the output of `yq` to a variable first makes the step fail if `yq` fails. + run: | + images=$(yq -o=json -I=0 '.images' pr-checks/runner-images.yml) + echo "images=$images" >> "$GITHUB_OUTPUT" + runner-images: name: Runner images if: github.triggering_actor != 'dependabot[bot]' + needs: read-runner-images strategy: fail-fast: false matrix: - # This check runs on each image listed in - # https://github.com/actions/runner-images#available-images, except for: - # - `ubuntu-slim`, which is intended for lightweight jobs rather than builds like this one. - # - `windows-11-arm`, since CodeQL doesn't support Windows on Arm64. - # - `xcode-27`, a preview image that the `unsupported-macos` check runs on. - os: - # The Ubuntu 22.04 images have brownouts from 23 March 2027 and are retired on 17 April - # 2027, so remove them before the brownouts start. - # See https://github.com/actions/runner-images/issues/14254. - - ubuntu-22.04 - - ubuntu-22.04-arm - - ubuntu-24.04 - - ubuntu-24.04-arm - - ubuntu-26.04 - - ubuntu-26.04-arm - - windows-2022 - - windows-2025 - # Use larger runners for macOS to keep these jobs off the critical path. - - macos-15-large - - macos-15-xlarge - - macos-26-large - - macos-26-xlarge + os: ${{ fromJSON(needs.read-runner-images.outputs.images) }} # Other PR checks cover the supported CodeQL versions, so this check only tests the linked # version. Linux Arm64 bundles are only available for CodeQL 2.27.0 and later, so older # stable versions can't run on the Arm64 images. diff --git a/pr-checks/runner-images.yml b/pr-checks/runner-images.yml new file mode 100644 index 0000000000..c7a613ef37 --- /dev/null +++ b/pr-checks/runner-images.yml @@ -0,0 +1,30 @@ +# The GitHub-hosted runner images that the `runner-images` PR check runs on, identified by their +# labels. +# +# The check runs on each image listed in +# https://github.com/actions/runner-images#available-images, apart from the ones under `excluded`. +images: + # The Ubuntu 22.04 images have brownouts from 23 March 2027 and are retired on 17 April 2027, so + # remove them before the brownouts start. + # See https://github.com/actions/runner-images/issues/14254. + - ubuntu-22.04 + - ubuntu-22.04-arm + - ubuntu-24.04 + - ubuntu-24.04-arm + - ubuntu-26.04 + - ubuntu-26.04-arm + - windows-2022 + - windows-2025 + # Use larger runners for macOS to keep these jobs off the critical path. + - macos-15-large + - macos-15-xlarge + - macos-26-large + - macos-26-xlarge +# The images that the check doesn't run on, with the reasons. +excluded: + ubuntu-slim: > + It's intended for lightweight jobs rather than builds like the ones this check runs. + windows-11-arm: > + CodeQL doesn't support Windows on Arm64. + xcode-27: > + It's a preview image that the `unsupported-macos` check runs on. From 8242b9e49db9baa6ef947890adf0c61e9812e107 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 27 Nov 2026 16:26:05 +0000 Subject: [PATCH 3/6] Check the format of `pr-checks/runner-images.yml` Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- package-lock.json | 1 + pr-checks/package.json | 1 + pr-checks/runner-images.schema.json | 22 +++++++++++++++++++ pr-checks/runner-images.test.ts | 34 +++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 pr-checks/runner-images.schema.json create mode 100644 pr-checks/runner-images.test.ts diff --git a/package-lock.json b/package-lock.json index 8fd98030ef..c7ee79f3c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10609,6 +10609,7 @@ }, "devDependencies": { "@types/node": "^24.19.0", + "jsonschema": "^1.5.0", "tsx": "^4.23.15" } }, diff --git a/pr-checks/package.json b/pr-checks/package.json index e18e433d47..4224f2dee5 100644 --- a/pr-checks/package.json +++ b/pr-checks/package.json @@ -22,6 +22,7 @@ }, "devDependencies": { "@types/node": "^24.19.0", + "jsonschema": "^1.5.0", "tsx": "^4.23.15" } } diff --git a/pr-checks/runner-images.schema.json b/pr-checks/runner-images.schema.json new file mode 100644 index 0000000000..d734fd65e5 --- /dev/null +++ b/pr-checks/runner-images.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Runner images", + "description": "The GitHub-hosted runner images that the `runner-images` PR check runs on", + "type": "object", + "properties": { + "images": { + "description": "Labels of the runner images that the check runs on", + "type": "array", + "items": { "type": "string", "minLength": 1 }, + "minItems": 1, + "uniqueItems": true + }, + "excluded": { + "description": "Labels of the runner images that the check doesn't run on, mapped to the reasons", + "type": "object", + "additionalProperties": { "type": "string", "minLength": 1 } + } + }, + "required": ["images"], + "additionalProperties": false +} diff --git a/pr-checks/runner-images.test.ts b/pr-checks/runner-images.test.ts new file mode 100644 index 0000000000..3b23b36d74 --- /dev/null +++ b/pr-checks/runner-images.test.ts @@ -0,0 +1,34 @@ +#!/usr/bin/env npx tsx + +/* +Checks that `runner-images.yml` matches its schema. +*/ + +import * as assert from "node:assert/strict"; +import * as fs from "node:fs"; +import * as path from "node:path"; +import { describe, it } from "node:test"; + +import * as jsonschema from "jsonschema"; +import * as yaml from "yaml"; + +import { PR_CHECKS_DIR } from "./config"; + +describe("runner-images.yml", async () => { + await it("matches runner-images.schema.json", () => { + const contents: unknown = yaml.parse( + fs.readFileSync(path.join(PR_CHECKS_DIR, "runner-images.yml"), "utf8"), + ); + const schema = JSON.parse( + fs.readFileSync( + path.join(PR_CHECKS_DIR, "runner-images.schema.json"), + "utf8", + ), + ) as jsonschema.Schema; + const result = new jsonschema.Validator().validate(contents, schema); + assert.deepEqual( + result.errors.map((error) => error.stack), + [], + ); + }); +}); From 0eabd6e0948f70f859bf43783d7255450ebd5312 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 27 Nov 2026 16:26:11 +0000 Subject: [PATCH 4/6] Note that the `runner-images` check skips retiring images Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- pr-checks/runner-images.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pr-checks/runner-images.yml b/pr-checks/runner-images.yml index c7a613ef37..aed8581b74 100644 --- a/pr-checks/runner-images.yml +++ b/pr-checks/runner-images.yml @@ -2,7 +2,8 @@ # labels. # # The check runs on each image listed in -# https://github.com/actions/runner-images#available-images, apart from the ones under `excluded`. +# https://github.com/actions/runner-images#available-images, apart from the ones under `excluded` +# and any that GitHub is about to retire. images: # The Ubuntu 22.04 images have brownouts from 23 March 2027 and are retired on 17 April 2027, so # remove them before the brownouts start. From 05a3257c4c6ed18328fd18006f01e1e8ffd69c46 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 27 Nov 2026 16:26:18 +0000 Subject: [PATCH 5/6] Update why the `runner-images` check leaves out `xcode-27`, which is now GA Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- pr-checks/runner-images.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pr-checks/runner-images.yml b/pr-checks/runner-images.yml index aed8581b74..c064314c03 100644 --- a/pr-checks/runner-images.yml +++ b/pr-checks/runner-images.yml @@ -28,4 +28,5 @@ excluded: windows-11-arm: > CodeQL doesn't support Windows on Arm64. xcode-27: > - It's a preview image that the `unsupported-macos` check runs on. + CodeQL doesn't support traced analysis on macOS 27 or later, or with Xcode 27 or later. + The `unsupported-macos` check runs on this image instead. From 9898716fb9e60d4acce22ecb6c80431ca72663a6 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 27 Nov 2026 16:26:25 +0000 Subject: [PATCH 6/6] Note that changing the runner images file changes the required checks Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- pr-checks/runner-images.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pr-checks/runner-images.yml b/pr-checks/runner-images.yml index c064314c03..f08b7d3f4e 100644 --- a/pr-checks/runner-images.yml +++ b/pr-checks/runner-images.yml @@ -1,6 +1,10 @@ # The GitHub-hosted runner images that the `runner-images` PR check runs on, identified by their # labels. # +# Each image has a required check. Before merging a PR that adds or removes images, a maintainer +# needs to wait for the PR's checks to finish, then update the required checks by running +# `pr-checks/sync-checks.ts` with `--ref` set to the PR's head commit. +# # The check runs on each image listed in # https://github.com/actions/runner-images#available-images, apart from the ones under `excluded` # and any that GitHub is about to retire.