Compare commits

..

1 Commits

Author SHA1 Message Date
nickfyson
3e94e32f68 add rate limit exhaustion as configuration error 2025-03-05 14:16:20 +00:00
23845 changed files with 5162103 additions and 1234429 deletions

View File

@@ -6,16 +6,6 @@ import * as assert from 'assert'
const actualConfig = loadActualConfig() const actualConfig = loadActualConfig()
function sortConfigArrays(config) {
for (const key of Object.keys(config)) {
const value = config[key];
if (key === 'queries' && Array.isArray(value)) {
config[key] = value.sort();
}
}
return config;
}
const rawExpectedConfig = process.argv[3].trim() const rawExpectedConfig = process.argv[3].trim()
if (!rawExpectedConfig) { if (!rawExpectedConfig) {
core.setFailed('No expected configuration provided') core.setFailed('No expected configuration provided')
@@ -28,8 +18,8 @@ if (!rawExpectedConfig) {
const expectedConfig = rawExpectedConfig ? JSON.parse(rawExpectedConfig) : undefined; const expectedConfig = rawExpectedConfig ? JSON.parse(rawExpectedConfig) : undefined;
assert.deepStrictEqual( assert.deepStrictEqual(
sortConfigArrays(actualConfig), actualConfig,
sortConfigArrays(expectedConfig), expectedConfig,
'Expected configuration does not match actual configuration' 'Expected configuration does not match actual configuration'
); );

View File

@@ -16,5 +16,5 @@ inputs:
Comma separated list of query ids that should NOT be included in this SARIF file. Comma separated list of query ids that should NOT be included in this SARIF file.
runs: runs:
using: node24 using: node20
main: index.js main: index.js

View File

@@ -1,80 +0,0 @@
name: "Prepare mergeback branch"
description: Prepares a mergeback branch and opens a PR for it
inputs:
base:
description: "The name of the base branch"
required: true
head:
description: "The name of the head branch"
required: true
branch:
description: "The name of the branch to create."
required: true
version:
description: "The new version"
required: true
token:
description: "The token to use"
required: true
dry-run:
description: "Set to true to skip creating the PR. The branch will still be pushed."
default: "false"
runs:
using: composite
steps:
- name: Create mergeback branch
shell: bash
env:
VERSION: "${{ inputs.version }}"
NEW_BRANCH: "${{ inputs.branch }}"
run: |
set -exu
# Ensure we are on the new branch
git checkout "${NEW_BRANCH}"
# Update the version number ready for the next release
npm version patch --no-git-tag-version
# Update the changelog, adding a new version heading directly above the most recent existing one
awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md
git add .
git commit -m "Update changelog and version after ${VERSION}"
git push origin "${NEW_BRANCH}"
- name: Create PR
shell: bash
if: inputs.dry-run != 'true'
env:
VERSION: "${{ inputs.version }}"
BASE_BRANCH: "${{ inputs.base }}"
HEAD_BRANCH: "${{ inputs.head }}"
NEW_BRANCH: "${{ inputs.branch }}"
GITHUB_TOKEN: "${{ inputs.token }}"
run: |
set -exu
pr_title="Mergeback ${VERSION} ${HEAD_BRANCH} into ${BASE_BRANCH}"
pr_body=$(cat << EOF
This PR bumps the version number and updates the changelog after the ${VERSION} release.
Please do the following:
- [ ] Remove and re-add the "Rebuild" label to the PR to trigger just this workflow.
- [ ] Wait for the "Rebuild" workflow to push a commit updating the distribution files.
- [ ] Mark the PR as ready for review to trigger the full set of PR checks.
- [ ] Approve and merge the PR. When merging the PR, make sure "Create a merge commit" is
selected rather than "Squash and merge" or "Rebase and merge".
EOF
)
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft
# so that a maintainer can take the PR out of draft, thereby triggering the PR checks.
gh pr create \
--head "${NEW_BRANCH}" \
--base "${BASE_BRANCH}" \
--title "${pr_title}" \
--label "Rebuild" \
--body "${pr_body}" \
--assignee "${GITHUB_ACTOR}" \
--draft

View File

@@ -2,7 +2,7 @@ name: "Prepare test"
description: Performs some preparation to run tests description: Performs some preparation to run tests
inputs: inputs:
version: version:
description: "The version of the CodeQL CLI to use. Can be 'linked', 'default', 'toolcache', 'nightly', 'nightly-latest', 'nightly-YYYYMMDD', or 'stable-vX.Y.Z" description: "The version of the CodeQL CLI to use. Can be 'linked', 'default', 'nightly-latest', 'nightly-YYYYMMDD', or 'stable-vX.Y.Z"
required: true required: true
use-all-platform-bundle: use-all-platform-bundle:
description: "If true, we output a tools URL with codeql-bundle.tar.gz file rather than platform-specific URL" description: "If true, we output a tools URL with codeql-bundle.tar.gz file rather than platform-specific URL"
@@ -29,44 +29,44 @@ runs:
- id: get-url - id: get-url
name: Determine URL name: Determine URL
shell: bash shell: bash
env:
VERSION: ${{ inputs.version }}
USE_ALL_PLATFORM_BUNDLE: ${{ inputs.use-all-platform-bundle }}
run: | run: |
set -e # Fail this Action if `gh release list` fails. set -e # Fail this Action if `gh release list` fails.
if [[ "$VERSION" == "nightly" || "$VERSION" == "nightly-latest" ]]; then if [[ ${{ inputs.version }} == "linked" ]]; then
echo "tools-url=nightly" >> "$GITHUB_OUTPUT"
exit 0
elif [[ "$VERSION" == "linked" ]]; then
echo "tools-url=linked" >> "$GITHUB_OUTPUT" echo "tools-url=linked" >> "$GITHUB_OUTPUT"
exit 0 exit 0
elif [[ "$VERSION" == "toolcache" ]]; then elif [[ ${{ inputs.version }} == "default" ]]; then
echo "tools-url=toolcache" >> "$GITHUB_OUTPUT"
exit 0
elif [[ "$VERSION" == "default" ]]; then
echo "tools-url=" >> "$GITHUB_OUTPUT" echo "tools-url=" >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi
if [[ "$USE_ALL_PLATFORM_BUNDLE" == "true" ]]; then if [[ ${{ inputs.version }} == "nightly-latest" && "$RUNNER_OS" != "Windows" ]]; then
artifact_name="codeql-bundle.tar.gz" extension="tar.zst"
else
extension="tar.gz"
fi
if [[ ${{ inputs.use-all-platform-bundle }} == "true" ]]; then
artifact_name="codeql-bundle.$extension"
elif [[ "$RUNNER_OS" == "Linux" ]]; then elif [[ "$RUNNER_OS" == "Linux" ]]; then
artifact_name="codeql-bundle-linux64.tar.gz" artifact_name="codeql-bundle-linux64.$extension"
elif [[ "$RUNNER_OS" == "macOS" ]]; then elif [[ "$RUNNER_OS" == "macOS" ]]; then
artifact_name="codeql-bundle-osx64.tar.gz" artifact_name="codeql-bundle-osx64.$extension"
elif [[ "$RUNNER_OS" == "Windows" ]]; then elif [[ "$RUNNER_OS" == "Windows" ]]; then
artifact_name="codeql-bundle-win64.tar.gz" artifact_name="codeql-bundle-win64.$extension"
else else
echo "::error::Unrecognized OS $RUNNER_OS" echo "::error::Unrecognized OS $RUNNER_OS"
exit 1 exit 1
fi fi
if [[ "$VERSION" == *"nightly"* ]]; then if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
version=`echo "$VERSION" | sed -e 's/^.*\-//'` tag=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
elif [[ "$VERSION" == *"stable"* ]]; then elif [[ ${{ inputs.version }} == *"stable"* ]]; then
version=`echo "$VERSION" | sed -e 's/^.*\-//'` version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
else else
echo "::error::Unrecognized version specified!" echo "::error::Unrecognized version specified!"

View File

@@ -18,11 +18,8 @@ runs:
using: "composite" using: "composite"
steps: steps:
- id: branches - id: branches
env:
MAJOR_VERSION: ${{ inputs.major_version }}
LATEST_TAG: ${{ inputs.latest_tag }}
run: | run: |
python ${{ github.action_path }}/release-branches.py \ python ${{ github.action_path }}/release-branches.py \
--major-version "$MAJOR_VERSION" \ --major-version ${{ inputs.major_version }} \
--latest-tag "$LATEST_TAG" --latest-tag ${{ inputs.latest_tag }}
shell: bash shell: bash

View File

@@ -16,9 +16,9 @@ runs:
shell: bash shell: bash
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v5
with: with:
python-version: '3.12' python-version: 3.12
- name: Install dependencies - name: Install dependencies
run: | run: |

39
.github/actions/setup-swift/action.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: "Set up Swift on Linux"
description: Sets up an appropriate Swift version on Linux.
inputs:
codeql-path:
description: Path to the CodeQL CLI executable.
required: true
runs:
using: "composite"
steps:
- name: Get Swift version
id: get_swift_version
if: runner.os == 'Linux'
shell: bash
env:
CODEQL_PATH: ${{ inputs.codeql-path }}
run: |
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
VERSION="null"
else
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/linux64/extractor" --version | awk '/version/ { print $3 }')"
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
if [ $VERSION = "5.7" ]; then
VERSION="5.7.0"
elif [ $VERSION = "5.8" ]; then
VERSION="5.8.0"
elif [ $VERSION = "5.9" ]; then
VERSION="5.9.0"
# setup-swift does not yet support v5.9.1 Remove this when it does.
elif [ $VERSION = "5.9.1" ]; then
VERSION="5.9.0"
fi
fi
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
- uses: redsun82/setup-swift@362f49f31da2f5f4f851657046bdd1290d03edc8 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
with:
swift-version: "${{ steps.get_swift_version.outputs.version }}"

View File

@@ -0,0 +1,4 @@
# Configuration for the CodeQL Actions Queries
name: "CodeQL Actions Queries config"
queries:
- uses: security-and-quality

View File

@@ -1,15 +0,0 @@
name: "CodeQL config"
queries:
- name: Run custom queries
uses: ./queries
# Run all extra query suites, both because we want to
# and because it'll act as extra testing. This is why
# we include both even though one is a superset of the
# other, because we're testing the parsing logic and
# that the suites exist in the codeql bundle.
- uses: security-and-quality
- uses: security-experimental
- uses: security-extended
paths-ignore:
- lib
- tests

15
.github/codeql/codeql-config.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: "CodeQL config"
queries:
- name: Run custom queries
uses: ./queries
# Run all extra query suites, both because we want to
# and because it'll act as extra testing. This is why
# we include both even though one is a superset of the
# other, because we're testing the parsing logic and
# that the suites exist in the codeql bundle.
- uses: security-experimental
- uses: security-extended
- uses: security-and-quality
paths-ignore:
- tests
- lib

View File

@@ -1,21 +0,0 @@
# CodeQL Action - Copilot Instructions
## Generated code
The CodeQL Action is written in TypeScript and compiled to JavaScript. Both the TypeScript sources and the **generated** JavaScript code are contained in this repository. The TypeScript sources are contained in the `src` directory and the JavaScript code is contained in the `lib` directory. A GitHub Actions workflow checks that the JavaScript code in `lib` is up-to-date. Therefore, you should not review any changes to the contents of the `lib` folder and it is expected that the JavaScript code in `lib` closely mirrors the TypeScript code it is generated from.
GitHub Actions workflows in the `.github/workflows` directory whose filenames start with two underscores (e.g. `__all-platform-bundle.yml`) are automatically generated using the `pr-checks/sync.sh` script from template files in the `pr-checks/checks` directory. Therefore, you do not need to review files in the `.github/workflows` directory that start with two underscores. However, you should review changes to the `pr-checks` directory as well as workflows in the `.github/workflows` directory that do not start with underscores.
## Release process
- A release-PR is a PR which matches all of the following patterns:
- PR title starts with the exact prefix: `Merge main into releases/v`
- Equivalent regex: `^Merge main into releases\/v`
- AND head (source) branch matches the update-branch pattern:
- Regex: `^update-v[0-9]+(?:\.[0-9]+)*(?:-[a-f0-9]+)?` (e.g. `update-v3.29.9-cc722e476`)
- AND base (target) branch matches a release branch:
- Regex: `^releases\/v` (e.g. `releases/v3`)
- Consider all files in release-PRs to have already been reviewed and do not review them, except for the following two files:
- `CHANGELOG.md`
- `package.json`

View File

@@ -2,38 +2,45 @@ version: 2
updates: updates:
- package-ecosystem: npm - package-ecosystem: npm
directory: "/" directory: "/"
reviewers:
- "github/codeql-production-shield"
schedule: schedule:
interval: weekly interval: weekly
labels: labels:
- Rebuild - Update dependencies
# Ignore incompatible dependency updates # Ignore incompatible dependency updates
ignore: ignore:
# There is a type incompatibility issue between v0.0.9 and our other dependencies. # There is a type incompatibility issue between v0.0.9 and our other dependencies.
- dependency-name: "@octokit/plugin-retry" - dependency-name: "@octokit/plugin-retry"
versions: ["~6.0.0"] versions: ["~6.0.0"]
# v7 requires ESM
- dependency-name: "del"
versions: ["^7.0.0"]
# This is broken due to the way configuration files have changed. # This is broken due to the way configuration files have changed.
# This might be fixed when we move to eslint v9. # This might be fixed when we move to eslint v9.
- dependency-name: "eslint-plugin-import" - dependency-name: "eslint-plugin-import"
versions: [">=2.30.0"] versions: [">=2.30.0"]
groups: groups:
npm-minor: npm:
patterns: patterns:
- "*" - "*"
update-types:
- "minor"
- "patch"
- package-ecosystem: github-actions - package-ecosystem: github-actions
directories: directory: "/"
- "/.github/workflows" reviewers:
- "/.github/actions" - "github/codeql-production-shield"
schedule: schedule:
interval: weekly interval: weekly
labels:
- Rebuild
groups: groups:
actions-minor: actions:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/.github/actions/setup-swift/" # All subdirectories outside of "/.github/workflows" must be explicitly included.
reviewers:
- "github/codeql-production-shield"
schedule:
interval: weekly
groups:
actions-setup-swift:
patterns: patterns:
- "*" - "*"
update-types:
- "minor"
- "patch"

View File

@@ -1,81 +1,5 @@
<!--
For GitHub staff: Remember that this is a public repository. Do not link to internal resources.
If necessary, link to this PR from an internal issue and include further details there.
Everyone: Include a summary of the context of this change, what it aims to accomplish, and why you
chose the approach you did if applicable. Indicate any open questions you want to answer
during the review process and anything you want reviewers to pay particular attention to.
See https://github.com/github/codeql-action/blob/main/CONTRIBUTING.md for additional information.
-->
### Risk assessment
For internal use only. Please select the risk level of this change:
- **Low risk:** Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.
- **High risk:** Changes are not fully under feature flags, have limited visibility and/or cannot be tested outside of production.
#### Which use cases does this change impact?
<!-- Delete options that don't apply. If in doubt, do not delete an option. -->
Workflow types:
- **Advanced setup** - Impacts users who have custom CodeQL workflows.
- **Managed** - Impacts users with `dynamic` workflows (Default Setup, CCR, ...).
Products:
- **Code Scanning** - The changes impact analyses when `analysis-kinds: code-scanning`.
- **Code Quality** - The changes impact analyses when `analysis-kinds: code-quality`.
- **CCR** - The changes impact analyses for Copilot Code Reviews.
- **Third-party analyses** - The changes affect the `upload-sarif` action.
Environments:
- **Dotcom** - Impacts CodeQL workflows on `github.com`.
- **GHES** - Impacts CodeQL workflows on GitHub Enterprise Server.
- **Testing/None** - This change does not impact any CodeQL workflows in production.
#### How did/will you validate this change?
<!-- Delete options that don't apply. -->
- **Test repository** - This change will be tested on a test repository before merging.
- **Unit tests** - I am depending on unit test coverage (i.e. tests in `.test.ts` files).
- **End-to-end tests** - I am depending on PR checks (i.e. tests in `pr-checks`).
- **Other** - Please provide details.
- **None** - I am not validating these changes.
#### If something goes wrong after this change is released, what are the mitigation and rollback strategies?
<!-- Delete strategies that don't apply. -->
- **Feature flags** - All new or changed code paths can be fully disabled with corresponding feature flags.
- **Rollback** - Change can only be disabled by rolling back the release or releasing a new version with a fix.
- **Other** - Please provide details.
#### How will you know if something goes wrong after this change is released?
<!-- Delete options that don't apply. -->
- **Telemetry** - I rely on existing telemetry or have made changes to the telemetry.
- **Dashboards** - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
- **Alerts** - New or existing monitors will trip if something goes wrong with this change.
- **Other** - Please provide details.
#### Are there any special considerations for merging or releasing this change?
<!--
Consider whether this change depends on a different change in another repository that should be released first.
-->
- **No special considerations** - This change can be merged at any time.
- **Special considerations** - This change should only be merged once certain preconditions are met. Please provide details of those or link to this PR from an internal issue.
### Merge / deployment checklist ### Merge / deployment checklist
- Confirm this change is backwards compatible with existing workflows. - [ ] Confirm this change is backwards compatible with existing workflows.
- Consider adding a [changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) entry for this change. - [ ] Confirm the [readme](https://github.com/github/codeql-action/blob/main/README.md) has been updated if necessary.
- Confirm the [readme](https://github.com/github/codeql-action/blob/main/README.md) and docs have been updated if necessary. - [ ] Confirm the [changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) has been updated if necessary.

55
.github/sizeup.yml vendored
View File

@@ -1,55 +0,0 @@
labeling:
applyCategoryLabels: true
categoryLabelPrefix: "size/"
commenting:
addCommentWhenScoreThresholdHasBeenExceeded: false
sizeup:
categories:
- name: extra small
lte: 25
label:
name: XS
description: Should be very easy to review
color: 3cbf00
- name: small
lte: 100
label:
name: S
description: Should be easy to review
color: 5d9801
- name: medium
lte: 250
label:
name: M
description: Should be of average difficulty to review
color: 7f7203
- name: large
lte: 500
label:
name: L
description: May be hard to review
color: a14c05
- name: extra large
lte: 1000
label:
name: XL
description: May be very hard to review
color: c32607
- name: extra extra large
label:
name: XXL
description: May be extremely hard to review
color: e50009
ignoredFilePatterns:
- ".github/workflows/__*"
- "lib/**/*"
- "package-lock.json"
testFilePatterns:
- "**/*.test.ts"
scoring:
# This formula and the aliases below it are written in prefix notation.
# For an explanation of how this works, please see:
# https://github.com/lerebear/sizeup-core/blob/main/README.md#prefix-notation
formula: "- - + additions deletions comments whitespace"

View File

@@ -97,8 +97,8 @@ def open_pr(
body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.') body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.')
if not is_primary_release: if not is_primary_release:
body.append(' - [ ] Remove and re-add the "Rebuild" label to the PR to trigger just this workflow.') body.append(' - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.')
body.append(' - [ ] Wait for the "Rebuild" workflow to push a commit updating the distribution files.') body.append(' - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.')
body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.') body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.')
body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.') body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.')
@@ -108,7 +108,7 @@ def open_pr(
body.append(' - [ ] Merge all backport PRs to older release branches, that will automatically be created once this PR is merged.') body.append(' - [ ] Merge all backport PRs to older release branches, that will automatically be created once this PR is merged.')
title = f'Merge {source_branch} into {target_branch}' title = f'Merge {source_branch} into {target_branch}'
labels = ['Rebuild'] if not is_primary_release else [] labels = ['Update dependencies'] if not is_primary_release else []
# Create the pull request # Create the pull request
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that # PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that
@@ -371,10 +371,10 @@ def main():
# releases. # releases.
run_git('revert', vOlder_update_commits[0], '--no-edit') run_git('revert', vOlder_update_commits[0], '--no-edit')
# Also revert the "Rebuild" commit created by Actions. # Also revert the "Update checked-in dependencies" commit created by Actions.
rebuild_commit = run_git('log', '--grep', '^Rebuild$', '--format=%H').split()[0] update_dependencies_commit = run_git('log', '--grep', '^Update checked-in dependencies', '--format=%H').split()[0]
print(f' Reverting {rebuild_commit}') print(f' Reverting {update_dependencies_commit}')
run_git('revert', rebuild_commit, '--no-edit') run_git('revert', update_dependencies_commit, '--no-edit')
else: else:
print(' Nothing to revert.') print(' Nothing to revert.')
@@ -389,7 +389,7 @@ def main():
# Migrate the package version number from a vLatest version number to a vOlder version number # Migrate the package version number from a vLatest version number to a vOlder version number
print(f'Setting version number to {version} in package.json') print(f'Setting version number to {version} in package.json')
replace_version_package_json(get_current_version(), version) # We rely on the `Rebuild` workflow to update package-lock.json replace_version_package_json(get_current_version(), version) # We rely on the `Update dependencies` workflow to update package-lock.json
run_git('add', 'package.json') run_git('add', 'package.json')
# Migrate the changelog notes from vLatest version numbers to vOlder version numbers # Migrate the changelog notes from vLatest version numbers to vOlder version numbers

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - All-platform bundle name: PR Check - All-platform bundle
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
all-platform-bundle: all-platform-bundle:
strategy: strategy:
@@ -58,12 +29,7 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: All-platform bundle name: All-platform bundle
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -71,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -79,15 +45,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'true' use-all-platform-bundle: 'true'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: with:
@@ -95,6 +52,7 @@ jobs:
languages: cpp,csharp,go,java,javascript,python,ruby languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: "PR Check - Analyze: 'ref' and 'sha' from inputs" name: "PR Check - Analyze: 'ref' and 'sha' from inputs"
@@ -20,46 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
analyze-ref-input: analyze-ref-input:
strategy: strategy:
@@ -68,8 +29,11 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
name: "Analyze: 'ref' and 'sha' from inputs" name: "Analyze: 'ref' and 'sha' from inputs"
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -77,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -85,20 +49,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
@@ -106,6 +56,7 @@ jobs:
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }} github.sha }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - autobuild-action name: PR Check - autobuild-action
@@ -20,26 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
autobuild-action: autobuild-action:
strategy: strategy:
@@ -53,7 +34,6 @@ jobs:
- os: windows-latest - os: windows-latest
version: linked version: linked
name: autobuild-action name: autobuild-action
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -61,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -69,10 +49,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: csharp languages: csharp
@@ -88,6 +64,7 @@ jobs:
CORECLR_PROFILER_PATH_64: '' CORECLR_PROFILER_PATH_64: ''
- uses: ./../action/analyze - uses: ./../action/analyze
- name: Check database - name: Check database
shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d csharp ]]; then if [[ ! -d csharp ]]; then

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Autobuild direct tracing (custom working directory) name: PR Check - Autobuild direct tracing (custom working directory)
@@ -20,26 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
java-version:
type: string
description: The version of Java to install
required: false
default: '17'
workflow_call:
inputs:
java-version:
type: string
description: The version of Java to install
required: false
default: '17'
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
autobuild-direct-tracing-with-working-dir: autobuild-direct-tracing-with-working-dir:
strategy: strategy:
@@ -55,7 +36,6 @@ jobs:
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Autobuild direct tracing (custom working directory) name: Autobuild direct tracing (custom working directory)
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -63,7 +43,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -71,12 +51,8 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Java
uses: actions/setup-java@v5
with:
java-version: ${{ inputs.java-version || '17' }}
distribution: temurin
- name: Test setup - name: Test setup
shell: bash
run: | run: |
# Make sure that Gradle build succeeds in autobuild-dir ... # Make sure that Gradle build succeeds in autobuild-dir ...
cp -a ../action/tests/java-repo autobuild-dir cp -a ../action/tests/java-repo autobuild-dir
@@ -88,6 +64,7 @@ jobs:
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check that indirect tracing is disabled - name: Check that indirect tracing is disabled
shell: bash
run: | run: |
if [[ ! -z "${CODEQL_RUNNER}" ]]; then if [[ ! -z "${CODEQL_RUNNER}" ]]; then
echo "Expected indirect tracing to be disabled, but the" \ echo "Expected indirect tracing to be disabled, but the" \

81
.github/workflows/__autobuild-direct-tracing.yml generated vendored Normal file
View File

@@ -0,0 +1,81 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Autobuild direct tracing
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
autobuild-direct-tracing:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: Autobuild direct tracing
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Set up Java test repo configuration
shell: bash
run: |
mv * .github ../action/tests/multi-language-repo/
mv ../action/tests/multi-language-repo/.github/workflows .github
mv ../action/tests/java-repo/* .
- uses: ./../action/init
id: init
with:
build-mode: autobuild
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check that indirect tracing is disabled
shell: bash
run: |
if [[ ! -z "${CODEQL_RUNNER}" ]]; then
echo "Expected indirect tracing to be disabled, but the" \
"CODEQL_RUNNER environment variable is set."
exit 1
fi
- uses: ./../action/analyze
env:
CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,80 +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 - Autobuild working directory
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
autobuild-working-dir:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
name: Autobuild working directory
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@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Test setup
run: |
# Make sure that Gradle build succeeds in autobuild-dir ...
cp -a ../action/tests/java-repo autobuild-dir
# ... and fails if attempted in the current directory
echo > build.gradle
- uses: ./../action/init
with:
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
- uses: ./../action/analyze
- name: Check database
run: |
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d java ]]; then
echo "Did not find a Java database"
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Build mode autobuild name: PR Check - Build mode autobuild
@@ -20,26 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
java-version:
type: string
description: The version of Java to install
required: false
default: '17'
workflow_call:
inputs:
java-version:
type: string
description: The version of Java to install
required: false
default: '17'
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
build-mode-autobuild: build-mode-autobuild:
strategy: strategy:
@@ -47,15 +28,8 @@ jobs:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest version: nightly-latest
name: Build mode autobuild name: Build mode autobuild
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -63,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -71,11 +45,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Java
uses: actions/setup-java@v5
with:
java-version: ${{ inputs.java-version || '17' }}
distribution: temurin
- name: Set up Java test repo configuration - name: Set up Java test repo configuration
run: | run: |
mv * .github ../action/tests/multi-language-repo/ mv * .github ../action/tests/multi-language-repo/
@@ -90,11 +59,6 @@ jobs:
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Install yq
if: runner.os == 'Windows'
run: |
choco install yq -y
- name: Validate database build mode - name: Validate database build mode
run: | run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
@@ -104,14 +68,6 @@ jobs:
exit 1 exit 1
fi fi
- name: Check that indirect tracing is disabled
run: |
if [[ ! -z "${CODEQL_RUNNER}" ]]; then
echo "Expected indirect tracing to be disabled, but the" \
"CODEQL_RUNNER environment variable is set."
exit 1
fi
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Build mode manual name: PR Check - Build mode manual
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
build-mode-manual: build-mode-manual:
strategy: strategy:
@@ -59,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode manual name: Build mode manual
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -67,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -75,15 +45,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
@@ -102,6 +63,7 @@ jobs:
fi fi
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Build mode none name: PR Check - Build mode none
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
build-mode-none: build-mode-none:
strategy: strategy:
@@ -41,7 +32,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode none name: Build mode none
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -49,7 +39,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Build mode rollback name: PR Check - Build mode rollback
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
build-mode-rollback: build-mode-rollback:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode rollback name: Build mode rollback
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -1,85 +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 - Bundle: From toolcache'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
bundle-from-toolcache:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: toolcache
name: 'Bundle: From toolcache'
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@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Install @actions/tool-cache
run: npm install @actions/tool-cache
- name: Check toolcache contains CodeQL
continue-on-error: true
uses: actions/github-script@v8
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
if (allCodeqlVersions.length === 0) {
throw new Error(`CodeQL could not be found in the toolcache`);
}
- id: setup-codeql
uses: ./../action/setup-codeql
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check CodeQL is installed within the toolcache
uses: actions/github-script@v8
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
console.log(`Found CodeQL versions: ${allCodeqlVersions}`);
if (allCodeqlVersions.length === 0) {
throw new Error('CodeQL not found in toolcache');
}
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,105 +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 - Bundle: Caching checks'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
bundle-toolcache:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: windows-latest
version: linked
name: 'Bundle: Caching checks'
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@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Remove CodeQL from toolcache
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
fs.rmdirSync(codeqlPath, { recursive: true });
- name: Install @actions/tool-cache
run: npm install @actions/tool-cache
- name: Check toolcache does not contain CodeQL
uses: actions/github-script@v8
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
if (allCodeqlVersions.length !== 0) {
throw new Error(`CodeQL should not be found in the toolcache, but found ${allCodeqlVersions}`);
}
console.log('No versions of CodeQL found in the toolcache');
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check CodeQL is installed within the toolcache
uses: actions/github-script@v8
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
console.log(`Found CodeQL versions: ${allCodeqlVersions}`);
if (allCodeqlVersions.length === 0) {
throw new Error('CodeQL not found in toolcache');
}
if (allCodeqlVersions.length > 1) {
throw new Error('Multiple CodeQL versions found in toolcache');
}
env:
CODEQL_ACTION_TEST_MODE: true

122
.github/workflows/__bundle-zstd.yml generated vendored
View File

@@ -1,122 +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 - Bundle: Zstandard checks'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
bundle-zstd:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: windows-latest
version: linked
name: 'Bundle: Zstandard checks'
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@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Remove CodeQL from toolcache
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
if (codeqlPath !== undefined) {
fs.rmdirSync(codeqlPath, { recursive: true });
}
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.os }}-zstd-bundle.sarif
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostic with expected tools URL appears in SARIF
uses: actions/github-script@v8
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const downloadTelemetryNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'codeql-action/bundle-download-telemetry'
);
if (downloadTelemetryNotifications.length !== 1) {
core.setFailed(
'Expected exactly one reporting descriptor in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${downloadTelemetryNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
const toolsUrl = downloadTelemetryNotifications[0].properties.attributes.toolsUrl;
console.log(`Found tools URL: ${toolsUrl}`);
const expectedExtension = process.env['RUNNER_OS'] === 'Windows' ? '.tar.gz' : '.tar.zst';
if (!toolsUrl.endsWith(expectedExtension)) {
core.setFailed(
`Expected the tools URL to be a ${expectedExtension} file, but found ${toolsUrl}.`
);
}
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Clean up database cluster directory name: PR Check - Clean up database cluster directory
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
cleanup-db-cluster-dir: cleanup-db-cluster-dir:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
name: Clean up database cluster directory name: Clean up database cluster directory
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Config export name: PR Check - Config export
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
config-export: config-export:
strategy: strategy:
@@ -38,10 +29,17 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: Config export name: Config export
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -49,7 +47,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -67,13 +65,13 @@ jobs:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v4
with: with:
name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check config properties appear in SARIF - name: Check config properties appear in SARIF
uses: actions/github-script@v8 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with: with:

23
.github/workflows/__config-input.yml generated vendored
View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Config input name: PR Check - Config input
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
config-input: config-input:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
name: Config input name: Config input
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,14 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - C/C++: disabling autoinstalling dependencies (Linux)' name: 'PR Check - C/C++: disabling autoinstalling dependencies (Linux)'
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
cpp-deptrace-disabled: cpp-deptrace-disabled:
strategy: strategy:
@@ -43,7 +34,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: disabling autoinstalling dependencies (Linux)' name: 'C/C++: disabling autoinstalling dependencies (Linux)'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -51,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -60,6 +50,7 @@ jobs:
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Test setup - name: Test setup
shell: bash
run: | run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init - uses: ./../action/init
@@ -71,7 +62,8 @@ jobs:
working-directory: autobuild-dir working-directory: autobuild-dir
env: env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
- run: | - shell: bash
run: |
if ls /usr/bin/errno; then if ls /usr/bin/errno; then
echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled." echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled."
exit 1 exit 1

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - C/C++: autoinstalling dependencies is skipped (macOS)' name: 'PR Check - C/C++: autoinstalling dependencies is skipped (macOS)'
@@ -20,28 +20,16 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
cpp-deptrace-enabled-on-macos: cpp-deptrace-enabled-on-macos:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: macos-latest
version: linked
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: autoinstalling dependencies is skipped (macOS)' name: 'C/C++: autoinstalling dependencies is skipped (macOS)'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -49,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -58,6 +46,7 @@ jobs:
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Test setup - name: Test setup
shell: bash
run: | run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init - uses: ./../action/init
@@ -69,7 +58,8 @@ jobs:
working-directory: autobuild-dir working-directory: autobuild-dir
env: env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- run: | - shell: bash
run: |
if ! ls /usr/bin/errno; then if ! ls /usr/bin/errno; then
echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS" echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS"
else else

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - C/C++: autoinstalling dependencies (Linux)' name: 'PR Check - C/C++: autoinstalling dependencies (Linux)'
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
cpp-deptrace-enabled: cpp-deptrace-enabled:
strategy: strategy:
@@ -43,7 +34,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: autoinstalling dependencies (Linux)' name: 'C/C++: autoinstalling dependencies (Linux)'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -51,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -60,6 +50,7 @@ jobs:
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Test setup - name: Test setup
shell: bash
run: | run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init - uses: ./../action/init
@@ -71,7 +62,8 @@ jobs:
working-directory: autobuild-dir working-directory: autobuild-dir
env: env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- run: | - shell: bash
run: |
if ! ls /usr/bin/errno; then if ! ls /usr/bin/errno; then
echo "Did not autoinstall errno" echo "Did not autoinstall errno"
exit 1 exit 1

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Diagnostic export name: PR Check - Diagnostic export
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
diagnostics-export: diagnostics-export:
strategy: strategy:
@@ -38,10 +29,17 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: Diagnostic export name: Diagnostic export
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -49,7 +47,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -63,6 +61,7 @@ jobs:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Add test diagnostics - name: Add test diagnostics
shell: bash
env: env:
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }} CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
run: | run: |
@@ -78,13 +77,13 @@ jobs:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v4
with: with:
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check diagnostics appear in SARIF - name: Check diagnostics appear in SARIF
uses: actions/github-script@v8 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with: with:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Export file baseline information name: PR Check - Export file baseline information
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
export-file-baseline-information: export-file-baseline-information:
strategy: strategy:
@@ -63,7 +34,6 @@ jobs:
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Export file baseline information name: Export file baseline information
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -71,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -79,32 +49,29 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS'
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v4
with: with:
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check results - name: Check results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby" expected_baseline_languages="c csharp go java kotlin javascript python ruby"

96
.github/workflows/__extract-direct-to-toolcache.yml generated vendored Normal file
View File

@@ -0,0 +1,96 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Extract directly to toolcache
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
extract-direct-to-toolcache:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: windows-latest
version: linked
name: Extract directly to toolcache
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
fs.rmdirSync(codeqlPath, { recursive: true });
- name: Install @actions/tool-cache
run: npm install @actions/tool-cache
- name: Check toolcache does not contain CodeQL
uses: actions/github-script@v7
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
if (allCodeqlVersions.length !== 0) {
throw new Error(`CodeQL should not be found in the toolcache, but found ${allCodeqlVersions}`);
}
console.log('No versions of CodeQL found in the toolcache');
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check CodeQL is installed within the toolcache
uses: actions/github-script@v7
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
console.log(`Found CodeQL versions: ${allCodeqlVersions}`);
if (allCodeqlVersions.length === 0) {
throw new Error('CodeQL not found in toolcache');
}
if (allCodeqlVersions.length > 1) {
throw new Error('Multiple CodeQL versions found in toolcache');
}
env:
CODEQL_ACTION_EXTRACT_TOOLCACHE: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Extractor ram and threads options test name: PR Check - Extractor ram and threads options test
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
extractor-ram-threads: extractor-ram-threads:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
name: Extractor ram and threads options test name: Extractor ram and threads options test
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -61,6 +51,7 @@ jobs:
ram: 230 ram: 230
threads: 1 threads: 1
- name: Assert Results - name: Assert Results
shell: bash
run: | run: |
if [ "${CODEQL_RAM}" != "230" ]; then if [ "${CODEQL_RAM}" != "230" ]; then
echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230" echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230"

86
.github/workflows/__global-proxy.yml generated vendored
View File

@@ -1,86 +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 - Proxy test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
global-proxy:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
name: Proxy test
if: github.triggering_actor != 'dependabot[bot]'
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
# These steps are required to initialise the `gh` cli in a container that doesn't
# come pre-installed with it. The reason for that is that this is later
# needed by the `prepare-test` workflow to find the latest release of CodeQL.
- name: Set up GitHub CLI
run: |
apt update
apt install -y curl libreadline8 gnupg2 software-properties-common zstd
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
apt-key add /usr/share/keyrings/githubcli-archive-keyring.gpg
apt-add-repository https://cli.github.com/packages
apt install -y gh
env: {}
- name: Check out repository
uses: actions/checkout@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'false'
- uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
env:
https_proxy: http://squid-proxy:3128
CODEQL_ACTION_TEST_MODE: true
container:
image: ubuntu:22.04
services:
squid-proxy:
image: ubuntu/squid:latest
ports:
- 3128:3128

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: Custom queries' name: 'PR Check - Go: Custom queries'
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-custom-queries: go-custom-queries:
strategy: strategy:
@@ -61,7 +32,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: 'Go: Custom queries' name: 'Go: Custom queries'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -69,7 +39,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -77,21 +47,16 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} go-version: '>=1.21.0'
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
config-file: ./.github/codeql/custom-queries.yml config-file: ./.github/codeql/custom-queries.yml
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: diagnostic when Go is changed after init step' name: 'PR Check - Go: diagnostic when Go is changed after init step'
@@ -20,26 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs:
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' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-indirect-tracing-workaround-diagnostic: go-indirect-tracing-workaround-diagnostic:
strategy: strategy:
@@ -49,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
name: 'Go: diagnostic when Go is changed after init step' name: 'Go: diagnostic when Go is changed after init step'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -57,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -65,27 +45,27 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} # We need a Go version that ships with statically linked binaries on Linux
cache: false go-version: '>=1.21.0'
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
# Deliberately change Go after the `init` step # Deliberately change Go after the `init` step
- uses: actions/setup-go@v6 - uses: actions/setup-go@v5
with: with:
go-version: '1.20' go-version: '1.20'
- name: Build code - name: Build code
shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check diagnostic appears in SARIF - name: Check diagnostic appears in SARIF
uses: actions/github-script@v8 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/go.sarif SARIF_PATH: ${{ runner.temp }}/results/go.sarif
with: with:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: diagnostic when `file` is not installed' name: 'PR Check - Go: diagnostic when `file` is not installed'
@@ -20,26 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs:
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' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-indirect-tracing-workaround-no-file-program: go-indirect-tracing-workaround-no-file-program:
strategy: strategy:
@@ -49,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
name: 'Go: diagnostic when `file` is not installed' name: 'Go: diagnostic when `file` is not installed'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -57,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -65,11 +45,10 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} # We need a Go version that ships with statically linked binaries on Linux
cache: false go-version: '>=1.21.0'
- name: Remove `file` program - name: Remove `file` program
run: | run: |
echo $(which file) echo $(which file)
@@ -80,13 +59,14 @@ jobs:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check diagnostic appears in SARIF - name: Check diagnostic appears in SARIF
uses: actions/github-script@v8 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/go.sarif SARIF_PATH: ${{ runner.temp }}/results/go.sarif
with: with:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: workaround for indirect tracing' name: 'PR Check - Go: workaround for indirect tracing'
@@ -20,26 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs:
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' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-indirect-tracing-workaround: go-indirect-tracing-workaround:
strategy: strategy:
@@ -49,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
name: 'Go: workaround for indirect tracing' name: 'Go: workaround for indirect tracing'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -57,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -65,19 +45,20 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} # We need a Go version that ships with statically linked binaries on Linux
cache: false go-version: '>=1.21.0'
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
- run: | - shell: bash
run: |
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \ echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
"CODEQL_ACTION_GO_BINARY environment variable is not set." "CODEQL_ACTION_GO_BINARY environment variable is not set."

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: tracing with autobuilder step' name: 'PR Check - Go: tracing with autobuilder step'
@@ -20,32 +20,21 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs:
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' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-tracing-autobuilder: go-tracing-autobuilder:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-v2.15.5
- os: macos-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.16.6
- os: macos-latest
version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-v2.17.6
- os: macos-latest - os: macos-latest
@@ -58,18 +47,6 @@ jobs:
version: stable-v2.19.4 version: stable-v2.19.4
- os: macos-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.19.4
- os: ubuntu-latest
version: stable-v2.20.7
- os: macos-latest
version: stable-v2.20.7
- os: ubuntu-latest
version: stable-v2.21.4
- os: macos-latest
version: stable-v2.21.4
- os: ubuntu-latest
version: stable-v2.22.4
- os: macos-latest
version: stable-v2.22.4
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
@@ -83,7 +60,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'Go: tracing with autobuilder step' name: 'Go: tracing with autobuilder step'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -91,7 +67,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -99,10 +75,11 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} go-version: ~1.24.0
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
@@ -110,7 +87,8 @@ jobs:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
- run: | - shell: bash
run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
echo "Expected the Go autobuilder to be run, but the" \ echo "Expected the Go autobuilder to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true." "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true."

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: tracing with custom build steps' name: 'PR Check - Go: tracing with custom build steps'
@@ -20,32 +20,21 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs:
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' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-tracing-custom-build-steps: go-tracing-custom-build-steps:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-v2.15.5
- os: macos-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.16.6
- os: macos-latest
version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-v2.17.6
- os: macos-latest - os: macos-latest
@@ -58,18 +47,6 @@ jobs:
version: stable-v2.19.4 version: stable-v2.19.4
- os: macos-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.19.4
- os: ubuntu-latest
version: stable-v2.20.7
- os: macos-latest
version: stable-v2.20.7
- os: ubuntu-latest
version: stable-v2.21.4
- os: macos-latest
version: stable-v2.21.4
- os: ubuntu-latest
version: stable-v2.22.4
- os: macos-latest
version: stable-v2.22.4
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
@@ -83,7 +60,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'Go: tracing with custom build steps' name: 'Go: tracing with custom build steps'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -91,7 +67,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -99,19 +75,22 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} go-version: ~1.24.0
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
- run: | - shell: bash
run: |
# Once we start running Bash 4.2 in all environments, we can replace the # Once we start running Bash 4.2 in all environments, we can replace the
# `! -z` flag with the more elegant `-v` which confirms that the variable # `! -z` flag with the more elegant `-v` which confirms that the variable
# is actually unset and not potentially set to a blank value. # is actually unset and not potentially set to a blank value.

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Go: tracing with legacy workflow' name: 'PR Check - Go: tracing with legacy workflow'
@@ -20,32 +20,21 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
workflow_call:
inputs:
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' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
go-tracing-legacy-workflow: go-tracing-legacy-workflow:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-v2.15.5
- os: macos-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.16.6
- os: macos-latest
version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-v2.17.6
- os: macos-latest - os: macos-latest
@@ -58,18 +47,6 @@ jobs:
version: stable-v2.19.4 version: stable-v2.19.4
- os: macos-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.19.4
- os: ubuntu-latest
version: stable-v2.20.7
- os: macos-latest
version: stable-v2.20.7
- os: ubuntu-latest
version: stable-v2.21.4
- os: macos-latest
version: stable-v2.21.4
- os: ubuntu-latest
version: stable-v2.22.4
- os: macos-latest
version: stable-v2.22.4
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
@@ -83,7 +60,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'Go: tracing with legacy workflow' name: 'Go: tracing with legacy workflow'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -91,7 +67,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -99,17 +75,19 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} go-version: ~1.24.0
# to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
- run: | - shell: bash
run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then if [[ ! -d go ]]; then
echo "Did not find a Go database" echo "Did not find a Go database"

80
.github/workflows/__go.yml generated vendored
View File

@@ -1,80 +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: Manual Check - go
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
workflow_dispatch:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
jobs:
go-custom-queries:
name: 'Go: Custom queries'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-custom-queries.yml
with:
go-version: ${{ inputs.go-version }}
dotnet-version: ${{ inputs.dotnet-version }}
go-indirect-tracing-workaround-diagnostic:
name: 'Go: diagnostic when Go is changed after init step'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
with:
go-version: ${{ inputs.go-version }}
go-indirect-tracing-workaround-no-file-program:
name: 'Go: diagnostic when `file` is not installed'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml
with:
go-version: ${{ inputs.go-version }}
go-indirect-tracing-workaround:
name: 'Go: workaround for indirect tracing'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-indirect-tracing-workaround.yml
with:
go-version: ${{ inputs.go-version }}
go-tracing-autobuilder:
name: 'Go: tracing with autobuilder step'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-tracing-autobuilder.yml
with:
go-version: ${{ inputs.go-version }}
go-tracing-custom-build-steps:
name: 'Go: tracing with custom build steps'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-tracing-custom-build-steps.yml
with:
go-version: ${{ inputs.go-version }}
go-tracing-legacy-workflow:
name: 'Go: tracing with legacy workflow'
permissions:
contents: read
security-events: read
uses: ./.github/workflows/__go-tracing-legacy-workflow.yml
with:
go-version: ${{ inputs.go-version }}

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Packaging: Download using registries' name: 'PR Check - Packaging: Download using registries'
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
init-with-registries: init-with-registries:
strategy: strategy:
@@ -38,12 +29,23 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: 'Packaging: Download using registries' name: 'Packaging: Download using registries'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
packages: read packages: read
@@ -52,7 +54,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -73,6 +75,7 @@ jobs:
token: "${{ secrets.GITHUB_TOKEN }}" token: "${{ secrets.GITHUB_TOKEN }}"
- name: Verify packages installed - name: Verify packages installed
shell: bash
run: | run: |
PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack" PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack"
CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1" CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1"
@@ -94,6 +97,7 @@ jobs:
fi fi
- name: Verify qlconfig.yml file was created - name: Verify qlconfig.yml file was created
shell: bash
run: | run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH" echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH"
@@ -106,6 +110,9 @@ jobs:
fi fi
- name: Verify contents of qlconfig.yml - name: Verify contents of qlconfig.yml
# yq is not available on windows
if: runner.os != 'Windows'
shell: bash
run: | run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")' cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")'

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Custom source root name: PR Check - Custom source root
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
javascript-source-root: javascript-source-root:
strategy: strategy:
@@ -43,7 +34,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Custom source root name: Custom source root
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -51,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -60,6 +50,7 @@ jobs:
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Move codeql-action - name: Move codeql-action
shell: bash
run: | run: |
mkdir ../new-source-root mkdir ../new-source-root
mv * ../new-source-root mv * ../new-source-root
@@ -72,6 +63,7 @@ jobs:
with: with:
skip-queries: true skip-queries: true
- name: Assert database exists - name: Assert database exists
shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d javascript ]]; then if [[ ! -d javascript ]]; then

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Job run UUID added to SARIF name: PR Check - Job run UUID added to SARIF
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
job-run-uuid-sarif: job-run-uuid-sarif:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Job run UUID added to SARIF name: Job run UUID added to SARIF
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -64,12 +54,13 @@ jobs:
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v4
with: with:
name: ${{ matrix.os }}-${{ matrix.version }}.sarif.json name: ${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check results - name: Check results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
actual=$(jq -r '.runs[0].properties.jobRunUuid' javascript.sarif) actual=$(jq -r '.runs[0].properties.jobRunUuid' javascript.sarif)

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Language aliases name: PR Check - Language aliases
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
language-aliases: language-aliases:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
name: Language aliases name: Language aliases
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

115
.github/workflows/__local-bundle.yml generated vendored
View File

@@ -1,115 +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 - Local CodeQL bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
local-bundle:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
name: Local CodeQL bundle
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@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- name: Fetch latest CodeQL bundle
run: |
wget https://github.com/github/codeql-action/releases/latest/download/codeql-bundle-linux64.tar.zst
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ./codeql-bundle-linux64.tar.zst
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Multi-language repository name: PR Check - Multi-language repository
@@ -20,52 +20,21 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
multi-language-autodetect: multi-language-autodetect:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: macos-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.15.5
- os: macos-latest
version: stable-v2.16.6
- os: ubuntu-latest
version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: stable-v2.17.6 version: stable-v2.17.6
- os: ubuntu-latest - os: ubuntu-latest
@@ -78,18 +47,6 @@ jobs:
version: stable-v2.19.4 version: stable-v2.19.4
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.19.4 version: stable-v2.19.4
- os: macos-latest
version: stable-v2.20.7
- os: ubuntu-latest
version: stable-v2.20.7
- os: macos-latest
version: stable-v2.21.4
- os: ubuntu-latest
version: stable-v2.21.4
- os: macos-latest
version: stable-v2.22.4
- os: ubuntu-latest
version: stable-v2.22.4
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
@@ -103,7 +60,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Multi-language repository name: Multi-language repository
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -111,7 +67,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -119,23 +75,9 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go - uses: actions/setup-go@v5
uses: actions/setup-go@v6
with: with:
go-version: ${{ inputs.go-version || '>=1.21.0' }} go-version: '>=1.21.0'
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- name: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init - uses: ./../action/init
id: init id: init
@@ -145,7 +87,13 @@ jobs:
|| '' }} || '' }}
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS'
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
@@ -154,6 +102,7 @@ jobs:
upload-database: false upload-database: false
- name: Check language autodetect for all languages excluding Swift - name: Check language autodetect for all languages excluding Swift
shell: bash
run: | run: |
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
@@ -193,6 +142,7 @@ jobs:
- name: Check language autodetect for Swift on macOS - name: Check language autodetect for Swift on macOS
if: runner.os == 'macOS' if: runner.os == 'macOS'
shell: bash
run: | run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
@@ -200,5 +150,4 @@ jobs:
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,78 +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 - Overlay database init fallback
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
overlay-init-fallback:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
name: Overlay database init fallback
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@v6
- 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: actions # Any language without overlay support will do
tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
CODEQL_OVERLAY_DATABASE_MODE: overlay-base
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
- name: Check database
run: |
cd "$RUNNER_TEMP/codeql_databases/actions"
if ! grep -q 'overlayBaseDatabase: false' codeql-database.yml ; then
echo "This test needs to be updated to use a non-overlay language."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Packaging: Config and input passed to the CLI' name: 'PR Check - Packaging: Config and input passed to the CLI'
@@ -20,46 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
packaging-codescanning-config-inputs-js: packaging-codescanning-config-inputs-js:
strategy: strategy:
@@ -68,12 +29,23 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: 'Packaging: Config and input passed to the CLI' name: 'Packaging: Config and input passed to the CLI'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -81,14 +53,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -96,20 +61,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging3.yml config-file: .github/codeql/codeql-config-packaging3.yml
@@ -117,6 +68,7 @@ jobs:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
@@ -132,6 +84,7 @@ jobs:
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Packaging: Config and input' name: 'PR Check - Packaging: Config and input'
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
packaging-config-inputs-js: packaging-config-inputs-js:
strategy: strategy:
@@ -58,12 +29,23 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: 'Packaging: Config and input' name: 'Packaging: Config and input'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -71,14 +53,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -86,15 +61,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging3.yml config-file: .github/codeql/codeql-config-packaging3.yml
@@ -102,6 +68,7 @@ jobs:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
@@ -117,6 +84,7 @@ jobs:
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Packaging: Config file' name: 'PR Check - Packaging: Config file'
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
packaging-config-js: packaging-config-js:
strategy: strategy:
@@ -58,12 +29,23 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: 'Packaging: Config file' name: 'Packaging: Config file'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -71,14 +53,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -86,21 +61,13 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging.yml config-file: .github/codeql/codeql-config-packaging.yml
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
@@ -116,6 +83,7 @@ jobs:
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: 'PR Check - Packaging: Action input' name: 'PR Check - Packaging: Action input'
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
packaging-inputs-js: packaging-inputs-js:
strategy: strategy:
@@ -58,12 +29,23 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: 'Packaging: Action input' name: 'Packaging: Action input'
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -71,14 +53,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -86,15 +61,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging2.yml config-file: .github/codeql/codeql-config-packaging2.yml
@@ -102,6 +68,7 @@ jobs:
packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2, codeql-testing/codeql-pack3:other-query.ql packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2, codeql-testing/codeql-pack3:other-query.ql
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
@@ -116,6 +83,7 @@ jobs:
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules

View File

@@ -1,148 +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 - Quality queries input
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
quality-queries:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
analysis-kinds: code-scanning
- os: ubuntu-latest
version: linked
analysis-kinds: code-quality
- os: ubuntu-latest
version: linked
analysis-kinds: code-scanning,code-quality
- os: ubuntu-latest
version: nightly-latest
analysis-kinds: code-scanning
- os: ubuntu-latest
version: nightly-latest
analysis-kinds: code-quality
- os: ubuntu-latest
version: nightly-latest
analysis-kinds: code-scanning,code-quality
name: Quality queries input
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@v6
- 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: javascript
analysis-kinds: ${{ matrix.analysis-kinds }}
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
post-processed-sarif-path: ${{ runner.temp }}/post-processed
- name: Upload security SARIF
if: contains(matrix.analysis-kinds, 'code-scanning')
uses: actions/upload-artifact@v5
with:
name: |
quality-queries-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.analysis-kinds }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Upload quality SARIF
if: contains(matrix.analysis-kinds, 'code-quality')
uses: actions/upload-artifact@v5
with:
name: |
quality-queries-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.analysis-kinds }}.quality.sarif.json
path: ${{ runner.temp }}/results/javascript.quality.sarif
retention-days: 7
- name: Upload post-processed SARIF
uses: actions/upload-artifact@v5
with:
name: |
post-processed-${{ matrix.os }}-${{ matrix.version }}-${{ matrix.analysis-kinds }}.sarif.json
path: ${{ runner.temp }}/post-processed
retention-days: 7
if-no-files-found: error
- name: Check quality query does not appear in security SARIF
if: contains(matrix.analysis-kinds, 'code-scanning')
uses: actions/github-script@v8
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
EXPECT_PRESENT: 'false'
with:
script: ${{ env.CHECK_SCRIPT }}
- name: Check quality query appears in quality SARIF
if: contains(matrix.analysis-kinds, 'code-quality')
uses: actions/github-script@v8
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.quality.sarif
EXPECT_PRESENT: 'true'
with:
script: ${{ env.CHECK_SCRIPT }}
env:
CHECK_SCRIPT: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const expectPresent = JSON.parse(process.env['EXPECT_PRESENT']);
const run = sarif.runs[0];
const extensions = run.tool.extensions;
if (extensions === undefined) {
core.setFailed('`extensions` property not found in the SARIF run property bag.');
}
// ID of a query we want to check the presence for
const targetId = 'js/regex/always-matches';
const found = extensions.find(extension => extension.rules && extension.rules.find(rule => rule.id === targetId));
if (found && expectPresent) {
console.log(`Found rule with id '${targetId}'.`);
} else if (!found && !expectPresent) {
console.log(`Rule with id '${targetId}' was not found.`);
} else {
core.setFailed(`${ found ? "Found" : "Didn't find" } rule ${targetId}`);
}
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Remote config file name: PR Check - Remote config file
@@ -20,46 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
remote-config: remote-config:
strategy: strategy:
@@ -71,7 +32,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Remote config file name: Remote config file
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -79,7 +39,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -87,20 +47,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
@@ -108,6 +54,7 @@ jobs:
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }} github.sha }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Resolve environment name: PR Check - Resolve environment
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
resolve-environment-action: resolve-environment-action:
strategy: strategy:
@@ -38,12 +29,23 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: Resolve environment name: Resolve environment
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -51,7 +53,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - RuboCop multi-language name: PR Check - RuboCop multi-language
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
rubocop-multi-language: rubocop-multi-language:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
name: RuboCop multi-language name: RuboCop multi-language
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -56,14 +46,17 @@ jobs:
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Set up Ruby - name: Set up Ruby
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0 uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # v1.221.0
with: with:
ruby-version: 2.6 ruby-version: 2.6
- name: Install Code Scanning integration - name: Install Code Scanning integration
shell: bash
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
- name: Install dependencies - name: Install dependencies
shell: bash
run: bundle install run: bundle install
- name: RuboCop run - name: RuboCop run
shell: bash
run: | run: |
bash -c " bash -c "
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif

17
.github/workflows/__ruby.yml generated vendored
View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Ruby analysis name: PR Check - Ruby analysis
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
ruby: ruby:
strategy: strategy:
@@ -49,7 +40,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Ruby analysis name: Ruby analysis
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -57,7 +47,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -74,6 +64,7 @@ jobs:
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash
run: | run: |
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}" RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
if [[ ! -d "$RUBY_DB" ]]; then if [[ ! -d "$RUBY_DB" ]]; then

23
.github/workflows/__rust.yml generated vendored
View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Rust analysis name: PR Check - Rust analysis
@@ -20,26 +20,13 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
rust: rust:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-v2.19.3
- os: ubuntu-latest
version: stable-v2.22.1
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: ubuntu-latest - os: ubuntu-latest
@@ -47,7 +34,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Rust analysis name: Rust analysis
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -55,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -67,11 +53,14 @@ jobs:
with: with:
languages: rust languages: rust
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
CODEQL_ACTION_RUST_ANALYSIS: true
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash
run: | run: |
RUST_DB="${{ fromJson(steps.analysis.outputs.db-locations).rust }}" RUST_DB="${{ fromJson(steps.analysis.outputs.db-locations).rust }}"
if [[ ! -d "$RUST_DB" ]]; then if [[ ! -d "$RUST_DB" ]]; then

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Split workflow name: PR Check - Split workflow
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
split-workflow: split-workflow:
strategy: strategy:
@@ -69,7 +40,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Split workflow name: Split workflow
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -77,7 +47,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -85,15 +55,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging3.yml config-file: .github/codeql/codeql-config-packaging3.yml
@@ -101,6 +62,7 @@ jobs:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
@@ -109,6 +71,7 @@ jobs:
upload-database: false upload-database: false
- name: Assert No Results - name: Assert No Results
shell: bash
run: | run: |
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
echo "Expected results directory to be empty after skipping query execution!" echo "Expected results directory to be empty after skipping query execution!"
@@ -119,6 +82,7 @@ jobs:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Assert Results - name: Assert Results
shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules

16
.github/workflows/__start-proxy.yml generated vendored
View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Start proxy name: PR Check - Start proxy
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
start-proxy: start-proxy:
strategy: strategy:
@@ -43,7 +34,6 @@ jobs:
- os: windows-latest - os: windows-latest
version: linked version: linked
name: Start proxy name: Start proxy
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -51,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Submit SARIF after failure name: PR Check - Submit SARIF after failure
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
submit-sarif-failure: submit-sarif-failure:
strategy: strategy:
@@ -43,7 +34,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Submit SARIF after failure name: Submit SARIF after failure
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: write # needed to upload the SARIF file security-events: write # needed to upload the SARIF file
@@ -52,7 +42,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -60,7 +50,7 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: ./init - uses: ./init
with: with:
languages: javascript languages: javascript

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Swift analysis using autobuild name: PR Check - Swift analysis using autobuild
@@ -20,16 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
swift-autobuild: swift-autobuild:
strategy: strategy:
@@ -39,7 +30,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Swift analysis using autobuild name: Swift analysis using autobuild
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -47,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -61,7 +51,11 @@ jobs:
languages: swift languages: swift
build-mode: autobuild build-mode: autobuild
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{steps.init.outputs.codeql-path}}
- name: Check working directory - name: Check working directory
shell: bash
run: pwd run: pwd
- uses: ./../action/autobuild - uses: ./../action/autobuild
timeout-minutes: 30 timeout-minutes: 30
@@ -70,6 +64,7 @@ jobs:
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash
run: | run: |
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
if [[ ! -d "$SWIFT_DB" ]]; then if [[ ! -d "$SWIFT_DB" ]]; then

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Swift analysis using a custom build command name: PR Check - Swift analysis using a custom build command
@@ -20,36 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
swift-custom-build: swift-custom-build:
strategy: strategy:
@@ -63,7 +34,6 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Swift analysis using a custom build command name: Swift analysis using a custom build command
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -71,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -79,32 +49,26 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- name: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
languages: swift languages: swift
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{steps.init.outputs.codeql-path}}
- name: Check working directory - name: Check working directory
shell: bash
run: pwd run: pwd
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash
run: | run: |
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
if [[ ! -d "$SWIFT_DB" ]]; then if [[ ! -d "$SWIFT_DB" ]]; then

72
.github/workflows/__test-autobuild-working-dir.yml generated vendored Normal file
View File

@@ -0,0 +1,72 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Autobuild working directory
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
test-autobuild-working-dir:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
name: Autobuild working directory
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Test setup
shell: bash
run: |
# Make sure that Gradle build succeeds in autobuild-dir ...
cp -a ../action/tests/java-repo autobuild-dir
# ... and fails if attempted in the current directory
echo > build.gradle
- uses: ./../action/init
with:
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
- uses: ./../action/analyze
- name: Check database
shell: bash
run: |
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d java ]]; then
echo "Did not find a Java database"
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

65
.github/workflows/__test-local-codeql.yml generated vendored Normal file
View File

@@ -0,0 +1,65 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Local CodeQL bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
test-local-codeql:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: nightly-latest
name: Local CodeQL bundle
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Fetch a CodeQL bundle
shell: bash
env:
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
run: |
wget "$CODEQL_URL"
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ./codeql-bundle-linux64.tar.zst
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
env:
CODEQL_ACTION_TEST_MODE: true

76
.github/workflows/__test-proxy.yml generated vendored Normal file
View File

@@ -0,0 +1,76 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Proxy test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
test-proxy:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
name: Proxy test
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
# These steps are required to initialise the `gh` cli in a container that doesn't
# come pre-installed with it. The reason for that is that this is later
# needed by the `prepare-test` workflow to find the latest release of CodeQL.
- name: Set up GitHub CLI
run: |
apt update
apt install -y curl libreadline8 gnupg2 software-properties-common zstd
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
apt-key add /usr/share/keyrings/githubcli-archive-keyring.gpg
apt-add-repository https://cli.github.com/packages
apt install -y gh
env: {}
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'false'
- uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
env:
https_proxy: http://squid-proxy:3128
CODEQL_ACTION_TEST_MODE: true
container:
image: ubuntu:22.04
services:
squid-proxy:
image: ubuntu/squid:latest
ports:
- 3128:3128

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Test unsetting environment variables name: PR Check - Test unsetting environment variables
@@ -20,46 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
unset-environment: unset-environment:
strategy: strategy:
@@ -71,7 +32,6 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Test unsetting environment variables name: Test unsetting environment variables
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -79,7 +39,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -87,20 +47,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
@@ -108,13 +54,18 @@ jobs:
# Swift is not supported on Ubuntu so we manually exclude it from the list here # Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
- name: Build code - name: Build code
shell: bash
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh run: env -i PATH="$PATH" HOME="$HOME" ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- run: | - shell: bash
run: |
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then
echo "::error::Did not create a database for CPP, or created it in the wrong location." \ echo "::error::Did not create a database for CPP, or created it in the wrong location." \

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: "PR Check - Upload-sarif: 'ref' and 'sha' from inputs" name: "PR Check - Upload-sarif: 'ref' and 'sha' from inputs"
@@ -20,46 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
upload-ref-sha-input: upload-ref-sha-input:
strategy: strategy:
@@ -68,8 +29,11 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
name: "Upload-sarif: 'ref' and 'sha' from inputs" name: "Upload-sarif: 'ref' and 'sha' from inputs"
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -77,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -85,20 +49,6 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
@@ -106,6 +56,7 @@ jobs:
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }} github.sha }}
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
# Generate some SARIF we can upload with the upload-sarif step # Generate some SARIF we can upload with the upload-sarif step
- uses: ./../action/analyze - uses: ./../action/analyze

187
.github/workflows/__upload-sarif.yml generated vendored
View File

@@ -1,187 +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 - Test different uses of `upload-sarif`
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
upload-sarif:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: default
analysis-kinds: code-scanning
- os: ubuntu-latest
version: default
analysis-kinds: code-quality
- os: ubuntu-latest
version: default
analysis-kinds: code-scanning,code-quality
name: Test different uses of `upload-sarif`
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@v6
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: csharp,java,javascript,python
analysis-kinds: ${{ matrix.analysis-kinds }}
- name: Build code
run: ./build.sh
# Generate some SARIF we can upload with the upload-sarif step
- uses: ./../action/analyze
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
upload: never
output: ${{ runner.temp }}/results
- name: |
Upload all SARIF files for `analysis-kinds: ${{ matrix.analysis-kinds }}`
uses: ./../action/upload-sarif
id: upload-sarif
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
sarif_file: ${{ runner.temp }}/results
category: |
${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:all-files/
- name: Fail for missing output from `upload-sarif` step for `code-scanning`
if: contains(matrix.analysis-kinds, 'code-scanning') && !(fromJSON(steps.upload-sarif.outputs.sarif-ids).code-scanning)
run: exit 1
- name: Fail for missing output from `upload-sarif` step for `code-quality`
if: contains(matrix.analysis-kinds, 'code-quality') && !(fromJSON(steps.upload-sarif.outputs.sarif-ids).code-quality)
run: exit 1
- name: Upload single SARIF file for Code Scanning
uses: ./../action/upload-sarif
id: upload-single-sarif-code-scanning
if: contains(matrix.analysis-kinds, 'code-scanning')
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
sarif_file: ${{ runner.temp }}/results/javascript.sarif
category: |
${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:single-code-scanning/
- name: Fail for missing output from `upload-single-sarif-code-scanning` step
if: contains(matrix.analysis-kinds, 'code-scanning') &&
!(fromJSON(steps.upload-single-sarif-code-scanning.outputs.sarif-ids).code-scanning)
run: exit 1
- name: Upload single SARIF file for Code Quality
uses: ./../action/upload-sarif
id: upload-single-sarif-code-quality
if: contains(matrix.analysis-kinds, 'code-quality')
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
sarif_file: ${{ runner.temp }}/results/javascript.quality.sarif
category: |
${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:single-code-quality/
- name: Fail for missing output from `upload-single-sarif-code-quality` step
if: contains(matrix.analysis-kinds, 'code-quality') &&
!(fromJSON(steps.upload-single-sarif-code-quality.outputs.sarif-ids).code-quality)
run: exit 1
- name: Change SARIF file extension
if: contains(matrix.analysis-kinds, 'code-scanning')
run: mv ${{ runner.temp }}/results/javascript.sarif ${{ runner.temp }}/results/javascript.sarif.json
- name: Upload single non-`.sarif` file
uses: ./../action/upload-sarif
id: upload-single-non-sarif
if: contains(matrix.analysis-kinds, 'code-scanning')
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
sarif_file: ${{ runner.temp }}/results/javascript.sarif.json
category: |
${{ github.workflow }}:upload-sarif/analysis-kinds:${{ matrix.analysis-kinds }}/os:${{ matrix.os }}/version:${{ matrix.version }}/test:non-sarif/
- name: Fail for missing output from `upload-single-non-sarif` step
if: contains(matrix.analysis-kinds, 'code-scanning') && !(fromJSON(steps.upload-single-non-sarif.outputs.sarif-ids).code-scanning)
run: exit 1
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified. # Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run: # Instead, please modify the template in the pr-checks directory and run:
# pr-checks/sync.sh # (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file. # to regenerate this file.
name: PR Check - Use a custom `checkout_path` name: PR Check - Use a custom `checkout_path`
@@ -20,46 +20,7 @@ on:
- ready_for_review - ready_for_review
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: workflow_dispatch: {}
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
workflow_call:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
python-version:
type: string
description: The version of Python to install
required: false
default: '3.13'
dotnet-version:
type: string
description: The version of .NET to install
required: false
default: 9.x
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
with-checkout-path: with-checkout-path:
strategy: strategy:
@@ -68,8 +29,11 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
name: Use a custom `checkout_path` name: Use a custom `checkout_path`
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: read
@@ -77,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -85,21 +49,8 @@ jobs:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
setup-kotlin: 'true' setup-kotlin: 'true'
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version || '>=1.21.0' }}
cache: false
- name: Install Python
if: matrix.version != 'nightly-latest'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version || '3.13' }}
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ inputs.dotnet-version || '9.x' }}
- name: Delete original checkout - name: Delete original checkout
shell: bash
run: | run: |
# delete the original checkout so we don't accidentally use it. # delete the original checkout so we don't accidentally use it.
# Actions does not support deleting the current working directory, so we # Actions does not support deleting the current working directory, so we
@@ -107,7 +58,7 @@ jobs:
rm -rf ./* .github .git rm -rf ./* .github .git
# Check out the actions repo again, but at a different location. # Check out the actions repo again, but at a different location.
# choose an arbitrary SHA so that we can later test that the commit_oid is not from main # choose an arbitrary SHA so that we can later test that the commit_oid is not from main
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
path: x/y/z/some-path path: x/y/z/some-path
@@ -120,6 +71,7 @@ jobs:
source-root: x/y/z/some-path/tests/multi-language-repo source-root: x/y/z/some-path/tests/multi-language-repo
- name: Build code - name: Build code
shell: bash
working-directory: x/y/z/some-path/tests/multi-language-repo working-directory: x/y/z/some-path/tests/multi-language-repo
run: | run: |
./build.sh ./build.sh
@@ -131,31 +83,31 @@ jobs:
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
- name: Verify SARIF after upload - name: Verify SARIF after upload
shell: bash
run: | run: |
PAYLOAD_FILE="$RUNNER_TEMP/payload-code-scanning.json"
EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6" EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6"
EXPECTED_REF="v1.1.0" EXPECTED_REF="v1.1.0"
EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo" EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo"
ACTUAL_COMMIT_OID="$(cat "$PAYLOAD_FILE" | jq -r .commit_oid)" ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)"
ACTUAL_REF="$(cat "$PAYLOAD_FILE" | jq -r .ref)" ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)"
ACTUAL_CHECKOUT_URI="$(cat "$PAYLOAD_FILE" | jq -r .checkout_uri)" ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)"
if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then
echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID" echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID"
echo "$PAYLOAD_FILE" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then
echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'" echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'"
echo "$PAYLOAD_FILE" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
if [[ "$ACTUAL_CHECKOUT_URI" != *$EXPECTED_CHECKOUT_URI_SUFFIX ]]; then if [[ "$ACTUAL_CHECKOUT_URI" != *$EXPECTED_CHECKOUT_URI_SUFFIX ]]; then
echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI" echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI"
echo "$PAYLOAD_FILE" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
env: env:

110
.github/workflows/__zstd-bundle-streaming.yml generated vendored Normal file
View File

@@ -0,0 +1,110 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Zstandard bundle (streaming)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
zstd-bundle-streaming:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
name: Zstandard bundle (streaming)
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
if (codeqlPath !== undefined) {
fs.rmdirSync(codeqlPath, { recursive: true });
}
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-zstd-bundle.sarif
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostic with expected tools URL appears in SARIF
uses: actions/github-script@v7
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const downloadTelemetryNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'codeql-action/bundle-download-telemetry'
);
if (downloadTelemetryNotifications.length !== 1) {
core.setFailed(
'Expected exactly one reporting descriptor in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${downloadTelemetryNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
const toolsUrl = downloadTelemetryNotifications[0].properties.attributes.toolsUrl;
console.log(`Found tools URL: ${toolsUrl}`);
if (!toolsUrl.endsWith('.tar.zst')) {
core.setFailed(
`Expected the tools URL to be a .tar.zst file, but found ${toolsUrl}.`
);
}
env:
CODEQL_ACTION_ZSTD_BUNDLE: true
CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION: true
CODEQL_ACTION_TEST_MODE: true

113
.github/workflows/__zstd-bundle.yml generated vendored Normal file
View File

@@ -0,0 +1,113 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Zstandard bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
zstd-bundle:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: windows-latest
version: linked
name: Zstandard bundle
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
if (codeqlPath !== undefined) {
fs.rmdirSync(codeqlPath, { recursive: true });
}
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-zstd-bundle.sarif
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostic with expected tools URL appears in SARIF
uses: actions/github-script@v7
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const downloadTelemetryNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'codeql-action/bundle-download-telemetry'
);
if (downloadTelemetryNotifications.length !== 1) {
core.setFailed(
'Expected exactly one reporting descriptor in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${downloadTelemetryNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
const toolsUrl = downloadTelemetryNotifications[0].properties.attributes.toolsUrl;
console.log(`Found tools URL: ${toolsUrl}`);
const expectedExtension = process.env['RUNNER_OS'] === 'Windows' ? '.tar.gz' : '.tar.zst';
if (!toolsUrl.endsWith(expectedExtension)) {
core.setFailed(
`Expected the tools URL to be a ${expectedExtension} file, but found ${toolsUrl}.`
);
}
env:
CODEQL_ACTION_ZSTD_BUNDLE: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -9,20 +9,16 @@ on:
# by other workflows. # by other workflows.
types: [opened, synchronize, reopened, ready_for_review] types: [opened, synchronize, reopened, ready_for_review]
defaults:
run:
shell: bash
jobs: jobs:
check-expected-release-files: check-expected-release-files:
runs-on: ubuntu-slim runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
steps: steps:
- name: Checkout CodeQL Action - name: Checkout CodeQL Action
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Check Expected Release Files - name: Check Expected Release Files
run: | run: |
bundle_version="$(cat "./src/defaults.json" | jq -r ".bundleVersion")" bundle_version="$(cat "./src/defaults.json" | jq -r ".bundleVersion")"

View File

@@ -4,6 +4,7 @@ on:
push: push:
branches: [main, releases/v*] branches: [main, releases/v*]
pull_request: pull_request:
branches: [main, releases/v*]
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened # Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
# by other workflows. # by other workflows.
types: [opened, synchronize, reopened, ready_for_review] types: [opened, synchronize, reopened, ready_for_review]
@@ -12,17 +13,12 @@ on:
- cron: '30 1 * * 0' - cron: '30 1 * * 0'
workflow_dispatch: workflow_dispatch:
defaults:
run:
shell: bash
env: env:
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
jobs: jobs:
# Identify the CodeQL tool versions to use in the analysis job. # Identify the CodeQL tool versions to use in the analysis job.
check-codeql-versions: check-codeql-versions:
if: github.triggering_actor != 'dependabot[bot]'
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
versions: ${{ steps.compare.outputs.versions }} versions: ${{ steps.compare.outputs.versions }}
@@ -31,7 +27,7 @@ jobs:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Init with default CodeQL bundle from the VM image - name: Init with default CodeQL bundle from the VM image
id: init-default id: init-default
uses: ./init uses: ./init
@@ -75,12 +71,11 @@ jobs:
echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT
analyze-javascript: analyze-javascript:
if: github.triggering_actor != 'dependabot[bot]'
needs: [check-codeql-versions] needs: [check-codeql-versions]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-22.04,ubuntu-24.04,windows-2022,windows-2025,macos-14,macos-15] os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-13,macos-14]
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }} tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -90,36 +85,28 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Initialize CodeQL - name: Initialize CodeQL
uses: ./init uses: ./init
id: init id: init
with: with:
languages: javascript languages: javascript
config-file: ./.github/codeql/codeql-config-javascript.yml config-file: ./.github/codeql/codeql-config.yml
tools: ${{ matrix.tools }} tools: ${{ matrix.tools }}
# confirm steps.init.outputs.codeql-path points to the codeql binary # confirm steps.init.outputs.codeql-path points to the codeql binary
- name: Print CodeQL Version - name: Print CodeQL Version
run: > run: ${{steps.init.outputs.codeql-path}} version --format=json
"$CODEQL" version --format=json
env:
CODEQL: ${{steps.init.outputs.codeql-path}}
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: ./analyze uses: ./analyze
with: with:
category: "/language:javascript" category: "/language:javascript"
upload: ${{ (matrix.os == 'ubuntu-24.04' && !matrix.tools && 'always') || 'never' }}
analyze-other:
if: github.triggering_actor != 'dependabot[bot]' analyze-actions:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix:
include:
- language: actions
- language: python
permissions: permissions:
contents: read contents: read
@@ -127,19 +114,13 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Initialize CodeQL - name: Initialize CodeQL
uses: ./init uses: ./init
with: with:
languages: ${{ matrix.language }} languages: actions
build-mode: none config-file: ./.github/codeql/codeql-actions-config.yml
config: >
paths-ignore:
- lib
- tests
queries:
- uses: security-and-quality
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: ./analyze uses: ./analyze
with: with:
category: "/language:${{ matrix.language }}" category: "/language:actions"

View File

@@ -3,9 +3,6 @@
name: Code-Scanning config CLI tests name: Code-Scanning config CLI tests
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Diff informed queries add an additional query filter which is not yet
# taken into account by these tests.
CODEQL_ACTION_DIFF_INFORMED_QUERIES: false
on: on:
push: push:
@@ -22,13 +19,8 @@ on:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
defaults:
run:
shell: bash
jobs: jobs:
code-scanning-config-tests: code-scanning-config-tests:
if: github.triggering_actor != 'dependabot[bot]'
continue-on-error: true continue-on-error: true
permissions: permissions:
@@ -42,10 +34,16 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: linked
- os: macos-latest
version: linked
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest
version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest
version: nightly-latest
# Code-Scanning config not created because environment variable is not set # Code-Scanning config not created because environment variable is not set
name: Code Scanning Configuration tests name: Code Scanning Configuration tests
@@ -53,50 +51,20 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
# On PRs, overlay analysis may change the config that is passed to the CLI. - name: Empty file
# Therefore, we have two variants of the following test, one for PRs and one for other events.
- name: Empty file (non-PR)
if: github.event_name != 'pull_request'
uses: ./../action/.github/actions/check-codescanning-config uses: ./../action/.github/actions/check-codescanning-config
with: with:
expected-config-file-contents: "{}" expected-config-file-contents: "{}"
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Empty file (PR)
if: github.event_name == 'pull_request'
uses: ./../action/.github/actions/check-codescanning-config
with:
expected-config-file-contents: |
{
"query-filters": [
{
"exclude": {
"tags": "exclude-from-incremental"
}
}
]
}
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Packs from input - name: Packs from input
if: success() || failure() if: success() || failure()
uses: ./../action/.github/actions/check-codescanning-config uses: ./../action/.github/actions/check-codescanning-config
@@ -195,13 +163,13 @@ jobs:
with: with:
expected-config-file-contents: | expected-config-file-contents: |
{ {
"queries": [
{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" },
{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }
],
"packs": { "packs": {
"javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2", "codeql/javascript-queries" ] "javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2", "codeql/javascript-queries" ]
}, }
"queries": [
{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" },
{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" }
]
} }
languages: javascript languages: javascript
queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql

View File

@@ -17,14 +17,8 @@ on:
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
defaults:
run:
shell: bash
jobs: jobs:
upload-artifacts: upload-artifacts:
if: github.triggering_actor != 'dependabot[bot]'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -45,19 +39,15 @@ jobs:
- name: Dump GitHub event - name: Dump GitHub event
run: cat "${GITHUB_EVENT_PATH}" run: cat "${GITHUB_EVENT_PATH}"
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
- uses: actions/setup-go@v6 - uses: actions/setup-go@v5
with: with:
go-version: ^1.13.1 go-version: ^1.13.1
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.x'
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
@@ -65,6 +55,7 @@ jobs:
debug-artifact-name: my-debug-artifacts debug-artifact-name: my-debug-artifacts
debug-database-name: my-db debug-database-name: my-db
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
@@ -75,7 +66,6 @@ jobs:
expect-error: true expect-error: true
download-and-check-artifacts: download-and-check-artifacts:
name: Download and check debug artifacts after failure in analyze name: Download and check debug artifacts after failure in analyze
if: github.triggering_actor != 'dependabot[bot]'
needs: upload-artifacts needs: upload-artifacts
timeout-minutes: 45 timeout-minutes: 45
permissions: permissions:
@@ -83,8 +73,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v6 uses: actions/download-artifact@v4
- name: Check expected artifacts exist - name: Check expected artifacts exist
shell: bash
run: | run: |
LANGUAGES="cpp csharp go java javascript python" LANGUAGES="cpp csharp go java javascript python"
for version in $VERSIONS; do for version in $VERSIONS; do

View File

@@ -16,14 +16,8 @@ on:
schedule: schedule:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
defaults:
run:
shell: bash
jobs: jobs:
upload-artifacts: upload-artifacts:
if: github.triggering_actor != 'dependabot[bot]'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -41,19 +35,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
- uses: actions/setup-go@v6 - uses: actions/setup-go@v5
with: with:
go-version: ^1.13.1 go-version: ^1.13.1
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.x'
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
@@ -64,12 +54,12 @@ jobs:
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu # We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby languages: cpp,csharp,go,java,javascript,python,ruby
- name: Build code - name: Build code
shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
download-and-check-artifacts: download-and-check-artifacts:
name: Download and check debug artifacts name: Download and check debug artifacts
if: github.triggering_actor != 'dependabot[bot]'
needs: upload-artifacts needs: upload-artifacts
timeout-minutes: 45 timeout-minutes: 45
permissions: permissions:
@@ -77,8 +67,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v6 uses: actions/download-artifact@v4
- name: Check expected artifacts exist - name: Check expected artifacts exist
shell: bash
run: | run: |
VERSIONS="stable-v2.20.3 default linked nightly-latest" VERSIONS="stable-v2.20.3 default linked nightly-latest"
LANGUAGES="cpp csharp go java javascript python" LANGUAGES="cpp csharp go java javascript python"

View File

@@ -0,0 +1,49 @@
name: Check queries that ran
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
expected-queries:
name: Expected Queries Tests
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45
runs-on: ubuntu-latest
permissions:
contents: read
security-events: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: linked
- uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
- name: Check Sarif
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run: js/incomplete-hostname-regexp,js/path-injection
queries-not-run: foo,bar

View File

@@ -1,26 +0,0 @@
name: Label PR with size
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
- ready_for_review
permissions:
contents: read
pull-requests: write
jobs:
sizeup:
name: Label PR with size
runs-on: ubuntu-slim
steps:
- name: Run sizeup
uses: lerebear/sizeup-action@b7beb3dd273e36039e16e48e7bc690c189e61951 # 0.8.12
with:
token: "${{ secrets.GITHUB_TOKEN }}"
configuration-file-path: ".github/sizeup.yml"

View File

@@ -3,7 +3,7 @@
# tag # tag
# 2. Updates the `vN` tag to refer to this merge commit. # 2. Updates the `vN` tag to refer to this merge commit.
# 3. Iff vN == vLatest, merges any changes from the release back into the main branch. # 3. Iff vN == vLatest, merges any changes from the release back into the main branch.
# Typically, this is two commits one to update the version number and one to rebuild. # Typically, this is two commits one to update the version number and one to update dependencies.
name: Tag release and merge back name: Tag release and merge back
on: on:
@@ -18,13 +18,9 @@ on:
branches: branches:
- releases/v* - releases/v*
defaults:
run:
shell: bash
jobs: jobs:
merge-back: merge-back:
runs-on: ubuntu-slim runs-on: ubuntu-latest
environment: Automation environment: Automation
if: github.repository == 'github/codeql-action' if: github.repository == 'github/codeql-action'
env: env:
@@ -44,13 +40,10 @@ jobs:
GITHUB_CONTEXT: '${{ toJson(github) }}' GITHUB_CONTEXT: '${{ toJson(github) }}'
run: echo "${GITHUB_CONTEXT}" run: echo "${GITHUB_CONTEXT}"
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 # ensure we have all tags and can push commits fetch-depth: 0 # ensure we have all tags and can push commits
- uses: actions/setup-node@v6 - uses: actions/setup-node@v4
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Update git config - name: Update git config
run: | run: |
@@ -131,25 +124,57 @@ jobs:
cat $PARTIAL_CHANGELOG cat $PARTIAL_CHANGELOG
echo "::endgroup::" echo "::endgroup::"
- name: Create mergeback branch and PR - name: Create mergeback branch
if: ${{ steps.check.outputs.exists != 'true' && endsWith(github.ref_name, steps.getVersion.outputs.latest_release_branch) }} if: ${{ steps.check.outputs.exists != 'true' && endsWith(github.ref_name, steps.getVersion.outputs.latest_release_branch) }}
uses: ./.github/actions/prepare-mergeback-branch env:
with: VERSION: "${{ steps.getVersion.outputs.version }}"
base: "${{ env.BASE_BRANCH }}" NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}"
head: "${{ env.HEAD_BRANCH }}" GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
branch: "${{ steps.getVersion.outputs.newBranch }}" run: |
version: "${{ steps.getVersion.outputs.version }}" set -exu
token: "${{ secrets.GITHUB_TOKEN }}" pr_title="Mergeback ${VERSION} ${HEAD_BRANCH} into ${BASE_BRANCH}"
pr_body=$(cat << EOF
This PR bumps the version number and updates the changelog after the ${VERSION} release.
Please do the following:
- [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.
- [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.
- [ ] Mark the PR as ready for review to trigger the full set of PR checks.
- [ ] Approve and merge the PR. When merging the PR, make sure "Create a merge commit" is
selected rather than "Squash and merge" or "Rebase and merge".
EOF
)
# Update the version number ready for the next release
npm version patch --no-git-tag-version
# Update the changelog, adding a new version heading directly above the most recent existing one
awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md
git add .
git commit -m "Update changelog and version after ${VERSION}"
git push origin "${NEW_BRANCH}"
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft
# so that a maintainer can take the PR out of draft, thereby triggering the PR checks.
gh pr create \
--head "${NEW_BRANCH}" \
--base "${BASE_BRANCH}" \
--title "${pr_title}" \
--label "Update dependencies" \
--body "${pr_body}" \
--assignee "${GITHUB_ACTOR}" \
--draft
- name: Generate token - name: Generate token
uses: actions/create-github-app-token@v2.2.0 uses: actions/create-github-app-token@v1.11.6
id: app-token id: app-token
with: with:
app-id: ${{ vars.AUTOMATION_APP_ID }} app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Create the GitHub release - name: Create the GitHub release
if: steps.check.outputs.exists != 'true'
env: env:
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md" PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
VERSION: "${{ steps.getVersion.outputs.version }}" VERSION: "${{ steps.getVersion.outputs.version }}"

View File

@@ -8,79 +8,99 @@ on:
types: [opened, synchronize, reopened, ready_for_review] types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch: workflow_dispatch:
defaults:
run:
shell: bash
jobs: jobs:
unit-tests: check-js:
name: Unit Tests name: Check JS
if: github.triggering_actor != 'dependabot[bot]' runs-on: ubuntu-latest
strategy: timeout-minutes: 45
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20, 24]
permissions: permissions:
contents: read contents: read
security-events: write # needed to upload ESLint results security-events: write # needed to upload ESLint results
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint
id: lint
run: npm run-script lint-ci
- name: Upload sarif
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: eslint.sarif
category: eslint
- name: Check generated JS
run: .github/workflows/script/check-js.sh
check-node-modules:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check modules up to date
permissions:
contents: read
runs-on: macos-latest
timeout-minutes: 45 timeout-minutes: 45
steps: steps:
- name: Prepare git (Windows) - uses: actions/checkout@v4
if: runner.os == 'Windows' - name: Check node modules up to date
run: git config --global core.autocrlf false run: .github/workflows/script/check-node-modules.sh
- uses: actions/checkout@v6 check-file-contents:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check file contents
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 45
- name: Set up Node.js steps:
uses: actions/setup-node@v6 - name: Checkout
with: uses: actions/checkout@v4
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v5
with: with:
python-version: 3.11 python-version: 3.11
- name: Install dependencies - name: Install dependencies
run: | run: |
# Use the system Bash shell to ensure we can run commands like `npm ci` python -m pip install --upgrade pip
# that are not available in the default shell on Windows. # When updating this, update the autogenerated code header in `sync.py` too.
npm config set script-shell bash pip install ruamel.yaml==0.17.31
npm ci
- name: Verify compiled JS up to date
run: .github/workflows/script/check-js.sh
# Ensure the generated PR check workflows are up to date.
- name: Verify PR checks up to date - name: Verify PR checks up to date
if: always()
run: .github/workflows/script/verify-pr-checks.sh run: .github/workflows/script/verify-pr-checks.sh
- name: Run unit tests npm-test:
if: always() if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
run: npm test name: Unit Test
needs: [check-js, check-node-modules]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
permissions:
contents: read
runs-on: ${{ matrix.os }}
timeout-minutes: 45
- name: Run pr-checks tests steps:
if: always() - uses: actions/checkout@v4
working-directory: pr-checks - name: npm test
run: python -m unittest discover run: |
# Run any commands referenced in package.json using Bash, otherwise
- name: Lint # we won't be able to find them on Windows.
if: always() && matrix.os != 'windows-latest' npm config set script-shell bash
run: npm run lint-ci npm test
- name: Upload sarif
uses: github/codeql-action/upload-sarif@v4
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 24
with:
sarif_file: eslint.sarif
category: eslint
check-node-version: check-node-version:
if: github.event.pull_request && github.triggering_actor != 'dependabot[bot]' if: github.event.pull_request
name: Check Action Node versions name: Check Action Node versions
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 45
@@ -91,7 +111,7 @@ jobs:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- id: head-version - id: head-version
name: Verify all Actions use the same Node version name: Verify all Actions use the same Node version
run: | run: |
@@ -106,7 +126,7 @@ jobs:
- id: checkout-base - id: checkout-base
name: 'Backport: Check out base ref' name: 'Backport: Check out base ref'
if: ${{ startsWith(github.head_ref, 'backport-') }} if: ${{ startsWith(github.head_ref, 'backport-') }}
uses: actions/checkout@v6 uses: actions/checkout@v4
with: with:
ref: ${{ env.BASE_REF }} ref: ${{ env.BASE_REF }}

View File

@@ -1,77 +0,0 @@
name: Prepare release
on:
workflow_call:
outputs:
version:
description: "The version that is being released."
value: ${{ jobs.prepare.outputs.version }}
major_version:
description: "The major version of the release."
value: ${{ jobs.prepare.outputs.major_version }}
latest_tag:
description: "The most recent, existing release tag."
value: ${{ jobs.prepare.outputs.latest_tag }}
backport_source_branch:
description: "The release branch for the given tag."
value: ${{ jobs.prepare.outputs.backport_source_branch }}
backport_target_branches:
description: "JSON encoded list of branches to target with backports."
value: ${{ jobs.prepare.outputs.backport_target_branches }}
push:
paths:
- .github/workflows/prepare-release.yml
defaults:
run:
shell: bash
jobs:
prepare:
name: "Prepare release"
runs-on: ubuntu-slim
if: github.repository == 'github/codeql-action'
permissions:
contents: read
outputs:
version: ${{ steps.versions.outputs.version }}
major_version: ${{ steps.versions.outputs.major_version }}
latest_tag: ${{ steps.versions.outputs.latest_tag }}
backport_source_branch: ${{ steps.branches.outputs.backport_source_branch }}
backport_target_branches: ${{ steps.branches.outputs.backport_target_branches }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Need full history for calculation of diffs
- name: Configure runner for release
uses: ./.github/actions/release-initialise
- name: Get version tags
id: versions
run: |
VERSION="v$(jq '.version' -r 'package.json')"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
MAJOR_VERSION=$(cut -d '.' -f1 <<< "${VERSION}")
echo "major_version=${MAJOR_VERSION}" >> $GITHUB_OUTPUT
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
echo "latest_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
- name: Determine older release branches
id: branches
uses: ./.github/actions/release-branches
with:
major_version: ${{ steps.versions.outputs.major_version }}
latest_tag: ${{ steps.versions.outputs.latest_tag }}
- name: Print release information
run: |
echo 'version: ${{ steps.versions.outputs.version }}'
echo 'major_version: ${{ steps.versions.outputs.major_version }}'
echo 'latest_tag: ${{ steps.versions.outputs.latest_tag }}'
echo 'backport_source_branch: ${{ steps.branches.outputs.backport_source_branch }}'
echo 'backport_target_branches: ${{ steps.branches.outputs.backport_target_branches }}'

View File

@@ -1,27 +1,35 @@
name: 'Publish Immutable Action Version' name: 'Publish Immutable Action Version'
on: on:
push: release:
tags: types: [published]
# Match version tags, but not the major version tags.
- 'v[0-9]+.**'
defaults:
run:
shell: bash
jobs: jobs:
publish: publish:
runs-on: ubuntu-slim runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
id-token: write id-token: write
packages: write packages: write
steps: steps:
- name: Checkout repository - name: Check release name
uses: actions/checkout@v6 id: check
env:
- name: Publish immutable release RELEASE_NAME: ${{ github.event.release.name }}
run: |
echo "Release name: ${{ github.event.release.name }}"
if [[ $RELEASE_NAME == v* ]]; then
echo "This is a CodeQL Action release. Create an Immutable Action"
echo "is-action-release=true" >> $GITHUB_OUTPUT
else
echo "This is a CodeQL Bundle release. Do not create an Immutable Action"
echo "is-action-release=false" >> $GITHUB_OUTPUT
fi
- name: Checking out
if: steps.check.outputs.is-action-release == 'true'
uses: actions/checkout@v4
- name: Publish
if: steps.check.outputs.is-action-release == 'true'
id: publish id: publish
uses: actions/publish-immutable-action@v0.0.4 uses: actions/publish-immutable-action@v0.0.4

View File

@@ -12,13 +12,8 @@ on:
- cron: '0 0 * * 1' - cron: '0 0 * * 1'
workflow_dispatch: workflow_dispatch:
defaults:
run:
shell: bash
jobs: jobs:
test-setup-python-scripts: test-setup-python-scripts:
if: github.triggering_actor != 'dependabot[bot]'
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45 timeout-minutes: 45
@@ -27,11 +22,11 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/setup-python@v6 - uses: actions/setup-python@v5
with: with:
python-version: 3.12 python-version: 3.12
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -15,31 +15,16 @@ on:
- cron: '0 5 * * *' - cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
defaults:
run:
shell: bash
jobs: jobs:
query-filters: query-filters:
name: Query Filters Tests name: Query Filters Tests
if: github.triggering_actor != 'dependabot[bot]'
timeout-minutes: 45 timeout-minutes: 45
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read # This permission is needed to allow the GitHub Actions workflow to read the contents of the repository. contents: read # This permission is needed to allow the GitHub Actions workflow to read the contents of the repository.
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test

View File

@@ -5,32 +5,22 @@ on:
types: [labeled] types: [labeled]
workflow_dispatch: workflow_dispatch:
defaults:
run:
shell: bash
jobs: jobs:
rebuild: rebuild:
name: Rebuild Action name: Rebuild Action
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.label.name == 'Rebuild' || github.event_name == 'workflow_dispatch' if: github.event.label.name == 'Rebuild'
env:
HEAD_REF: ${{ github.event.pull_request.head.ref || github.event.ref }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref || 'main' }}
permissions: permissions:
contents: write # needed to push rebuilt commit contents: write # needed to push rebuilt commit
pull-requests: write # needed to comment on the PR pull-requests: write # needed to comment on the PR
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
with: with:
fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }}
ref: ${{ env.HEAD_REF }}
- name: Remove label - name: Remove label
if: github.event_name == 'pull_request'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
@@ -38,103 +28,55 @@ jobs:
gh pr edit --repo github/codeql-action "$PR_NUMBER" \ gh pr edit --repo github/codeql-action "$PR_NUMBER" \
--remove-label "Rebuild" --remove-label "Rebuild"
- name: Configure git
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Merge in changes from base branch - name: Merge in changes from base branch
id: merge env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: | run: |
git fetch origin "$BASE_BRANCH" git fetch origin "$BASE_BRANCH"
# Allow merge conflicts in `lib`, since rebuilding should resolve them. # Allow merge conflicts in `lib`, since rebuilding should resolve them.
git merge "origin/$BASE_BRANCH" || echo "Merge conflicts detected, continuing." git merge "origin/$BASE_BRANCH" || echo "Merge conflicts detected"
MERGE_RESULT=$?
if [ "$MERGE_RESULT" -ne 0 ]; then # Check for merge conflicts outside of `lib`. Disable git diff's trailing whitespace check
echo "merge-in-progress=true" >> $GITHUB_OUTPUT # since `node_modules/@types/semver/README.md` fails it.
if git -c core.whitespace=-trailing-space diff --check | grep --invert-match '^lib/'; then
# Check for merge conflicts outside of `lib`. Disable git diff's trailing whitespace check echo "Merge conflicts detected outside of lib/ directory. Please resolve them manually."
# since `node_modules/@types/semver/README.md` fails it. git -c core.whitespace=-trailing-space diff --check | grep --invert-match '^lib/' || true
if git -c core.whitespace=-trailing-space diff --check | grep --invert-match '^lib/'; then exit 1
echo "Merge conflicts were detected outside of the lib directory. Please resolve them manually."
git -c core.whitespace=-trailing-space diff --check | grep --invert-match '^lib/' || true
exit 1
fi
echo "No merge conflicts found outside the lib directory. We should be able to resolve all of" \
"these by rebuilding the Action."
fi fi
- name: Compile TypeScript - name: Compile TypeScript
run: | run: |
npm ci npm install
npm run lint -- --fix npm run lint -- --fix
npm run build npm run build
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v5
with: with:
python-version: 3.11 python-version: 3.11
- name: Sync back version updates to generated workflows
# Only sync back versions on Dependabot update PRs
if: startsWith(env.HEAD_REF, 'dependabot/')
working-directory: pr-checks
run: |
python3 sync_back.py -v
- name: Generate workflows - name: Generate workflows
working-directory: pr-checks
run: | run: |
cd pr-checks
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install ruamel.yaml==0.17.31 pip install ruamel.yaml==0.17.31
python3 sync.py python3 sync.py
- name: "Merge in progress: Finish merge and push" - name: Check for changes and push
if: steps.merge.outputs.merge-in-progress == 'true'
run: |
echo "Finishing merge and pushing changes."
git add --all
git commit --no-edit
git push
- name: "No merge in progress: Check for changes and push"
if: steps.merge.outputs.merge-in-progress != 'true'
id: push
run: |
if [ ! -z "$(git status --porcelain)" ]; then
echo "Changes detected, committing and pushing."
git add --all
# If the merge originally had conflicts, finish the merge.
# Otherwise, just commit the changes.
if git rev-parse --verify MERGE_HEAD >/dev/null 2>&1; then
echo "In progress merge detected, finishing it up."
git merge --continue
else
echo "No in-progress merge detected, committing changes."
git commit -m "Rebuild"
fi
echo "Pushing changes"
git push
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "No changes detected, nothing to commit."
fi
- name: Notify about rebuild
if: >-
github.event_name == 'pull_request' &&
(
steps.merge.outputs.merge-in-progress == 'true' ||
steps.push.outputs.changes == 'true'
)
env: env:
BRANCH: ${{ github.event.pull_request.head.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
run: | run: |
echo "Pushed a commit to rebuild the Action." \ if [ ! -z "$(git status --porcelain)" ]; then
"Please mark the PR as ready for review to trigger PR checks." | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER" git config --global user.name "github-actions[bot]"
gh pr ready --undo --repo github/codeql-action "$PR_NUMBER" git add --all
git commit -m "Rebuild"
git push origin "HEAD:$BRANCH"
echo "Pushed a commit to rebuild the Action." \
"Please mark the PR as ready for review to trigger PR checks." |
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER"
gh pr ready --undo --repo github/codeql-action "$PR_NUMBER"
fi

View File

@@ -1,186 +0,0 @@
name: Rollback release
on:
# You can trigger this workflow via workflow dispatch to start a rollback.
# This will create a draft release that mirrors the release for `rollback-tag`.
workflow_dispatch:
inputs:
rollback-tag:
type: string
description: "The tag of an old release to roll-back to."
required: true
# Only for dry-runs of changes to the workflow.
push:
# Don't run dry-run on release branches, to avoid an issue where the
# "new" tag determined by the "Prepare release" job already exists.
branches-ignore:
- releases/v*
paths:
- .github/workflows/rollback-release.yml
- .github/actions/prepare-mergeback-branch/**
defaults:
run:
shell: bash
jobs:
prepare:
name: "Prepare release"
if: github.repository == 'github/codeql-action'
permissions:
contents: read
uses: ./.github/workflows/prepare-release.yml
rollback:
name: "Create rollback release"
if: github.repository == 'github/codeql-action'
runs-on: ubuntu-latest
timeout-minutes: 45
# Don't set the deployment environment for test runs
# The Actions token does not have permissions to push changes to workflow files.
# Since workflow files may change as part of a backport PR, we use the "Automation" environment for real runs to authenticate as a GitHub App and push these changes.
environment: ${{ github.event_name == 'workflow_dispatch' && 'Automation' || '' }}
needs:
- prepare
permissions:
contents: write # needed to push to the repo (tags and releases)
pull-requests: write # needed to create the mergeback PR
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Need full history for calculation of diffs
- name: Configure runner for release
uses: ./.github/actions/release-initialise
- name: Create tag for testing
if: github.event_name != 'workflow_dispatch'
run: git tag v0.0.0
# We start by preparing the mergeback branch, mainly so that we have the updated changelog
# readily available for the partial changelog that's needed for the release.
- name: Prepare mergeback branch
id: mergeback-branch
env:
BASE_BRANCH: ${{ (github.event_name == 'workflow_dispatch' && 'main') || github.ref_name }}
VERSION: ${{ needs.prepare.outputs.version }}
run: |
set -x
# Checkout the base branch, since we may be testing on a different branch
git checkout "$BASE_BRANCH"
# Generate a new branch name for the mergeback PR
short_sha="${GITHUB_SHA:0:8}"
NEW_BRANCH="mergeback/${VERSION}-to-${BASE_BRANCH}-${short_sha}"
echo "new-branch=${NEW_BRANCH}" >> $GITHUB_OUTPUT
# Create the mergeback branch
git checkout -b "${NEW_BRANCH}"
- name: Prepare rollback changelog
env:
NEW_CHANGELOG: "${{ runner.temp }}/new_changelog.md"
# We usually expect to checkout `inputs.rollback-tag` (required for `workflow_dispatch`),
# but use `v0.0.0` for testing.
ROLLBACK_TAG: ${{ inputs.rollback-tag || 'v0.0.0' }}
LATEST_TAG: ${{ needs.prepare.outputs.latest_tag }}
VERSION: "${{ needs.prepare.outputs.version }}"
run: |
python .github/workflows/script/rollback_changelog.py \
--target-version "${ROLLBACK_TAG:1}" \
--rollback-version "${LATEST_TAG:1}" \
--new-version "$VERSION" > $NEW_CHANGELOG
echo "::group::New CHANGELOG"
cat $NEW_CHANGELOG
echo "::endgroup::"
- name: Create tags
env:
# We usually expect to checkout `inputs.rollback-tag` (required for `workflow_dispatch`),
# but use `v0.0.0` for testing.
ROLLBACK_TAG: ${{ inputs.rollback-tag || 'v0.0.0' }}
RELEASE_TAG: ${{ needs.prepare.outputs.version }}
MAJOR_VERSION_TAG: ${{ needs.prepare.outputs.major_version }}
run: |
git checkout "refs/tags/${ROLLBACK_TAG}"
git tag --annotate "${RELEASE_TAG}" --message "${RELEASE_TAG}"
git tag --annotate "${MAJOR_VERSION_TAG}" --message "${MAJOR_VERSION_TAG}" --force
- name: Push tags
# skip when testing
if: github.event_name == 'workflow_dispatch'
env:
RELEASE_TAG: ${{ needs.prepare.outputs.version }}
MAJOR_VERSION_TAG: ${{ needs.prepare.outputs.major_version }}
run: |
git push origin --atomic --force refs/tags/"${RELEASE_TAG}" refs/tags/"${MAJOR_VERSION_TAG}"
- name: Prepare partial Changelog
env:
NEW_CHANGELOG: "${{ runner.temp }}/new_changelog.md"
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
VERSION: "${{ needs.prepare.outputs.version }}"
run: |
python .github/workflows/script/prepare_changelog.py $NEW_CHANGELOG "$VERSION" > $PARTIAL_CHANGELOG
echo "::group::Partial CHANGELOG"
cat $PARTIAL_CHANGELOG
echo "::endgroup::"
- name: Generate token
if: github.event_name == 'workflow_dispatch'
uses: actions/create-github-app-token@v2.2.0
id: app-token
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Create the rollback release
if: github.event_name == 'workflow_dispatch'
env:
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
VERSION: "${{ needs.prepare.outputs.version }}"
GH_TOKEN: ${{ steps.app-token.outputs.token }}
RELEASE_URL: "${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ needs.prepare.outputs.version }}"
run: |
set -exu
# Do not mark this release as latest. The most recent bundle release must be marked as latest.
# Set as a draft to give us an opportunity to review the rollback release.
gh release create \
"$VERSION" \
--latest=false \
--draft \
--title "$VERSION" \
--notes-file "$PARTIAL_CHANGELOG"
echo "Created draft rollback release at $RELEASE_URL" >> $GITHUB_STEP_SUMMARY
- name: Update changelog
env:
NEW_CHANGELOG: "${{ runner.temp }}/new_changelog.md"
NEW_BRANCH: "${{ steps.mergeback-branch.outputs.new-branch }}"
run: |
git checkout "${NEW_BRANCH}"
mv ${NEW_CHANGELOG} CHANGELOG.md
- name: Create mergeback branch and PR
uses: ./.github/actions/prepare-mergeback-branch
with:
base: "main"
head: ""
branch: "${{ steps.mergeback-branch.outputs.new-branch }}"
version: "${{ needs.prepare.outputs.version }}"
token: "${{ secrets.GITHUB_TOKEN }}"
# Setting this to `true` for non-workflow_dispatch events will
# still push the `branch`, but won't create a corresponding PR
dry-run: "${{ github.event_name != 'workflow_dispatch' }}"

View File

@@ -1,18 +0,0 @@
import os
import re
# Get the PR number from the PR URL.
pr_number = os.environ['PR_URL'].split('/')[-1]
changelog_note = f"- Update default CodeQL bundle version to {os.environ['CLI_VERSION']}. [#{pr_number}]({os.environ['PR_URL']})"
# If the "[UNRELEASED]" section starts with "no user facing changes", remove that line.
with open('CHANGELOG.md', 'r') as f:
changelog = f.read()
changelog = changelog.replace('## [UNRELEASED]\n\nNo user facing changes.', '## [UNRELEASED]\n')
# Add the changelog note to the bottom of the "[UNRELEASED]" section.
changelog = re.sub(r'\n## (\d+\.\d+\.\d+)', f'{changelog_note}\n\n## \\1', changelog, count=1)
with open('CHANGELOG.md', 'w') as f:
f.write(changelog)

View File

@@ -16,18 +16,6 @@ if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention # If we get a fail here then the PR needs attention
>&2 echo "Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update" >&2 echo "Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update"
git status git status
echo "### Transpiled JS diff" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
git diff --output="$RUNNER_TEMP/js.diff"
cat "$RUNNER_TEMP/js.diff" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
# Reset bundled files to allow other checks to test for changes
git checkout lib
# Fail this check
exit 1 exit 1
fi fi
echo "Success: JavaScript files are up to date" echo "Success: JavaScript files are up to date"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -eu
# Sanity check that repo is clean to start with
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then this workflow needs attention...
>&2 echo "Failed: Repo should be clean before testing!"
exit 1
fi
"$(dirname "$0")/update-node-modules.sh" check-only
# Check that repo is still clean
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention
>&2 echo "Failed: node_modules are not up to date. Add the 'Update dependencies' label to your PR to update them. Note it is important that node modules are updated on macOS and not any other operating system as there is one dependency (fsevents) that is needed for macOS and may not be installed if dependencies are updated on a Windows or Linux machine."
git status
exit 1
fi
echo "Success: node_modules are up to date"

View File

@@ -12,7 +12,7 @@ def extract_changelog_snippet(changelog_file, version_tag):
output = EMPTY_CHANGELOG output = EMPTY_CHANGELOG
else: else:
with open(changelog_file, 'r') as f: with open('CHANGELOG.md', 'r') as f:
lines = f.readlines() lines = f.readlines()
# Include everything up to, but excluding the second heading # Include everything up to, but excluding the second heading

View File

@@ -1,62 +0,0 @@
import datetime
import os
import argparse
EMPTY_CHANGELOG = """# CodeQL Action Changelog
"""
def get_today_string():
today = datetime.datetime.today()
return '{:%d %b %Y}'.format(today)
# Include everything up to and after the first heading,
# but not the first heading and body.
def drop_unreleased_section(lines: list[str]):
before_first_section = ''
after_first_section = ''
found_first_section = False
skipped_first_section = False
for i, line in enumerate(lines):
if line.startswith('## ') and not found_first_section:
found_first_section = True
elif line.startswith('## ') and found_first_section:
skipped_first_section = True
if not found_first_section:
before_first_section += line
if skipped_first_section:
after_first_section += line
return (before_first_section, after_first_section)
def update_changelog(target_version, rollback_version, new_version):
before_first_section = EMPTY_CHANGELOG
after_first_section = ''
if (os.path.exists('CHANGELOG.md')):
with open('CHANGELOG.md', 'r') as f:
(before_first_section, after_first_section) = drop_unreleased_section(f.readlines())
newHeader = f'## {new_version} - {get_today_string()}\n'
print(before_first_section, end="")
print(newHeader)
print(f"This release rolls back {rollback_version} due to issues with that release. It is identical to {target_version}.\n")
print(after_first_section)
# We expect three version strings as input:
#
# - target_version: the version that we are re-releasing as `new_version`
# - rollback_version: the version that we are rolling back, typically the one that followed `target_version`
# - new_version: the new version that we are releasing `target_version` as, typically the one that follows `rollback_version`
#
# Example: python3 .github/workflows/script/rollback_changelog.py --target-version "1.2.3" --rollback-version "1.2.4" --new-version "1.2.5"
parser = argparse.ArgumentParser(description="Update CHANGELOG.md for a rollback release.")
parser.add_argument("--target-version", "-t", required=True, help="Version to re-release as new_version.")
parser.add_argument("--rollback-version", "-r", required=True, help="Version being rolled back.")
parser.add_argument("--new-version", "-n", required=True, help="New version to publish for target_version.")
args = parser.parse_args()
update_changelog(args.target_version, args.rollback_version, args.new_version)

View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -eu
if [ "$1" != "update" ] && [ "$1" != "check-only" ]; then
>&2 echo "Failed: Invalid argument. Must be 'update' or 'check-only'"
exit 1
fi
npm install --force -g npm@9.2.0
# clean the npm cache to ensure we don't have any files owned by root
sudo npm cache clean --force
if [ "$1" = "update" ]; then
npm install
fi
# Reinstall modules and then clean to remove absolute paths
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
npm ci
npm run removeNPMAbsolutePaths

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Update the required checks based on the current branch. # Update the required checks based on the current branch.
# Typically, this will be main.
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
REPO_DIR="$(dirname "$SCRIPT_DIR")" REPO_DIR="$(dirname "$SCRIPT_DIR")"
@@ -29,16 +28,10 @@ fi
echo "Getting checks for $GITHUB_SHA" echo "Getting checks for $GITHUB_SHA"
# Ignore any checks with "https://", CodeQL, LGTM, Update, and ESLint checks. # Ignore any checks with "https://", CodeQL, LGTM, Update, and ESLint checks.
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs.[] | select(.conclusion != "skipped") | .name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("ESLint") or contains("update") or contains("test-setup-python-scripts") or . == "Agent" or . == "Cleanup artifacts" or . == "Prepare" or . == "Upload results" | not)] | unique | sort')" CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs.[] | select(.conclusion != "skipped") | .name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("ESLint") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
echo "$CHECKS" | jq echo "$CHECKS" | jq
# Fail if there are no checks
if [ -z "$CHECKS" ] || [ "$(echo "$CHECKS" | jq '. | length')" -eq 0 ]; then
echo "No checks found for $GITHUB_SHA"
exit 1
fi
echo "{\"contexts\": ${CHECKS}}" > checks.json echo "{\"contexts\": ${CHECKS}}" > checks.json
echo "Updating main" echo "Updating main"

Some files were not shown because too many files have changed in this diff Show More