Compare commits

..

4 Commits

Author SHA1 Message Date
Henry Mercer
592d162ba3 Merge pull request #4312 from github/henrymercer/all-platform-bundle-checks
Make the "All-platform bundle" PR check use the all-platform bundle
2026-11-10 18:07:39 +00:00
Henry Mercer
4e3aa4135f Remove the CodeQL Bundle All PR check, which duplicates all-platform-bundle
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-09 17:13:44 +00:00
Henry Mercer
91bae3ac68 Check that the all-platform-bundle PR check uses an all-platform bundle
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-09 17:13:32 +00:00
Henry Mercer
cfb3940966 Respect use-all-platform-bundle for the latest nightly in prepare-test
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-09 17:13:08 +00:00
10 changed files with 167 additions and 171 deletions

View File

@@ -36,7 +36,14 @@ runs:
set -e # Fail this Action if `gh release list` fails.
if [[ "$VERSION" == "nightly" || "$VERSION" == "nightly-latest" ]]; then
echo "tools-url=nightly" >> "$GITHUB_OUTPUT"
if [[ "$USE_ALL_PLATFORM_BUNDLE" == "true" ]]; then
# With `tools: nightly`, the Action downloads the bundle for the runner's platform, so look
# up the latest nightly release here to get its all-platform bundle instead.
tag=$(gh release list --repo dsp-testing/codeql-cli-nightlies --limit 1 --json tagName --jq '.[0].tagName')
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/codeql-bundle.tar.gz" >> "$GITHUB_OUTPUT"
else
echo "tools-url=nightly" >> "$GITHUB_OUTPUT"
fi
exit 0
elif [[ "$VERSION" == "linked" ]]; then
echo "tools-url=linked" >> "$GITHUB_OUTPUT"

View File

@@ -1,5 +0,0 @@
paths-ignore:
- lib
- tests
queries:
- uses: security-and-quality

View File

@@ -92,6 +92,18 @@ jobs:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check that the bundle contains tools for all platforms
env:
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
run: |
# Platform-specific bundles only contain the tools for their own platform.
tools_dir="$(dirname "$CODEQL_PATH")/tools"
for platform in linux64 osx64 win64; do
if [[ ! -d "$tools_dir/$platform" ]]; then
echo "::error::Expected an all-platform CodeQL bundle, but '$tools_dir' does not contain a '$platform' directory."
exit 1
fi
done
- name: Build code
run: ./build.sh
- uses: ./../action/analyze

View File

@@ -3,7 +3,7 @@
# pr-checks/sync.sh
# to regenerate this file.
name: PR Check - Runner images
name: PR Check - Linux Arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
@@ -47,38 +47,16 @@ defaults:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' || false }}
group: runner-images-${{github.ref}}-${{inputs.dotnet-version}}-${{inputs.go-version}}
group: linux-arm64-${{github.ref}}-${{inputs.dotnet-version}}-${{inputs.go-version}}
jobs:
runner-images:
linux-arm64:
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
version: nightly-latest
name: Linux Arm64
if: github.triggering_actor != 'dependabot[bot]'
permissions:
contents: read
@@ -124,5 +102,5 @@ jobs:
echo "Found database for $lang"
done
env:
LANGUAGES: cpp,csharp,go,java,javascript,python,ruby${{ startsWith(matrix.os, 'macos') && ',swift' || '' }}
LANGUAGES: cpp,csharp,go,java,javascript,python,ruby
CODEQL_ACTION_TEST_MODE: true

View File

@@ -19,16 +19,69 @@ env:
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
jobs:
analyze:
# Identify the CodeQL tool versions to use in the analysis job.
check-codeql-versions:
if: github.triggering_actor != 'dependabot[bot]'
runs-on: ubuntu-26.04
outputs:
versions: ${{ steps.compare.outputs.versions }}
permissions:
contents: read
# We currently need `security-events: read` to access feature flags.
security-events: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up default CodeQL bundle
id: setup-default
uses: ./setup-codeql
- name: Set up linked CodeQL bundle
id: setup-linked
uses: ./setup-codeql
with:
tools: linked
- name: Compare default and linked CodeQL bundle versions
id: compare
env:
CODEQL_DEFAULT: ${{ steps.setup-default.outputs.codeql-path }}
CODEQL_LINKED: ${{ steps.setup-linked.outputs.codeql-path }}
run: |
CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)"
CODEQL_VERSION_LINKED="$("$CODEQL_LINKED" version --format terse)"
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
echo "Linked CodeQL bundle version is $CODEQL_VERSION_LINKED"
# If we're running on a pull request, run with both bundles, even if `tools: linked` would
# be the same as `tools: null`. This allows us to make the job for each of the bundles a
# required status check.
#
# If we're running on push or schedule, then we can skip running with `tools: linked` when it would be
# the same as running with `tools: null`.
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$GITHUB_EVENT_NAME" != "merge_group" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LINKED" ]]; then
VERSIONS_JSON='[null]'
else
VERSIONS_JSON='[null, "linked"]'
fi
# Output a JSON-encoded list with the distinct versions to test against.
echo "Suggested matrix config for analysis job: $VERSIONS_JSON"
echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT
analyze-javascript:
if: github.triggering_actor != 'dependabot[bot]'
needs: [check-codeql-versions]
strategy:
fail-fast: false
matrix:
language:
- actions
- javascript
os:
- ubuntu-22.04
- ubuntu-24.04
- windows-2022
- windows-2025
- macos-15-xlarge
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
@@ -41,15 +94,49 @@ jobs:
uses: ./init
id: init
with:
languages: ${{ matrix.language }}
build-mode: none
config-file: ./.github/codeql/codeql-config-${{ matrix.language }}.yml
languages: javascript
config-file: ./.github/codeql/codeql-config-javascript.yml
tools: ${{ matrix.tools }}
# confirm steps.init.outputs.codeql-path points to the codeql binary
- name: Print CodeQL Version
run: >
"$CODEQL" version --format=json
env:
CODEQL: ${{steps.init.outputs.codeql-path}}
- name: Perform CodeQL Analysis
uses: ./analyze
with:
category: "/language:javascript"
upload: ${{ (matrix.os == 'ubuntu-24.04' && !matrix.tools && github.event_name != 'merge_group' && 'always' ) || 'never' }}
analyze-other:
if: github.triggering_actor != 'dependabot[bot]'
runs-on: ubuntu-26.04
strategy:
fail-fast: false
matrix:
include:
- language: actions
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Initialize CodeQL
uses: ./init
with:
languages: ${{ matrix.language }}
build-mode: none
config: >
paths-ignore:
- lib
- tests
queries:
- uses: security-and-quality
- name: Perform CodeQL Analysis
uses: ./analyze
with:

View File

@@ -31,7 +31,6 @@ on:
- "PR Check - C/C\\+\\+: autoinstalling dependencies is skipped (macOS)"
- "PR Check - C/C\\+\\+: disabling autoinstalling dependencies (Linux)"
- "PR Check - Clean up database cluster directory"
- "PR Check - CodeQL Bundle All"
- "PR Check - Config export"
- "PR Check - Config input"
- "PR Check - Custom source root"
@@ -61,7 +60,6 @@ on:
- "PR Check - Remote config file"
- "PR Check - Resolve environment"
- "PR Check - Ruby analysis"
- "PR Check - Runner images"
- "PR Check - Rust analysis"
- "PR Check - Split workflow"
- "PR Check - Start proxy"

View File

@@ -1,62 +0,0 @@
name: "PR Check - CodeQL Bundle All"
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:
test-codeql-bundle-all:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-26.04
version: nightly-latest
name: "CodeQL Bundle All"
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: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: true
- name: Install .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: "9.x"
- id: init
uses: ./../action/init
with:
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -17,6 +17,18 @@ steps:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check that the bundle contains tools for all platforms
env:
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
run: |
# Platform-specific bundles only contain the tools for their own platform.
tools_dir="$(dirname "$CODEQL_PATH")/tools"
for platform in linux64 osx64 win64; do
if [[ ! -d "$tools_dir/$platform" ]]; then
echo "::error::Expected an all-platform CodeQL bundle, but '$tools_dir' does not contain a '$platform' directory."
exit 1
fi
done
- name: Build code
run: ./build.sh
- uses: ./../action/analyze

View File

@@ -0,0 +1,35 @@
name: "Linux Arm64"
description: "An end-to-end integration test running on a Linux Arm64 runner, checking that the native linux-arm64 CodeQL bundle is downloaded and can analyze interpreted and compiled code"
operatingSystems:
- os: ubuntu
runner-image: ubuntu-24.04-arm
# The native linux-arm64 CodeQL bundle is only available in recent CLI releases, so we restrict this
# check to `nightly-latest`, which is guaranteed to ship it. Older stable versions do not have an
# arm64 asset, and `prepare-test` would resolve an x64 bundle URL for them on this runner.
versions:
- nightly-latest
installGo: true
installDotNet: true
# The set of languages CodeQL supports on this platform, excluding Swift (macOS only).
env:
LANGUAGES: cpp,csharp,go,java,javascript,python,ruby
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

View File

@@ -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