Skip to content

Commit b4de9cd

Browse files
authored
Merge pull request #4313 from github/henrymercer/runner-image-coverage
Test the runner images in a dedicated `runner-images` PR check
2 parents b2b7b36 + 08643f8 commit b4de9cd

6 files changed

Lines changed: 107 additions & 135 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
paths-ignore:
2+
- lib
3+
- tests
4+
queries:
5+
- uses: security-and-quality
Lines changed: 28 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/codeql.yml‎

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -19,69 +19,16 @@ env:
1919
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
2020

2121
jobs:
22-
# Identify the CodeQL tool versions to use in the analysis job.
23-
check-codeql-versions:
22+
analyze:
2423
if: github.triggering_actor != 'dependabot[bot]'
2524
runs-on: ubuntu-26.04
26-
outputs:
27-
versions: ${{ steps.compare.outputs.versions }}
2825

29-
permissions:
30-
contents: read
31-
# We currently need `security-events: read` to access feature flags.
32-
security-events: read
33-
34-
steps:
35-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36-
- name: Set up default CodeQL bundle
37-
id: setup-default
38-
uses: ./setup-codeql
39-
- name: Set up linked CodeQL bundle
40-
id: setup-linked
41-
uses: ./setup-codeql
42-
with:
43-
tools: linked
44-
- name: Compare default and linked CodeQL bundle versions
45-
id: compare
46-
env:
47-
CODEQL_DEFAULT: ${{ steps.setup-default.outputs.codeql-path }}
48-
CODEQL_LINKED: ${{ steps.setup-linked.outputs.codeql-path }}
49-
run: |
50-
CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)"
51-
CODEQL_VERSION_LINKED="$("$CODEQL_LINKED" version --format terse)"
52-
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
53-
echo "Linked CodeQL bundle version is $CODEQL_VERSION_LINKED"
54-
55-
# If we're running on a pull request, run with both bundles, even if `tools: linked` would
56-
# be the same as `tools: null`. This allows us to make the job for each of the bundles a
57-
# required status check.
58-
#
59-
# If we're running on push or schedule, then we can skip running with `tools: linked` when it would be
60-
# the same as running with `tools: null`.
61-
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$GITHUB_EVENT_NAME" != "merge_group" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LINKED" ]]; then
62-
VERSIONS_JSON='[null]'
63-
else
64-
VERSIONS_JSON='[null, "linked"]'
65-
fi
66-
67-
# Output a JSON-encoded list with the distinct versions to test against.
68-
echo "Suggested matrix config for analysis job: $VERSIONS_JSON"
69-
echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT
70-
71-
analyze-javascript:
72-
if: github.triggering_actor != 'dependabot[bot]'
73-
needs: [check-codeql-versions]
7426
strategy:
7527
fail-fast: false
7628
matrix:
77-
os:
78-
- ubuntu-22.04
79-
- ubuntu-24.04
80-
- windows-2022
81-
- windows-2025
82-
- macos-15-xlarge
83-
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
84-
runs-on: ${{ matrix.os }}
29+
language:
30+
- actions
31+
- javascript
8532

8633
permissions:
8734
contents: read
@@ -94,49 +41,15 @@ jobs:
9441
uses: ./init
9542
id: init
9643
with:
97-
languages: javascript
98-
config-file: ./.github/codeql/codeql-config-javascript.yml
99-
tools: ${{ matrix.tools }}
44+
languages: ${{ matrix.language }}
45+
build-mode: none
46+
config-file: ./.github/codeql/codeql-config-${{ matrix.language }}.yml
10047
# confirm steps.init.outputs.codeql-path points to the codeql binary
10148
- name: Print CodeQL Version
10249
run: >
10350
"$CODEQL" version --format=json
10451
env:
10552
CODEQL: ${{steps.init.outputs.codeql-path}}
106-
- name: Perform CodeQL Analysis
107-
uses: ./analyze
108-
with:
109-
category: "/language:javascript"
110-
upload: ${{ (matrix.os == 'ubuntu-24.04' && !matrix.tools && github.event_name != 'merge_group' && 'always' ) || 'never' }}
111-
112-
analyze-other:
113-
if: github.triggering_actor != 'dependabot[bot]'
114-
runs-on: ubuntu-26.04
115-
116-
strategy:
117-
fail-fast: false
118-
matrix:
119-
include:
120-
- language: actions
121-
122-
permissions:
123-
contents: read
124-
security-events: write
125-
126-
steps:
127-
- name: Checkout
128-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
129-
- name: Initialize CodeQL
130-
uses: ./init
131-
with:
132-
languages: ${{ matrix.language }}
133-
build-mode: none
134-
config: >
135-
paths-ignore:
136-
- lib
137-
- tests
138-
queries:
139-
- uses: security-and-quality
14053
- name: Perform CodeQL Analysis
14154
uses: ./analyze
14255
with:

‎.github/workflows/deflake.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ on:
6060
- "PR Check - Remote config file"
6161
- "PR Check - Resolve environment"
6262
- "PR Check - Ruby analysis"
63+
- "PR Check - Runner images"
6364
- "PR Check - Rust analysis"
6465
- "PR Check - Split workflow"
6566
- "PR Check - Start proxy"

‎pr-checks/checks/linux-arm64.yml‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎pr-checks/checks/runner-images.yml‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Runner images"
2+
description: "An end-to-end integration test checking that CodeQL can analyze interpreted and compiled code on the GitHub-hosted runner images"
3+
# This check runs on each image listed in
4+
# https://github.com/actions/runner-images#available-images, except for:
5+
# - `ubuntu-slim`, which is intended for lightweight jobs rather than builds like this one.
6+
# - `windows-11-arm`, since CodeQL doesn't support Windows on Arm64.
7+
# - `xcode-27`, a preview image that the `unsupported-macos` check runs on.
8+
operatingSystems:
9+
# The Ubuntu 22.04 images have brownouts from 23 March 2027 and are retired on 17 April 2027, so
10+
# remove them before the brownouts start.
11+
# See https://github.com/actions/runner-images/issues/14254.
12+
- os: ubuntu
13+
runner-image: ubuntu-22.04
14+
- os: ubuntu
15+
runner-image: ubuntu-22.04-arm
16+
- os: ubuntu
17+
runner-image: ubuntu-24.04
18+
- os: ubuntu
19+
runner-image: ubuntu-24.04-arm
20+
- os: ubuntu
21+
runner-image: ubuntu-26.04
22+
- os: ubuntu
23+
runner-image: ubuntu-26.04-arm
24+
- os: windows
25+
runner-image: windows-2022
26+
- os: windows
27+
runner-image: windows-2025
28+
# Use larger runners for macOS to keep these jobs off the critical path.
29+
- os: macos
30+
runner-image: macos-15-large
31+
- os: macos
32+
runner-image: macos-15-xlarge
33+
- os: macos
34+
runner-image: macos-26-large
35+
- os: macos
36+
runner-image: macos-26-xlarge
37+
# Other PR checks cover the supported CodeQL versions, so this check only tests the linked version.
38+
# Linux Arm64 bundles are only available for CodeQL 2.27.0 and later, so older stable versions
39+
# can't run on the Arm64 images.
40+
versions:
41+
- linked
42+
installGo: true
43+
installDotNet: true
44+
# The languages to build and analyze. CodeQL only supports Swift on macOS.
45+
env:
46+
LANGUAGES: "cpp,csharp,go,java,javascript,python,ruby${{ startsWith(matrix.os, 'macos') && ',swift' || '' }}"
47+
steps:
48+
- uses: ./../action/init
49+
with:
50+
languages: ${{ env.LANGUAGES }}
51+
tools: ${{ steps.prepare-test.outputs.tools-url }}
52+
- name: Build code
53+
run: ./build.sh
54+
- uses: ./../action/analyze
55+
with:
56+
upload-database: false
57+
- name: Assert databases exist
58+
run: |
59+
cd "$RUNNER_TEMP/codeql_databases"
60+
for lang in ${LANGUAGES//,/ }; do
61+
if [[ ! -d "$lang" ]]; then
62+
echo "Did not find a database for $lang"
63+
exit 1
64+
fi
65+
echo "Found database for $lang"
66+
done

0 commit comments

Comments
 (0)