Compare commits

..

70 Commits

Author SHA1 Message Date
Nick Fyson
80eb8d5395 Merge pull request #2159 from github/backport-v2.24.4-e2e140ad1
Merge releases/v3 into releases/v2
2024-02-22 13:47:24 +00:00
Nick Fyson
0ddabac401 manually fix problem with changelog produced by automation 2024-02-22 12:45:43 +00:00
github-actions[bot]
b882b63a68 Update checked-in dependencies 2024-02-22 12:00:01 +00:00
github-actions[bot]
8b0f3e6135 Update version and changelog for v2.24.4 2024-02-22 10:38:34 +00:00
github-actions[bot]
8601b9e70a Merge remote-tracking branch 'origin/releases/v3' into backport-v2.24.4-e2e140ad1 2024-02-22 10:38:31 +00:00
github-actions[bot]
bd94b4c175 Revert "Update checked-in dependencies"
This reverts commit 460939e7d8.
2024-02-22 10:38:31 +00:00
github-actions[bot]
755340a6bd Revert "Update version and changelog for v2.24.3"
This reverts commit 47c8d615ed.
2024-02-22 10:38:31 +00:00
Angela P Wen
4a8f20f6b9 Merge pull request #2150 from github/backport-v2.24.3-379614612
Merge releases/v3 into releases/v2
2024-02-15 05:14:12 -08:00
github-actions[bot]
460939e7d8 Update checked-in dependencies 2024-02-15 12:55:25 +00:00
Angela P Wen
ceebdeb9fa Manually fix changelog notes 2024-02-15 12:53:40 +00:00
github-actions[bot]
47c8d615ed Update version and changelog for v2.24.3 2024-02-15 12:47:29 +00:00
github-actions[bot]
c232c5de9c Merge remote-tracking branch 'origin/releases/v3' into backport-v2.24.3-379614612 2024-02-15 12:47:28 +00:00
github-actions[bot]
2452b7d8af Revert "Update checked-in dependencies"
This reverts commit 4f50fb3be5.
2024-02-15 12:47:28 +00:00
github-actions[bot]
4ffed09d48 Revert "Update version and changelog for v2.24.2"
This reverts commit 02022337ac.
2024-02-15 12:47:27 +00:00
Angela P Wen
8b6a45a6ec Merge pull request #2144 from github/backport-v2.24.2-ece8414c7
Merge releases/v3 into releases/v2
2024-02-15 03:34:09 -08:00
Henry Mercer
2ccdcd5135 Remove duplicate changelog entry 2024-02-15 11:11:50 +00:00
github-actions[bot]
4f50fb3be5 Update checked-in dependencies 2024-02-15 11:10:16 +00:00
Henry Mercer
02022337ac Update version and changelog for v2.24.2 2024-02-15 11:08:37 +00:00
Henry Mercer
3dafabe4d9 Merge remote-tracking branch 'origin/releases/v3' into backport-v2.24.2-ece8414c7 2024-02-15 11:08:04 +00:00
Henry Mercer
40cd785140 Revert "Update checked-in dependencies"
This reverts commit 05d809f630.
2024-02-15 11:07:08 +00:00
Henry Mercer
10746dd61e Revert "Update version and changelog for v2.24.1"
This reverts commit d8c4c3a4eb.
2024-02-15 11:07:08 +00:00
Dave Bartolomeo
1a077f8f6c Merge pull request #2133 from github/backport-v2.24.1-e675ced7a
Merge releases/v3 into releases/v2
2024-02-13 07:50:23 -08:00
github-actions[bot]
05d809f630 Update checked-in dependencies 2024-02-13 15:32:00 +00:00
Henry Mercer
d8c4c3a4eb Update version and changelog for v2.24.1 2024-02-13 15:28:16 +00:00
Henry Mercer
b301568384 Merge remote-tracking branch 'origin/releases/v3' into backport-v2.24.1-e675ced7a 2024-02-13 15:28:12 +00:00
Henry Mercer
f5c8be0ac1 Revert "Update checked-in dependencies"
This reverts commit f822fa3067.
2024-02-13 15:23:47 +00:00
Henry Mercer
4504810aa1 Revert "Update version and changelog for v2.24.0"
This reverts commit 3ed798ed18.
2024-02-13 15:23:47 +00:00
Henry Mercer
dc021d495c Merge pull request #2115 from github/backport-v2.24.0-e8893c57a
Merge releases/v3 into releases/v2
2024-02-02 19:23:13 +00:00
github-actions[bot]
f822fa3067 Update checked-in dependencies 2024-02-02 18:37:21 +00:00
github-actions[bot]
3ed798ed18 Update version and changelog for v2.24.0 2024-02-02 18:32:37 +00:00
github-actions[bot]
5b498ba405 Merge remote-tracking branch 'origin/releases/v3' into backport-v2.24.0-e8893c57a 2024-02-02 18:32:36 +00:00
github-actions[bot]
7dde705407 Revert "Update checked-in dependencies"
This reverts commit c98f2c953c.
2024-02-02 18:32:36 +00:00
github-actions[bot]
c004a3e831 Revert "Update version and changelog for v2.23.2"
This reverts commit 554c990fe8.
2024-02-02 18:32:36 +00:00
Henry Mercer
2f93e4319b Merge pull request #2102 from github/backport-v2.23.2-b7bf0a3ed
Merge releases/v3 into releases/v2
2024-01-26 15:16:55 +00:00
github-actions[bot]
c98f2c953c Update checked-in dependencies 2024-01-26 14:39:53 +00:00
github-actions[bot]
554c990fe8 Update version and changelog for v2.23.2 2024-01-26 14:35:10 +00:00
github-actions[bot]
abe5934e80 Merge remote-tracking branch 'origin/releases/v3' into backport-v2.23.2-b7bf0a3ed 2024-01-26 14:35:04 +00:00
github-actions[bot]
8879ae88d9 Revert "Update checked-in dependencies"
This reverts commit 554005d264.
2024-01-26 14:35:04 +00:00
github-actions[bot]
01e8d7f881 Revert "Update version and changelog for v2.23.1"
This reverts commit fb29452d38.
2024-01-26 14:35:04 +00:00
Henry Mercer
4759df8df7 Merge pull request #2091 from github/backport-v2.23.1-0b21cf249
Merge releases/v3 into releases/v2
2024-01-17 17:39:22 +00:00
github-actions[bot]
554005d264 Update checked-in dependencies 2024-01-17 16:52:17 +00:00
github-actions[bot]
fb29452d38 Update version and changelog for v2.23.1 2024-01-17 16:25:35 +00:00
github-actions[bot]
13884cb7d7 Merge remote-tracking branch 'origin/releases/v3' into backport-v2.23.1-0b21cf249 2024-01-17 16:25:34 +00:00
github-actions[bot]
ac64986f93 Revert "Update checked-in dependencies"
This reverts commit e24bd8fed4.
2024-01-17 16:25:34 +00:00
github-actions[bot]
cdcacf8b4f Revert "Update version and changelog for v2.23.0"
This reverts commit 8f2682add5.
2024-01-17 16:25:34 +00:00
Henry Mercer
8b7fcbfac2 Merge pull request #2069 from github/backport-v2.23.0-e5f05b81d
Merge releases/v3 into releases/v2
2024-01-08 13:43:00 +00:00
github-actions[bot]
e24bd8fed4 Update checked-in dependencies 2024-01-08 13:12:16 +00:00
Henry Mercer
8f2682add5 Update version and changelog for v2.23.0 2024-01-08 13:05:17 +00:00
Henry Mercer
8f5ae1a11a Merge remote-tracking branch 'origin/releases/v3' into backport-v2.23.0-e5f05b81d 2024-01-08 13:04:05 +00:00
Henry Mercer
99d337aef5 Revert "Update checked-in dependencies"
This reverts commit d6286c6fdb.
2024-01-08 13:04:04 +00:00
Henry Mercer
997d889b5d Revert "Update version and changelog for v2.22.12"
This reverts commit 9c74de20cb.
2024-01-08 13:04:04 +00:00
Angela P Wen
1500a13138 Merge pull request #2054 from github/backport-v2.22.12-012739e50
* Bump the npm group with 4 updates

Bumps the npm group with 4 updates: [@octokit/types](https://github.com/octokit/types.ts), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [typescript](https://github.com/Microsoft/TypeScript).


Updates `@octokit/types` from 12.3.0 to 12.4.0
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v12.3.0...v12.4.0)

Updates `@typescript-eslint/eslint-plugin` from 6.13.2 to 6.14.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.14.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.13.2 to 6.14.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.14.0/packages/parser)

Updates `typescript` from 5.3.2 to 5.3.3
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.3.2...v5.3.3)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

* Update changelog and version after v3.22.11

* Update checked-in dependencies

* improve handling of changelog processing for backports

* change version numbers inside processing function as well

* Apply suggestions from code review

Co-authored-by: Henry Mercer <henry.mercer@me.com>

* rename regex for clarity

* preserve trailing whitespace when transforming CHANGELOG

* raise explicit exception if EOF found when looking for changelog sections

* add note on versioning approach to changelog

* Bump the npm group with 2 updates (#2045)

* Bump the npm group with 2 updates

Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import).


Updates `eslint` from 8.55.0 to 8.56.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0)

Updates `eslint-plugin-import` from 2.29.0 to 2.29.1
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* clarify comment on versions in the changelog

* clarify comment on versions in the changelog

* Update default bundle to codeql-bundle-v2.15.5

* Add changelog note

* update required checks script to handle release branches

* add note about backporting check changes to v2 branch

* Fix type error

* Typecast `OLDEST_SUPPORTED_MAJOR_VERSION` when defined

* Update changelog for v3.22.12

* Revert "Update version and changelog for v2.22.11"

This reverts commit e763762131.

* Revert "Update checked-in dependencies"

This reverts commit 20d1a9b175.

* Update version and changelog for v2.22.12

* Update checked-in dependencies

* Resolve conflicts in v3->v2.22.12 merge

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Henry Mercer <henry.mercer@me.com>
Co-authored-by: Nick Fyson <nickfyson@github.com>
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
Co-authored-by: Angela P Wen <angelapwen@github.com>
Co-authored-by: Aditya Sharad <adityasharad@github.com>
2023-12-22 08:39:43 -08:00
Aditya Sharad
0d318c9f1a Resolve conflicts in v3->v2.22.12 merge 2023-12-22 06:58:29 -08:00
github-actions[bot]
d6286c6fdb Update checked-in dependencies 2023-12-22 04:01:00 +00:00
github-actions[bot]
9c74de20cb Update version and changelog for v2.22.12 2023-12-22 00:47:08 +00:00
github-actions[bot]
49a6ae4966 Merge remote-tracking branch 'origin/releases/v3' into backport-v2.22.12-012739e50
# Conflicts:
#	CONTRIBUTING.md
2023-12-22 00:47:04 +00:00
github-actions[bot]
3366e3bbdd Revert "Update checked-in dependencies"
This reverts commit 20d1a9b175.
2023-12-22 00:47:03 +00:00
github-actions[bot]
844fc3cd56 Revert "Update version and changelog for v2.22.11"
This reverts commit e763762131.
2023-12-22 00:47:03 +00:00
Nick Fyson
5a201efe22 Merge pull request #2048 from github/nickfyson/backport-js-checks 2023-12-20 19:21:03 +00:00
nickfyson
c9f92aa25f backport checks changes to v2 branch 2023-12-20 14:23:29 +00:00
Nick Fyson
03e7845b7b Merge pull request #2036 from github/backport-v2.22.11-b374143c1
Merge releases/v3 into releases/v2
2023-12-13 20:40:33 +00:00
github-actions[bot]
54f10077ea Rebuild 2023-12-13 20:11:03 +00:00
github-actions[bot]
20d1a9b175 Update checked-in dependencies 2023-12-13 20:08:43 +00:00
Nick Fyson
c28d79bb2e Update src/codeql.ts
Co-authored-by: Henry Mercer <henry.mercer@me.com>
2023-12-13 20:05:23 +00:00
nickfyson
241e8b42b2 Revert "switch check sarif action to node20"
This reverts commit 0bc194ee69.
2023-12-13 20:05:23 +00:00
nickfyson
8bc67d15e2 Revert "update javascript files"
This reverts commit 3a9f6a89e0.
2023-12-13 20:05:23 +00:00
nickfyson
e106171cbb Revert "reintroduce PR check that confirm action can be still be compiled on node16"
This reverts commit 5b52b36d41.
2023-12-13 20:05:23 +00:00
nickfyson
231f9f1b59 Revert "upgrade node type definitions"
This reverts commit f2d0c2e7ae.
2023-12-13 20:05:23 +00:00
nickfyson
47334bf4e9 Revert "change to node20 for all actions"
This reverts commit d651fbc494.
2023-12-13 20:05:23 +00:00
github-actions[bot]
e763762131 Update version and changelog for v2.22.11 2023-12-13 20:05:18 +00:00
18324 changed files with 2856544 additions and 1101048 deletions

4
.eslintignore Normal file
View File

@@ -0,0 +1,4 @@
**/webpack.config.js
lib/**
src/testdata/**
tests/**

77
.eslintrc.json Normal file
View File

@@ -0,0 +1,77 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "filenames", "github", "import", "no-async-foreach"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:github/recommended",
"plugin:github/typescript",
"plugin:import/typescript"
],
"rules": {
"filenames/match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"],
"i18n-text/no-en": "off",
"import/extensions": ["error", {
// Allow importing JSON files
"json": {}
}],
"import/no-amd": "error",
"import/no-commonjs": "error",
"import/no-cycle": "error",
"import/no-dynamic-require": "error",
// Disable the rule that checks that devDependencies aren't imported since we use a single
// linting configuration file for both source and test code.
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
"import/no-namespace": "off",
"import/no-unresolved": "error",
"import/no-webpack-loader-syntax": "error",
"import/order": ["error", {
"alphabetize": {"order": "asc"},
"newlines-between": "always"
}],
"max-len": ["error", {
"code": 120,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}],
"no-async-foreach/no-async-foreach": "error",
"no-console": "off",
"no-sequences": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"one-var": ["error", "never"]
},
"overrides": [{
// "temporarily downgraded during transition to eslint
"files": "**",
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"func-style": "off",
"sort-imports": "off"
}
}],
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src"]
},
"typescript": {}
}
}
}

View File

@@ -29,16 +29,7 @@ inputs:
tools: tools:
required: true required: true
description: | description: |
The version of CodeQL passed to the `tools` input of the init action. The url of codeql to use.
This can be any of the following:
- A local path to a tarball containing the CodeQL tools, or
- A URL to a GitHub release assets containing the CodeQL tools, or
- A special value `linked` which is forcing the use of the CodeQL tools
that the action has been bundled with.
If not specified, the Action will check in several places until it finds
the CodeQL tools.
runs: runs:
using: composite using: composite
@@ -61,12 +52,11 @@ runs:
- name: Check config - name: Check config
working-directory: ${{ github.action_path }} working-directory: ${{ github.action_path }}
shell: bash shell: bash
env: run: ts-node ./index.ts "${{ runner.temp }}/user-config.yaml" '${{ inputs.expected-config-file-contents }}'
EXPECTED_CONFIG_FILE_CONTENTS: '${{ inputs.expected-config-file-contents }}'
run: ts-node ./index.ts "$RUNNER_TEMP/user-config.yaml" "$EXPECTED_CONFIG_FILE_CONTENTS"
- name: Clean up - name: Clean up
shell: bash shell: bash
if: always() if: always()
run: | run: |
rm -rf $RUNNER_TEMP/codescanning-config-cli-test rm -rf ${{ runner.temp }}/codescanning-config-cli-test
rm -rf $RUNNER_TEMP/user-config.yaml rm -rf ${{ runner.temp }}/user-config.yaml

View File

@@ -6,19 +6,9 @@ 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.info('No expected configuration provided')
} else { } else {
core.startGroup('Expected generated user config') core.startGroup('Expected generated user config')
core.info(yaml.dump(JSON.parse(rawExpectedConfig))) core.info(yaml.dump(JSON.parse(rawExpectedConfig)))
@@ -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: node20 using: node16
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,16 +2,12 @@ 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', 'nightly', 'nightly-latest', 'nightly-YYYYMMDD', or 'stable-vX.Y.Z" description: "The version of the CodeQL CLI to use. Can be 'latest', 'default', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
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"
default: 'false' default: 'false'
required: false required: false
setup-kotlin:
description: "If true, we setup kotlin"
default: 'true'
required: true
outputs: outputs:
tools-url: tools-url:
description: "The value that should be passed as the 'tools' input of the 'init' step." description: "The value that should be passed as the 'tools' input of the 'init' step."
@@ -29,24 +25,10 @@ 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.use-all-platform-bundle }} == "true" ]]; then
echo "tools-url=nightly" >> "$GITHUB_OUTPUT"
exit 0
elif [[ "$VERSION" == "linked" ]]; then
echo "tools-url=linked" >> "$GITHUB_OUTPUT"
exit 0
elif [[ "$VERSION" == "default" ]]; then
echo "tools-url=" >> "$GITHUB_OUTPUT"
exit 0
fi
if [[ "$USE_ALL_PLATFORM_BUNDLE" == "true" ]]; then
artifact_name="codeql-bundle.tar.gz" artifact_name="codeql-bundle.tar.gz"
elif [[ "$RUNNER_OS" == "Linux" ]]; then elif [[ "$RUNNER_OS" == "Linux" ]]; then
artifact_name="codeql-bundle-linux64.tar.gz" artifact_name="codeql-bundle-linux64.tar.gz"
@@ -59,18 +41,20 @@ runs:
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/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT
elif [[ "$VERSION" == *"stable"* ]]; then elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
version=`echo "$VERSION" | sed -e 's/^.*\-//'` version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
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
elif [[ ${{ inputs.version }} == "latest" ]]; then
echo "tools-url=latest" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == "default" ]]; then
echo "tools-url=" >> $GITHUB_OUTPUT
else else
echo "::error::Unrecognized version specified!" echo "::error::Unrecognized version specified!"
exit 1 exit 1
fi fi
- uses: fwilhe2/setup-kotlin@9c245a6425255f5e98ba1ce6c15d31fce7eca9da
if: ${{ inputs.setup-kotlin == 'true' }}
with:
version: 1.8.21

View File

@@ -23,16 +23,7 @@ inputs:
tools: tools:
required: true required: true
description: | description: |
The version of CodeQL passed to the `tools` input of the init action. The url of codeql to use.
This can be any of the following:
- A local path to a tarball containing the CodeQL tools, or
- A URL to a GitHub release assets containing the CodeQL tools, or
- A special value `linked` which is forcing the use of the CodeQL tools
that the action has been bundled with.
If not specified, the Action will check in several places until it finds
the CodeQL tools.
runs: runs:
using: composite using: composite
@@ -48,6 +39,7 @@ runs:
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false
upload: never upload: never
env: env:
CODEQL_ACTION_TEST_MODE: "true" CODEQL_ACTION_TEST_MODE: "true"

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

@@ -18,12 +18,12 @@ runs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: 3.12 python-version: 3.8
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install PyGithub==2.3.0 requests pip install PyGithub==1.55 requests
shell: bash shell: bash
- name: Update git config - name: Update git config

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: swift-actions/setup-swift@cdbe0f7f4c77929b6580e71983e8606e55ffe7e4 # 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

@@ -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,32 +2,41 @@ 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"]
# This is broken due to the way configuration files have changed. # v7 requires ESM
# This might be fixed when we move to eslint v9. - dependency-name: "del"
- dependency-name: "eslint-plugin-import" versions: ["^7.0.0"]
versions: [">=2.30.0"]
groups: groups:
npm: npm:
patterns: patterns:
- "*" - "*"
- 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: actions:
patterns: 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:
- "*"

View File

@@ -1,14 +1,5 @@
<!-- For GitHub staff: Remember that this is a public repository. -->
### 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.
### 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.

View File

@@ -1 +1 @@
OLDEST_SUPPORTED_MAJOR_VERSION=3 OLDEST_SUPPORTED_MAJOR_VERSION=2

View File

@@ -1,6 +1,5 @@
import argparse import argparse
import datetime import datetime
import fileinput
import re import re
from github import Github from github import Github
import json import json
@@ -97,8 +96,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 +107,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
@@ -172,19 +171,6 @@ def get_current_version():
with open('package.json', 'r') as f: with open('package.json', 'r') as f:
return json.load(f)['version'] return json.load(f)['version']
# `npm version` doesn't always work because of merge conflicts, so we
# replace the version in package.json textually.
def replace_version_package_json(prev_version, new_version):
prev_line_is_codeql = False
for line in fileinput.input('package.json', inplace = True, encoding='utf-8'):
if prev_line_is_codeql and f'\"version\": \"{prev_version}\"' in line:
print(line.replace(prev_version, new_version), end='')
else:
prev_line_is_codeql = False
print(line, end='')
if '\"name\": \"codeql\",' in line:
prev_line_is_codeql = True
def get_today_string(): def get_today_string():
today = datetime.datetime.today() today = datetime.datetime.today()
return '{:%d %b %Y}'.format(today) return '{:%d %b %Y}'.format(today)
@@ -200,17 +186,16 @@ def process_changelog_for_backports(source_branch_major_version, target_branch_m
with open('CHANGELOG.md', 'r') as f: with open('CHANGELOG.md', 'r') as f:
# until we find the first section, just duplicate all lines # until we find the first section, just duplicate all lines
found_first_section = False while True:
while not found_first_section:
line = f.readline() line = f.readline()
if not line: if not line:
raise Exception('Could not find any change sections in CHANGELOG.md') # EOF raise Exception('Could not find any change sections in CHANGELOG.md') # EOF
output += line
if line.startswith('## '): if line.startswith('## '):
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}') line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
found_first_section = True # we have found the first section, so now handle things differently
break
output += line
# found_content tracks whether we hit two headings in a row # found_content tracks whether we hit two headings in a row
found_content = False found_content = False
@@ -388,9 +373,9 @@ def main():
run_git('commit', '--no-edit') run_git('commit', '--no-edit')
# 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}')
replace_version_package_json(get_current_version(), version) # We rely on the `Rebuild` workflow to update package-lock.json subprocess.check_output(['npm', 'version', version, '--no-git-tag-version'])
run_git('add', 'package.json') run_git('add', 'package.json', 'package-lock.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
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}') print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')

View File

@@ -1,87 +1,77 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
all-platform-bundle: all-platform-bundle:
strategy: strategy:
fail-fast: false
matrix: matrix:
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'true' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- id: init - name: Check out repository
uses: ./../action/init uses: actions/checkout@v4
with: - name: Prepare test
# Swift is not supported on Ubuntu so we manually exclude it from the list here id: prepare-test
languages: cpp,csharp,go,java,javascript,python,ruby uses: ./.github/actions/prepare-test
tools: ${{ steps.prepare-test.outputs.tools-url }} with:
- name: Build code version: ${{ matrix.version }}
run: ./build.sh use-all-platform-bundle: 'true'
- uses: ./../action/analyze - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- id: init
uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,86 +1,82 @@
# 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"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
analyze-ref-input: analyze-ref-input:
strategy: strategy:
fail-fast: false
matrix: matrix:
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
tools: ${{ steps.prepare-test.outputs.tools-url }} - name: Prepare test
languages: cpp,csharp,java,javascript,python id: prepare-test
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ uses: ./.github/actions/prepare-test
github.sha }} with:
- name: Build code version: ${{ matrix.version }}
run: ./build.sh use-all-platform-bundle: 'false'
- uses: ./../action/analyze - name: Set environment variable for Swift enablement
with: if: runner.os != 'Windows' && matrix.version == '20221211'
ref: refs/heads/main shell: bash
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: cpp,csharp,java,javascript,python
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,84 +1,92 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
autobuild-action: autobuild-action:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: macos-latest - os: macos-latest
version: linked version: latest
- os: windows-latest - os: windows-latest
version: linked version: latest
name: autobuild-action name: autobuild-action
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- uses: ./../action/init matrix.version == 'stable-v2.13.5' ||
with:
languages: csharp matrix.version == 'stable-v2.14.6')
tools: ${{ steps.prepare-test.outputs.tools-url }} with:
- uses: ./../action/autobuild python-version: '3.11'
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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: csharp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
env:
# Explicitly disable the CLR tracer. # Explicitly disable the CLR tracer.
COR_ENABLE_PROFILING: '' COR_ENABLE_PROFILING: ''
COR_PROFILER: '' COR_PROFILER: ''
COR_PROFILER_PATH_64: '' COR_PROFILER_PATH_64: ''
CORECLR_ENABLE_PROFILING: '' CORECLR_ENABLE_PROFILING: ''
CORECLR_PROFILER: '' CORECLR_PROFILER: ''
CORECLR_PROFILER_PATH_64: '' CORECLR_PROFILER_PATH_64: ''
- uses: ./../action/analyze - uses: ./../action/analyze
- name: Check database with:
run: | upload-database: false
cd "$RUNNER_TEMP/codeql_databases" - name: Check database
if [[ ! -d csharp ]]; then shell: bash
echo "Did not find a C# database" run: |
exit 1 cd "$RUNNER_TEMP/codeql_databases"
fi if [[ ! -d csharp ]]; then
echo "Did not find a C# database"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,103 +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 direct tracing (custom 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:
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:
autobuild-direct-tracing-with-working-dir:
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 (custom 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@v5
- 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 Java
uses: actions/setup-java@v5
with:
java-version: ${{ inputs.java-version || '17' }}
distribution: temurin
- 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:
build-mode: autobuild
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- 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/autobuild
with:
working-directory: autobuild-dir
- 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@v5
- 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,117 +1,88 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: nightly-latest
- os: windows-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: windows-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
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
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 matrix.version == 'stable-20221211' ||
id: init
with:
build-mode: autobuild
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Install yq matrix.version == 'stable-20230418' ||
if: runner.os == 'Windows'
run: |
choco install yq -y
- name: Validate database build mode matrix.version == 'stable-v2.13.5' ||
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "autobuild" ]]; then
echo "Expected build mode to be 'autobuild' but was $build_mode"
exit 1
fi
- name: Check that indirect tracing is disabled matrix.version == 'stable-v2.14.6')
run: | with:
if [[ ! -z "${CODEQL_RUNNER}" ]]; then python-version: '3.11'
echo "Expected indirect tracing to be disabled, but the" \ - name: Check out repository
"CODEQL_RUNNER environment variable is set." uses: actions/checkout@v4
exit 1 - name: Prepare test
fi id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Set up Java test repo configuration
run: |
mv * .github ../action/tests/multi-language-repo/
mv ../action/tests/multi-language-repo/.github/workflows .github
mv ../action/tests/java-repo/* .
- uses: ./../action/analyze - uses: ./../action/init
id: init
with:
build-mode: autobuild
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "autobuild" ]]; then
echo "Expected build mode to be 'autobuild' but was $build_mode"
exit 1
fi
- uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,95 +1,90 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
build-mode-manual: build-mode-manual:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
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
- uses: ./../action/init
id: init
with:
build-mode: manual
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode matrix.version == 'stable-20221211' ||
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "manual" ]]; then
echo "Expected build mode to be 'manual' but was $build_mode"
exit 1
fi
- name: Build code matrix.version == 'stable-20230418' ||
run: ./build.sh
- uses: ./../action/analyze matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
id: init
with:
build-mode: manual
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "manual" ]]; then
echo "Expected build mode to be 'manual' but was $build_mode"
exit 1
fi
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,83 +1,88 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
build-mode-none: build-mode-none:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- uses: ./../action/init
id: init
with:
build-mode: none
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode matrix.version == 'stable-20221211' ||
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" matrix.version == 'stable-20230418' ||
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "none" ]]; then matrix.version == 'stable-v2.13.5' ||
echo "Expected build mode to be 'none' but was $build_mode"
exit 1 matrix.version == 'stable-v2.14.6')
fi with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
id: init
with:
build-mode: none
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "none" ]]; then
echo "Expected build mode to be 'none' but was $build_mode"
exit 1
fi
# The latest nightly supports omitting the autobuild Action when the build mode is specified. # The latest nightly supports omitting the autobuild Action when the build mode is specified.
- uses: ./../action/autobuild - uses: ./../action/autobuild
if: matrix.version != 'nightly-latest' if: matrix.version != 'nightly-latest'
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,84 +1,89 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
build-mode-rollback: build-mode-rollback:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Set up Java test repo configuration
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 matrix.version == 'stable-20221211' ||
id: init
with:
build-mode: none
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode matrix.version == 'stable-20230418' ||
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "autobuild" ]]; then
echo "Expected build mode to be 'autobuild' but was $build_mode"
exit 1
fi
- uses: ./../action/analyze matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Set up Java test repo configuration
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: none
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode
run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "autobuild" ]]; then
echo "Expected build mode to be 'autobuild' but was $build_mode"
exit 1
fi
- uses: ./../action/analyze
env: env:
CODEQL_ACTION_DISABLE_JAVA_BUILDLESS: true CODEQL_ACTION_DISABLE_JAVA_BUILDLESS: true
CODEQL_ACTION_TEST_MODE: true 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@v5
- 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@v5
- 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@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@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,79 +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 - Clean up database cluster 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:
cleanup-db-cluster-dir:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
name: Clean up database cluster 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@v5
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Add a file to the database cluster directory
run: |
mkdir -p "${{ runner.temp }}/customDbLocation/javascript"
touch "${{ runner.temp }}/customDbLocation/javascript/a-file-to-clean-up.txt"
- uses: ./../action/init
id: init
with:
build-mode: none
db-location: ${{ runner.temp }}/customDbLocation
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate file cleaned up
run: |
if [[ -f "${{ runner.temp }}/customDbLocation/javascript/a-file-to-clean-up.txt" ]]; then
echo "File was not cleaned up"
exit 1
fi
echo "File was cleaned up"
env:
CODEQL_ACTION_TEST_MODE: true

161
.github/workflows/__config-export.yml generated vendored
View File

@@ -1,102 +1,115 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
config-export: config-export:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: macos-latest
version: nightly-latest version: latest
- os: windows-latest
version: latest
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- uses: ./../action/init
with:
languages: javascript
queries: security-extended
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: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check config properties appear 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')); matrix.version == 'stable-20221211' ||
const run = sarif.runs[0];
const configSummary = run.properties.codeqlConfigSummary;
if (configSummary === undefined) { matrix.version == 'stable-20230418' ||
core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.');
} matrix.version == 'stable-v2.13.5' ||
if (configSummary.disableDefaultQueries !== false) {
core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' + matrix.version == 'stable-v2.14.6')
`${JSON.stringify(configSummary.disableDefaultQueries)}.`); with:
} python-version: '3.11'
const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }]; - name: Check out repository
// Use JSON.stringify to deep-equal the arrays. uses: actions/checkout@v4
if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) { - name: Prepare test
core.setFailed(`\`queries\` property incorrect: expected ${JSON.stringify(expectedQueries)}, got ` + id: prepare-test
`${JSON.stringify(configSummary.queries)}.`); uses: ./.github/actions/prepare-test
} with:
core.info('Finished config export tests.'); version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: javascript
queries: security-extended
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@v3
with:
name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check config properties appear 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 configSummary = run.properties.codeqlConfigSummary;
if (configSummary === undefined) {
core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.');
}
if (configSummary.disableDefaultQueries !== false) {
core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' +
`${JSON.stringify(configSummary.disableDefaultQueries)}.`);
}
const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }];
// Use JSON.stringify to deep-equal the arrays.
if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) {
core.setFailed(`\`queries\` property incorrect: expected ${JSON.stringify(expectedQueries)}, got ` +
`${JSON.stringify(configSummary.queries)}.`);
}
core.info('Finished config export tests.');
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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

@@ -1,94 +1,92 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
config-input: config-input:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
name: Config input name: Config input
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Install Node.js if: >-
uses: actions/setup-node@v5 matrix.os == 'macos-latest' && (
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Copy queries into workspace
run: |
cp -a ../action/queries .
- uses: ./../action/init matrix.version == 'stable-20221211' ||
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: javascript
build-mode: none
config: |
disable-default-queries: true
queries:
- name: Run custom query
uses: ./queries/default-setup-environment-variables.ql
paths-ignore:
- tests
- lib
- uses: ./../action/analyze matrix.version == 'stable-20230418' ||
with:
output: ${{ runner.temp }}/results
- name: Check SARIF matrix.version == 'stable-v2.13.5' ||
uses: ./../action/.github/actions/check-sarif
with: matrix.version == 'stable-v2.14.6')
sarif-file: ${{ runner.temp }}/results/javascript.sarif with:
queries-run: javascript/codeql-action/default-setup-env-vars python-version: '3.11'
queries-not-run: javascript/codeql-action/default-setup-context-properties - 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Copy queries into workspace
run: |
cp -a ../action/queries .
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: javascript
build-mode: none
config: |
disable-default-queries: true
queries:
- name: Run custom query
uses: ./queries/default-setup-environment-variables.ql
paths-ignore:
- tests
- lib
- 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: javascript/codeql-action/default-setup-env-vars
queries-not-run: javascript/codeql-action/default-setup-context-properties
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,81 +1,88 @@
# 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)'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
cpp-deptrace-disabled: cpp-deptrace-disabled:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Test setup matrix.version == 'stable-v2.13.5' ||
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir matrix.version == 'stable-v2.14.6')
- uses: ./../action/init with:
with: python-version: '3.11'
languages: cpp - name: Check out repository
tools: ${{ steps.prepare-test.outputs.tools-url }} uses: actions/checkout@v4
- uses: ./../action/autobuild - name: Prepare test
with: id: prepare-test
working-directory: autobuild-dir uses: ./.github/actions/prepare-test
env: with:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false version: ${{ matrix.version }}
- run: | use-all-platform-bundle: 'false'
if ls /usr/bin/errno; then - name: Set environment variable for Swift enablement
echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled." if: runner.os != 'Windows' && matrix.version == '20221211'
exit 1 shell: bash
fi run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Test setup
shell: bash
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init
with:
languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
- shell: bash
run: |
if ls /usr/bin/errno; then
echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled."
exit 1
fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,81 +1,86 @@
# 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)'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
cpp-deptrace-enabled-on-macos: cpp-deptrace-enabled-on-macos:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: macos-latest - os: macos-latest
version: linked version: nightly-latest
- os: macos-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Test setup matrix.version == 'stable-v2.13.5' ||
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir matrix.version == 'stable-v2.14.6')
- uses: ./../action/init with:
with: python-version: '3.11'
languages: cpp - name: Check out repository
tools: ${{ steps.prepare-test.outputs.tools-url }} uses: actions/checkout@v4
- uses: ./../action/autobuild - name: Prepare test
with: id: prepare-test
working-directory: autobuild-dir uses: ./.github/actions/prepare-test
env: with:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true version: ${{ matrix.version }}
- run: | use-all-platform-bundle: 'false'
if ! ls /usr/bin/errno; then - name: Set environment variable for Swift enablement
echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS" if: runner.os != 'Windows' && matrix.version == '20221211'
else shell: bash
echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS" run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
exit 1 - name: Test setup
fi shell: bash
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init
with:
languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- shell: bash
run: |
if ! ls /usr/bin/errno; then
echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS"
else
echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS"
exit 1
fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,81 +1,88 @@
# 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)'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
cpp-deptrace-enabled: cpp-deptrace-enabled:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Test setup matrix.version == 'stable-v2.13.5' ||
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir matrix.version == 'stable-v2.14.6')
- uses: ./../action/init with:
with: python-version: '3.11'
languages: cpp - name: Check out repository
tools: ${{ steps.prepare-test.outputs.tools-url }} uses: actions/checkout@v4
- uses: ./../action/autobuild - name: Prepare test
with: id: prepare-test
working-directory: autobuild-dir uses: ./.github/actions/prepare-test
env: with:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true version: ${{ matrix.version }}
- run: | use-all-platform-bundle: 'false'
if ! ls /usr/bin/errno; then - name: Set environment variable for Swift enablement
echo "Did not autoinstall errno" if: runner.os != 'Windows' && matrix.version == '20221211'
exit 1 shell: bash
fi run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Test setup
shell: bash
run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init
with:
languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
with:
working-directory: autobuild-dir
env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- shell: bash
run: |
if ! ls /usr/bin/errno; then
echo "Did not autoinstall errno"
exit 1
fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,138 +1,162 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
diagnostics-export: diagnostics-export:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: stable-20230317
- os: ubuntu-latest - os: macos-latest
version: nightly-latest version: stable-20230317
- os: windows-latest
version: stable-20230317
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- uses: ./../action/init matrix.version == 'stable-v2.13.5' ||
id: init
with: matrix.version == 'stable-v2.14.6')
languages: javascript with:
tools: ${{ steps.prepare-test.outputs.tools-url }} python-version: '3.11'
- name: Add test diagnostics - name: Check out repository
env: uses: actions/checkout@v4
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }} - name: Prepare test
run: | id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
id: init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Add test diagnostics
shell: bash
env:
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
run: |
for i in {1..2}; do
# Use the same location twice to test the workaround for the bug in CodeQL CLI 2.12.5 that
# produces an invalid diagnostic with multiple identical location objects.
"$CODEQL_PATH" database add-diagnostic \ "$CODEQL_PATH" database add-diagnostic \
"$RUNNER_TEMP/codeql_databases/javascript" \ "$RUNNER_TEMP/codeql_databases/javascript" \
--file-path /path/to/file \ --file-path /path/to/file \
--plaintext-message "Plaintext message" \ --plaintext-message "Plaintext message $i" \
--source-id "lang/diagnostics/example" \ --source-id "lang/diagnostics/example" \
--source-name "Diagnostic name" \ --source-name "Diagnostic name" \
--ready-for-status-page --ready-for-status-page
- uses: ./../action/analyze done
with: - uses: ./../action/analyze
output: ${{ runner.temp }}/results with:
upload-database: false output: ${{ runner.temp }}/results
- name: Upload SARIF upload-database: false
uses: actions/upload-artifact@v4 - name: Upload SARIF
with: uses: actions/upload-artifact@v3
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json with:
path: ${{ runner.temp }}/results/javascript.sarif name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
retention-days: 7 path: ${{ runner.temp }}/results/javascript.sarif
- name: Check diagnostics appear in SARIF retention-days: 7
uses: actions/github-script@v8 - name: Check diagnostics appear in SARIF
env: uses: actions/github-script@v7
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif env:
with: SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
script: | with:
const fs = require('fs'); script: |
const fs = require('fs');
function checkStatusPageNotification(n) { function checkStatusPageNotification(n) {
const expectedMessage = 'Plaintext message'; const expectedMessage = 'Plaintext message 1\n\nCodeQL also found 1 other diagnostic like this. See the workflow log for details.';
if (n.message.text !== expectedMessage) { if (n.message.text !== expectedMessage) {
core.setFailed(`Expected the status page diagnostic to have the message '${expectedMessage}', but found '${n.message.text}'.`); core.setFailed(`Expected the status page diagnostic to have the message '${expectedMessage}', but found '${n.message.text}'.`);
}
if (n.locations.length !== 1) {
core.setFailed(`Expected the status page diagnostic to have exactly 1 location, but found ${n.locations.length}.`);
}
} }
if (n.locations.length !== 1) {
core.setFailed(`Expected the status page diagnostic to have exactly 1 location, but found ${n.locations.length}.`);
}
}
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0]; const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications; const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const statusPageNotifications = toolExecutionNotifications.filter(n => const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'lang/diagnostics/example' && n.properties?.visibility?.statusPage n.descriptor.id === 'lang/diagnostics/example' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
); );
if (statusPageNotifications.length !== 1) { }
core.setFailed( checkStatusPageNotification(statusPageNotifications[0]);
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
checkStatusPageNotification(statusPageNotifications[0]);
const notifications = run.tool.driver.notifications; const notifications = run.tool.driver.notifications;
const diagnosticNotification = notifications.filter(n => const diagnosticNotification = notifications.filter(n =>
n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' && n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' &&
n.fullDescription.text === 'Diagnostic name' n.fullDescription.text === 'Diagnostic name'
);
if (diagnosticNotification.length !== 1) {
core.setFailed(
'Expected exactly one notification for this diagnostic in the ' +
`'runs[].tool.driver.notifications[]' SARIF property, but found ` +
`${diagnosticNotification.length}. All notifications: ` +
`${JSON.stringify(notifications)}.`
); );
if (diagnosticNotification.length !== 1) { }
core.setFailed(
'Expected exactly one notification for this diagnostic in the ' +
`'runs[].tool.driver.notifications[]' SARIF property, but found ` +
`${diagnosticNotification.length}. All notifications: ` +
`${JSON.stringify(notifications)}.`
);
}
core.info('Finished diagnostic export test'); core.info('Finished diagnostic export test');
env: env:
CODEQL_ACTION_EXPORT_DIAGNOSTICS: true CODEQL_ACTION_EXPORT_DIAGNOSTICS: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,114 +1,109 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
export-file-baseline-information: export-file-baseline-information:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
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
- uses: ./../action/init
id: init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
- name: Upload SARIF
uses: actions/upload-artifact@v4
with:
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check results
run: |
cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
if [[ $RUNNER_OS == "macOS" ]]; then
expected_baseline_languages+=" swift"
fi
for lang in ${expected_baseline_languages}; do matrix.version == 'stable-20221211' ||
rule_name="cli/expected-extracted-files/${lang}"
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications | matrix.version == 'stable-20230418' ||
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
if [[ "${found_notification}" != "true" ]]; then matrix.version == 'stable-v2.13.5' ||
echo "Expected SARIF output to contain notification '${rule_name}', but found no such notification."
exit 1 matrix.version == 'stable-v2.14.6')
else with:
echo "Found notification '${rule_name}'." python-version: '3.11'
fi - name: Check out repository
done uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
id: init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
if [[ $RUNNER_OS != "Windows" ]]; then
expected_baseline_languages+=" swift"
fi
for lang in ${expected_baseline_languages}; do
rule_name="cli/expected-extracted-files/${lang}"
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
if [[ "${found_notification}" != "true" ]]; then
echo "Expected SARIF output to contain notification '${rule_name}', but found no such notification."
exit 1
else
echo "Found notification '${rule_name}'."
fi
done
env: env:
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,82 +1,88 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
extractor-ram-threads: extractor-ram-threads:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- uses: ./../action/init matrix.version == 'stable-v2.13.5' ||
with:
languages: java matrix.version == 'stable-v2.14.6')
ram: 230 with:
threads: 1 python-version: '3.11'
- name: Assert Results - name: Check out repository
run: | uses: actions/checkout@v4
if [ "${CODEQL_RAM}" != "230" ]; then - name: Prepare test
echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230" id: prepare-test
exit 1 uses: ./.github/actions/prepare-test
fi with:
if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then version: ${{ matrix.version }}
echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230" use-all-platform-bundle: 'false'
exit 1 - name: Set environment variable for Swift enablement
fi if: runner.os != 'Windows' && matrix.version == '20221211'
if [ "${CODEQL_THREADS}" != "1" ]; then shell: bash
echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1" run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
exit 1 - uses: ./../action/init
fi with:
if [ "${CODEQL_EXTRACTOR_JAVA_THREADS}" != "1" ]; then languages: java
echo "CODEQL_EXTRACTOR_JAVA_THREADS is '${CODEQL_EXTRACTOR_JAVA_THREADS}' instead of 1" ram: 230
exit 1 threads: 1
fi - name: Assert Results
shell: bash
run: |
if [ "${CODEQL_RAM}" != "230" ]; then
echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230"
exit 1
fi
if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then
echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230"
exit 1
fi
if [ "${CODEQL_THREADS}" != "1" ]; then
echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1"
exit 1
fi
if [ "${CODEQL_EXTRACTOR_JAVA_THREADS}" != "1" ]; then
echo "CODEQL_EXTRACTOR_JAVA_THREADS is '${CODEQL_EXTRACTOR_JAVA_THREADS}' instead of 1"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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@v5
- 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,85 +1,116 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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-custom-queries: go-custom-queries:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: stable-20221211
- os: ubuntu-latest - os: macos-latest
version: nightly-latest version: stable-20221211
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: stable-20230418
- os: macos-latest
version: stable-20230418
- os: windows-latest
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
languages: go - name: Prepare test
config-file: ./.github/codeql/custom-queries.yml id: prepare-test
tools: ${{ steps.prepare-test.outputs.tools-url }} uses: ./.github/actions/prepare-test
- name: Build code with:
run: ./build.sh version: ${{ matrix.version }}
- uses: ./../action/analyze use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: go
config-file: ./.github/codeql/custom-queries.yml
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,111 +1,106 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.14.6
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
languages: go - name: Prepare test
tools: ${{ steps.prepare-test.outputs.tools-url }} id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
# We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0'
- uses: ./../action/init
with:
languages: go
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
run: go build main.go shell: bash
- uses: ./../action/analyze run: go build main.go
with: - uses: ./../action/analyze
output: ${{ runner.temp }}/results with:
upload-database: false output: ${{ runner.temp }}/results
- name: Check diagnostic appears in SARIF upload-database: false
uses: actions/github-script@v8 - name: Check diagnostic appears in SARIF
env: uses: actions/github-script@v7
SARIF_PATH: ${{ runner.temp }}/results/go.sarif env:
with: SARIF_PATH: ${{ runner.temp }}/results/go.sarif
script: | with:
const fs = require('fs'); script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0]; const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications; const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const statusPageNotifications = toolExecutionNotifications.filter(n => const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
); );
if (statusPageNotifications.length !== 1) { }
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,112 +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 - Go: diagnostic when `file` is not installed'
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'
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:
go-indirect-tracing-workaround-no-file-program:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: default
name: 'Go: diagnostic when `file` is not installed'
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@v5
- 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: Remove `file` program
run: |
echo $(which file)
sudo rm -rf $(which file)
echo $(which file)
- uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: go build main.go
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check diagnostic appears in SARIF
uses: actions/github-script@v8
env:
SARIF_PATH: ${{ runner.temp }}/results/go.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 statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'go/workflow/file-program-unavailable' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,106 +1,104 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.14.6
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
languages: go - name: Prepare test
tools: ${{ steps.prepare-test.outputs.tools-url }} id: prepare-test
- name: Build code uses: ./.github/actions/prepare-test
run: go build main.go with:
- uses: ./../action/analyze version: ${{ matrix.version }}
- run: | use-all-platform-bundle: 'false'
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then - name: Set environment variable for Swift enablement
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \ if: runner.os != 'Windows' && matrix.version == '20221211'
"CODEQL_ACTION_GO_BINARY environment variable is not set." shell: bash
exit 1 run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
fi - uses: actions/setup-go@v5
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then with:
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist." # We need a Go version that ships with statically linked binaries on Linux
exit 1 go-version: '>=1.21.0'
fi - uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: go build main.go
- uses: ./../action/analyze
with:
upload-database: false
- shell: bash
run: |
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
"CODEQL_ACTION_GO_BINARY environment variable is not set."
exit 1
fi
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
exit 1
fi
# 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.
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
echo "Expected the Go autobuilder not to be run, but the" \ echo "Expected the Go autobuilder not to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set." "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
exit 1 exit 1
fi fi
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"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,126 +1,114 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-v2.17.6 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.18.4 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-v2.18.4 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.21.4 version: default
- os: macos-latest - os: macos-latest
version: stable-v2.21.4 version: default
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.22.4 version: latest
- os: macos-latest - os: macos-latest
version: stable-v2.22.4 version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: nightly-latest
- os: macos-latest - os: macos-latest
version: default version: nightly-latest
- os: ubuntu-latest
version: linked
- os: macos-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: macos-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
languages: go - name: Prepare test
tools: ${{ steps.prepare-test.outputs.tools-url }} id: prepare-test
- uses: ./../action/autobuild uses: ./.github/actions/prepare-test
- uses: ./../action/analyze with:
- run: | version: ${{ matrix.version }}
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then use-all-platform-bundle: 'false'
echo "Expected the Go autobuilder to be run, but the" \ - name: Set environment variable for Swift enablement
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true." if: runner.os != 'Windows' && matrix.version == '20221211'
exit 1 shell: bash
fi run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
cd "$RUNNER_TEMP/codeql_databases" - uses: actions/setup-go@v5
if [[ ! -d go ]]; then with:
echo "Did not find a Go database" go-version: ~1.21.1
exit 1 - uses: ./../action/init
fi with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
- uses: ./../action/analyze
with:
upload-database: false
- shell: bash
run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
echo "Expected the Go autobuilder to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true."
exit 1
fi
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then
echo "Did not find a Go database"
exit 1
fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,129 +1,118 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-v2.17.6 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.18.4 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-v2.18.4 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.21.4 version: default
- os: macos-latest - os: macos-latest
version: stable-v2.21.4 version: default
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.22.4 version: latest
- os: macos-latest - os: macos-latest
version: stable-v2.22.4 version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: nightly-latest
- os: macos-latest - os: macos-latest
version: default version: nightly-latest
- os: ubuntu-latest
version: linked
- os: macos-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: macos-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
languages: go - name: Prepare test
tools: ${{ steps.prepare-test.outputs.tools-url }} id: prepare-test
- name: Build code uses: ./.github/actions/prepare-test
run: go build main.go with:
- uses: ./../action/analyze version: ${{ matrix.version }}
- run: | use-all-platform-bundle: 'false'
# Once we start running Bash 4.2 in all environments, we can replace the - name: Set environment variable for Swift enablement
# `! -z` flag with the more elegant `-v` which confirms that the variable if: runner.os != 'Windows' && matrix.version == '20221211'
# is actually unset and not potentially set to a blank value. shell: bash
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
echo "Expected the Go autobuilder not to be run, but the" \ - uses: actions/setup-go@v5
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set." with:
exit 1 go-version: ~1.21.1
fi - uses: ./../action/init
cd "$RUNNER_TEMP/codeql_databases" with:
if [[ ! -d go ]]; then languages: go
echo "Did not find a Go database" tools: ${{ steps.prepare-test.outputs.tools-url }}
exit 1 - name: Build code
fi shell: bash
run: go build main.go
- uses: ./../action/analyze
with:
upload-database: false
- shell: bash
run: |
# 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
# is actually unset and not potentially set to a blank value.
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
echo "Expected the Go autobuilder not to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
exit 1
fi
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then
echo "Did not find a Go database"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,120 +1,108 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-v2.17.6 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.18.4 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-v2.18.4 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.21.4 version: default
- os: macos-latest - os: macos-latest
version: stable-v2.21.4 version: default
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.22.4 version: latest
- os: macos-latest - os: macos-latest
version: stable-v2.22.4 version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: nightly-latest
- os: macos-latest - os: macos-latest
version: default version: nightly-latest
- os: ubuntu-latest
version: linked
- os: macos-latest
version: linked
- os: ubuntu-latest
version: nightly-latest
- os: macos-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
languages: go - name: Prepare test
tools: ${{ steps.prepare-test.outputs.tools-url }} id: prepare-test
- uses: ./../action/analyze uses: ./.github/actions/prepare-test
- run: | with:
cd "$RUNNER_TEMP/codeql_databases" version: ${{ matrix.version }}
if [[ ! -d go ]]; then use-all-platform-bundle: 'false'
echo "Did not find a Go database" - name: Set environment variable for Swift enablement
exit 1 if: runner.os != 'Windows' && matrix.version == '20221211'
fi shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ~1.21.1
- uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
upload-database: false
- shell: bash
run: |
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then
echo "Did not find a Go database"
exit 1
fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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

@@ -1,77 +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:
push:
paths:
- .github/workflows/__go.yml
workflow_dispatch:
inputs:
go-version:
type: string
description: The version of Go to install
required: false
default: '>=1.21.0'
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 }}
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,49 +1,49 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
init-with-registries: init-with-registries:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: macos-latest
version: linked version: default
- os: ubuntu-latest - os: windows-latest
version: nightly-latest version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-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
@@ -51,72 +51,94 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Init with registries
uses: ./../action/init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
config-file: ./.github/codeql/codeql-config-registries.yml
languages: javascript
registries: |
- url: "https://ghcr.io/v2/"
packages: "*/*"
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Verify packages installed matrix.version == 'stable-20221211' ||
run: |
PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack"
CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1"
if [[ -d $PRIVATE_PACK ]] matrix.version == 'stable-20230418' ||
then
echo "$PRIVATE_PACK was installed."
else
echo "::error $PRIVATE_PACK pack was not installed."
exit 1
fi
if [[ -d $CODEQL_PACK1 ]] matrix.version == 'stable-v2.13.5' ||
then
echo "$CODEQL_PACK1 was installed."
else
echo "::error $CODEQL_PACK1 pack was not installed."
exit 1
fi
- name: Verify qlconfig.yml file was created matrix.version == 'stable-v2.14.6')
run: | with:
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml python-version: '3.11'
echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH" - name: Check out repository
if [[ -f $QLCONFIG_PATH ]] uses: actions/checkout@v4
then - name: Prepare test
echo "qlconfig.yml file was created." id: prepare-test
else uses: ./.github/actions/prepare-test
echo "::error qlconfig.yml file was not created." with:
exit 1 version: ${{ matrix.version }}
fi use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Init with registries
uses: ./../action/init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
config-file: ./.github/codeql/codeql-config-registries.yml
languages: javascript
registries: |
- url: "https://ghcr.io/v2/"
packages: "*/*"
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Verify contents of qlconfig.yml - name: Verify packages installed
run: | shell: bash
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml run: |
cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")' PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack"
if [[ $? -eq 0 ]] CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1"
then
echo "Registry was added to qlconfig.yml file." if [[ -d $PRIVATE_PACK ]]
else then
echo "::error Registry was not added to qlconfig.yml file." echo "$PRIVATE_PACK was installed."
echo "Contents of qlconfig.yml file:" else
cat $QLCONFIG_PATH echo "::error $PRIVATE_PACK pack was not installed."
exit 1 exit 1
fi fi
if [[ -d $CODEQL_PACK1 ]]
then
echo "$CODEQL_PACK1 was installed."
else
echo "::error $CODEQL_PACK1 pack was not installed."
exit 1
fi
- name: Verify qlconfig.yml file was created
shell: bash
run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH"
if [[ -f $QLCONFIG_PATH ]]
then
echo "qlconfig.yml file was created."
else
echo "::error qlconfig.yml file was not created."
exit 1
fi
- name: Verify contents of qlconfig.yml
# yq is not available on windows
if: runner.os != 'Windows'
shell: bash
run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")'
if [[ $? -eq 0 ]]
then
echo "Registry was added to qlconfig.yml file."
else
echo "::error Registry was not added to qlconfig.yml file."
echo "Contents of qlconfig.yml file:"
cat $QLCONFIG_PATH
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,82 +1,91 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
javascript-source-root: javascript-source-root:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Move codeql-action matrix.version == 'stable-v2.13.5' ||
run: |
mkdir ../new-source-root matrix.version == 'stable-v2.14.6')
mv * ../new-source-root with:
- uses: ./../action/init python-version: '3.11'
with: - name: Check out repository
languages: javascript uses: actions/checkout@v4
source-root: ../new-source-root - name: Prepare test
tools: ${{ steps.prepare-test.outputs.tools-url }} id: prepare-test
- uses: ./../action/analyze uses: ./.github/actions/prepare-test
with: with:
skip-queries: true version: ${{ matrix.version }}
- name: Assert database exists use-all-platform-bundle: 'false'
run: | - name: Set environment variable for Swift enablement
cd "$RUNNER_TEMP/codeql_databases" if: runner.os != 'Windows' && matrix.version == '20221211'
if [[ ! -d javascript ]]; then shell: bash
echo "Did not find a JavaScript database" run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
exit 1 - name: Move codeql-action
fi shell: bash
run: |
mkdir ../new-source-root
mv * ../new-source-root
- uses: ./../action/init
with:
languages: javascript
source-root: ../new-source-root
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
upload-database: false
skip-queries: true
upload: never
- name: Assert database exists
shell: bash
run: |
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d javascript ]]; then
echo "Did not find a JavaScript database"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,83 +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 - Job run UUID added to 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: {}
workflow_call:
inputs: {}
defaults:
run:
shell: bash
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
job-run-uuid-sarif:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: nightly-latest
name: Job run UUID added to 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@v5
- 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
id: init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
- name: Upload SARIF
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check results
run: |
cd "$RUNNER_TEMP/results"
actual=$(jq -r '.runs[0].properties.jobRunUuid' javascript.sarif)
if [[ "$actual" != "$JOB_RUN_UUID" ]]; then
echo "Expected SARIF output to contain job run UUID '$JOB_RUN_UUID', but found '$actual'."
exit 1
else
echo "Found job run UUID '$actual'."
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,74 +1,79 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
language-aliases: language-aliases:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
name: Language aliases name: Language aliases
if: github.triggering_actor != 'dependabot[bot]'
permissions: permissions:
contents: read contents: read
security-events: read security-events: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- uses: ./../action/init
with:
languages: C#,java-kotlin,swift,typescript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check languages matrix.version == 'stable-20221211' ||
run: |
expected_languages="csharp,java,swift,javascript"
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
if [ "$expected_languages" != "$actual_languages" ]; then matrix.version == 'stable-20230418' ||
echo "Resolved languages did not match expected list. " \
"Expected languages: $expected_languages. Actual languages: $actual_languages." matrix.version == 'stable-v2.13.5' ||
exit 1
fi matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: C#,java-kotlin,swift,typescript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check languages
run: |
expected_languages="csharp,java,swift,javascript"
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
if [ "$expected_languages" != "$actual_languages" ]; then
echo "Resolved languages did not match expected list. " \
"Expected languages: $expected_languages. Actual languages: $actual_languages."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

86
.github/workflows/__local-bundle.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 - 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'
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:
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@v5
- 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: 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,175 +1,159 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
multi-language-autodetect: multi-language-autodetect:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: macos-latest - os: ubuntu-latest
version: stable-v2.17.6 version: stable-20221211
- os: ubuntu-latest - os: macos-latest
version: stable-v2.17.6 version: stable-20221211
- os: macos-latest - os: ubuntu-latest
version: stable-v2.18.4 version: stable-20230418
- os: ubuntu-latest - os: macos-latest
version: stable-v2.18.4 version: stable-20230418
- os: macos-latest - os: ubuntu-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: ubuntu-latest - os: macos-latest
version: stable-v2.19.4 version: stable-v2.13.5
- os: macos-latest - os: ubuntu-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: ubuntu-latest - os: macos-latest
version: stable-v2.20.7 version: stable-v2.14.6
- os: macos-latest - os: ubuntu-latest
version: stable-v2.21.4 version: default
- os: ubuntu-latest - os: macos-latest
version: stable-v2.21.4 version: default
- os: macos-latest - os: ubuntu-latest
version: stable-v2.22.4 version: latest
- os: ubuntu-latest - os: macos-latest
version: stable-v2.22.4 version: latest
- os: macos-latest - os: ubuntu-latest
version: default version: nightly-latest
- os: ubuntu-latest - os: macos-latest
version: default version: nightly-latest
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
- os: macos-latest
version: nightly-latest
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
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: Use Xcode 16
if: runner.os == 'macOS' && matrix.version != 'nightly-latest'
run: sudo xcode-select -s "/Applications/Xcode_16.app"
- uses: ./../action/init matrix.version == 'stable-20221211' ||
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby'
|| '' }}
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code matrix.version == 'stable-20230418' ||
run: ./build.sh
- uses: ./../action/analyze matrix.version == 'stable-v2.13.5' ||
id: analysis
with:
upload-database: false
- name: Check language autodetect for all languages excluding Swift matrix.version == 'stable-v2.14.6')
run: | with:
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} python-version: '3.11'
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - name: Check out repository
echo "Did not create a database for CPP, or created it in the wrong location." uses: actions/checkout@v4
exit 1 - name: Prepare test
fi id: prepare-test
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} uses: ./.github/actions/prepare-test
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then with:
echo "Did not create a database for C Sharp, or created it in the wrong location." version: ${{ matrix.version }}
exit 1 use-all-platform-bundle: 'false'
fi - name: Set environment variable for Swift enablement
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }} if: runner.os != 'Windows' && matrix.version == '20221211'
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then shell: bash
echo "Did not create a database for Go, or created it in the wrong location." run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
exit 1 - uses: ./../action/init
fi id: init
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }} with:
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then db-location: ${{ runner.temp }}/customDbLocation
echo "Did not create a database for Java, or created it in the wrong location." tools: ${{ steps.prepare-test.outputs.tools-url }}
exit 1
fi
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Javascript, or created it in the wrong location."
exit 1
fi
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Python, or created it in the wrong location."
exit 1
fi
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Ruby, or created it in the wrong location."
exit 1
fi
- name: Check language autodetect for Swift on macOS - uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS' with:
run: | codeql-path: ${{ steps.init.outputs.codeql-path }}
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - name: Build code
echo "Did not create a database for Swift, or created it in the wrong location." shell: bash
exit 1 run: ./build.sh
fi
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
- name: Check language autodetect for all languages excluding Swift
shell: bash
run: |
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for CPP, or created it in the wrong location."
exit 1
fi
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for C Sharp, or created it in the wrong location."
exit 1
fi
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Go, or created it in the wrong location."
exit 1
fi
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Java, or created it in the wrong location."
exit 1
fi
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Javascript, or created it in the wrong location."
exit 1
fi
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Python, or created it in the wrong location."
exit 1
fi
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Ruby, or created it in the wrong location."
exit 1
fi
- name: Check language autodetect for Swift
if: >-
env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true' ||
(runner.os != 'Windows' && matrix.version == 'nightly-latest')
shell: bash
run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Swift, or created it in the wrong location."
exit 1
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@v5
- 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,119 +1,116 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
packaging-codescanning-config-inputs-js: packaging-codescanning-config-inputs-js:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: macos-latest
version: default version: latest
- os: ubuntu-latest - os: windows-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Install Node.js if: >-
uses: actions/setup-node@v5 matrix.os == 'macos-latest' && (
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- 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
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check results matrix.version == 'stable-20221211' ||
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results matrix.version == 'stable-20230418' ||
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace matrix.version == 'stable-v2.13.5' ||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" matrix.version == 'stable-v2.14.6')
if [ "$RULES" != "$EXPECTED_RULES" ]; then with:
echo "Did not match expected rules '$EXPECTED_RULES'." python-version: '3.11'
exit 1 - name: Check out repository
fi uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check results
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,119 +1,116 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
packaging-config-inputs-js: packaging-config-inputs-js:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: macos-latest
version: default version: latest
- os: ubuntu-latest - os: windows-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Install Node.js if: >-
uses: actions/setup-node@v5 matrix.os == 'macos-latest' && (
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- 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
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check results matrix.version == 'stable-20221211' ||
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results matrix.version == 'stable-20230418' ||
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace matrix.version == 'stable-v2.13.5' ||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" matrix.version == 'stable-v2.14.6')
if [ "$RULES" != "$EXPECTED_RULES" ]; then with:
echo "Did not match expected rules '$EXPECTED_RULES'." python-version: '3.11'
exit 1 - name: Check out repository
fi uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check results
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,118 +1,115 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
packaging-config-js: packaging-config-js:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: macos-latest
version: default version: latest
- os: ubuntu-latest - os: windows-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Install Node.js if: >-
uses: actions/setup-node@v5 matrix.os == 'macos-latest' && (
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- 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
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging.yml
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check results matrix.version == 'stable-20221211' ||
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results matrix.version == 'stable-20230418' ||
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace matrix.version == 'stable-v2.13.5' ||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" matrix.version == 'stable-v2.14.6')
if [ "$RULES" != "$EXPECTED_RULES" ]; then with:
echo "Did not match expected rules '$EXPECTED_RULES'." python-version: '3.11'
exit 1 - name: Check out repository
fi uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging.yml
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check results
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,118 +1,115 @@
# 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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
packaging-inputs-js: packaging-inputs-js:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: macos-latest
version: default version: latest
- os: ubuntu-latest - os: windows-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Install Node.js if: >-
uses: actions/setup-node@v5 matrix.os == 'macos-latest' && (
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- 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
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging2.yml
languages: javascript
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 }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
- name: Check results matrix.version == 'stable-20221211' ||
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results matrix.version == 'stable-20230418' ||
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace matrix.version == 'stable-v2.13.5' ||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" matrix.version == 'stable-v2.14.6')
if [ "$RULES" != "$EXPECTED_RULES" ]; then with:
echo "Did not match expected rules '$EXPECTED_RULES'." python-version: '3.11'
exit 1 - name: Check out repository
fi uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging2.yml
languages: javascript
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 }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
- name: Check results
uses: ./../action/.github/actions/check-sarif
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar
- name: Assert Results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,139 +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@v5
- 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
- name: Upload security SARIF
if: contains(matrix.analysis-kinds, 'code-scanning')
uses: actions/upload-artifact@v4
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@v4
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: 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

147
.github/workflows/__remote-config.yml generated vendored
View File

@@ -1,85 +1,114 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
remote-config: remote-config:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: stable-20221211
- os: ubuntu-latest - os: macos-latest
version: nightly-latest version: stable-20221211
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: stable-20230418
- os: macos-latest
version: stable-20230418
- os: windows-latest
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
tools: ${{ steps.prepare-test.outputs.tools-url }} - name: Prepare test
languages: cpp,csharp,java,javascript,python id: prepare-test
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ uses: ./.github/actions/prepare-test
github.sha }} with:
- name: Build code version: ${{ matrix.version }}
run: ./build.sh use-all-platform-bundle: 'false'
- uses: ./../action/analyze - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: cpp,csharp,java,javascript,python
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,88 +1,113 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
resolve-environment-action: resolve-environment-action:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.13.4
- os: ubuntu-latest - os: macos-latest
version: linked version: stable-v2.13.4
- os: ubuntu-latest - os: windows-latest
version: nightly-latest version: stable-v2.13.4
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- uses: ./../action/init
with:
languages: go,javascript-typescript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Resolve environment for Go matrix.version == 'stable-20221211' ||
uses: ./../action/resolve-environment
id: resolve-environment-go
with:
language: go
- name: Fail if Go configuration missing matrix.version == 'stable-20230418' ||
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
run: exit 1
- name: Resolve environment for JavaScript/TypeScript matrix.version == 'stable-v2.13.5' ||
uses: ./../action/resolve-environment
id: resolve-environment-js
with:
language: javascript-typescript
- name: Fail if JavaScript/TypeScript configuration present matrix.version == 'stable-v2.14.6')
if: with:
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript python-version: '3.11'
run: exit 1 - 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
}}
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Resolve environment for Go
uses: ./../action/resolve-environment
id: resolve-environment-go
with:
language: go
- name: Fail if Go configuration missing
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
run: exit 1
- name: Resolve environment for JavaScript/TypeScript
if: matrix.version != 'stable-v2.13.4'
uses: ./../action/resolve-environment
id: resolve-environment-js
with:
language: javascript-typescript
- name: Fail if JavaScript/TypeScript configuration present
if: matrix.version != 'stable-v2.13.4' &&
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
run: exit 1
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,76 +1,84 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
rubocop-multi-language: rubocop-multi-language:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Set up Ruby matrix.version == 'stable-v2.13.5' ||
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
with: matrix.version == 'stable-v2.14.6')
ruby-version: 2.6 with:
- name: Install Code Scanning integration python-version: '3.11'
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install - name: Check out repository
- name: Install dependencies uses: actions/checkout@v4
run: bundle install - name: Prepare test
- name: RuboCop run id: prepare-test
run: | uses: ./.github/actions/prepare-test
bash -c " with:
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif version: ${{ matrix.version }}
[[ $? -ne 2 ]] use-all-platform-bundle: 'false'
" - name: Set environment variable for Swift enablement
- uses: ./../action/upload-sarif if: runner.os != 'Windows' && matrix.version == '20221211'
with: shell: bash
sarif_file: rubocop.sarif run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install Code Scanning integration
shell: bash
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
- name: Install dependencies
shell: bash
run: bundle install
- name: RuboCop run
shell: bash
run: |
bash -c "
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
[[ $? -ne 2 ]]
"
- uses: ./../action/upload-sarif
with:
sarif_file: rubocop.sarif
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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

@@ -1,84 +1,90 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
ruby: ruby:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: macos-latest - os: macos-latest
version: linked version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- uses: ./../action/init matrix.version == 'stable-v2.13.5' ||
with:
languages: ruby matrix.version == 'stable-v2.14.6')
tools: ${{ steps.prepare-test.outputs.tools-url }} with:
- uses: ./../action/analyze python-version: '3.11'
id: analysis - name: Check out repository
with: uses: actions/checkout@v4
upload-database: false - name: Prepare test
- name: Check database id: prepare-test
run: | uses: ./.github/actions/prepare-test
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}" with:
if [[ ! -d "$RUBY_DB" ]]; then version: ${{ matrix.version }}
echo "Did not create a database for Ruby." use-all-platform-bundle: 'false'
exit 1 - name: Set environment variable for Swift enablement
fi if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
- name: Check database
shell: bash
run: |
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
if [[ ! -d "$RUBY_DB" ]]; then
echo "Did not create a database for Ruby."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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

@@ -1,82 +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 - Rust analysis
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:
rust:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: stable-v2.19.3
- os: ubuntu-latest
version: stable-v2.22.1
- os: ubuntu-latest
version: linked
- os: ubuntu-latest
version: default
- os: ubuntu-latest
version: nightly-latest
name: Rust analysis
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@v5
- 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: rust
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
- name: Check database
run: |
RUST_DB="${{ fromJson(steps.analysis.outputs.db-locations).rust }}"
if [[ ! -d "$RUST_DB" ]]; then
echo "Did not create a database for Rust."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

109
.github/workflows/__scaling-reserved-ram.yml generated vendored Normal file
View File

@@ -0,0 +1,109 @@
# 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 - Scaling reserved RAM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
scaling-reserved-ram:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20221211
- os: macos-latest
version: stable-20221211
- os: ubuntu-latest
version: stable-20230418
- os: macos-latest
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Scaling reserved RAM
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python on MacOS
uses: actions/setup-python@v5
if: >-
matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
env:
CODEQL_ACTION_SCALING_RESERVED_RAM: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,121 +1,114 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
split-workflow: split-workflow:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: macos-latest - os: macos-latest
version: linked version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- 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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
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
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
with:
skip-queries: true
output: ${{ runner.temp }}/results
upload-database: false
- name: Assert No Results matrix.version == 'stable-20221211' ||
run: |
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
echo "Expected results directory to be empty after skipping query execution!"
exit 1
fi
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Assert Results
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace matrix.version == 'stable-20230418' ||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" matrix.version == 'stable-v2.13.5' ||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'." matrix.version == 'stable-v2.14.6')
exit 1 with:
fi python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
skip-queries: true
output: ${{ runner.temp }}/results
upload-database: false
- name: Assert No Results
shell: bash
run: |
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
echo "Expected results directory to be empty after skipping query execution!"
exit 1
fi
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Assert Results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

85
.github/workflows/__start-proxy.yml generated vendored
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 - Start proxy
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:
start-proxy:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: linked
- os: macos-latest
version: linked
- os: windows-latest
version: linked
name: Start proxy
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@v5
- 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: csharp
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Setup proxy for registries
id: proxy
uses: ./../action/start-proxy
with:
registry_secrets: '[{ "type": "nuget_feed", "url": "https://api.nuget.org/v3/index.json"
}]'
- name: Print proxy outputs
run: |
echo "${{ steps.proxy.outputs.proxy_host }}"
echo "${{ steps.proxy.outputs.proxy_port }}"
echo "${{ steps.proxy.outputs.proxy_urls }}"
- name: Fail if proxy outputs are not set
if: (!steps.proxy.outputs.proxy_host) || (!steps.proxy.outputs.proxy_port)
|| (!steps.proxy.outputs.proxy_ca_certificate) || (!steps.proxy.outputs.proxy_urls)
run: exit 1
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,83 +1,86 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- 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: jobs:
submit-sarif-failure: submit-sarif-failure:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- 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
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- uses: actions/checkout@v5 matrix.version == 'stable-v2.13.5' ||
- uses: ./init
with: matrix.version == 'stable-v2.14.6')
languages: javascript with:
tools: ${{ steps.prepare-test.outputs.tools-url }} python-version: '3.11'
- name: Fail - 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: ./init
with:
languages: javascript
- name: Fail
# We want this job to pass if the Action correctly uploads the SARIF file for # We want this job to pass if the Action correctly uploads the SARIF file for
# the failed run. # the failed run.
# Setting this step to continue on error means that it is marked as completing # Setting this step to continue on error means that it is marked as completing
# successfully, so will not fail the job. # successfully, so will not fail the job.
continue-on-error: true continue-on-error: true
run: exit 1 run: exit 1
- uses: ./analyze - uses: ./analyze
# In a real workflow, this step wouldn't run. Since we used `continue-on-error` # In a real workflow, this step wouldn't run. Since we used `continue-on-error`
# above, we manually disable it with an `if` condition. # above, we manually disable it with an `if` condition.
if: false if: false
with: with:
category: /test-codeql-version:${{ matrix.version }} category: /test-codeql-version:${{ matrix.version }}
env: env:
# Internal-only environment variable used to indicate that the post-init Action # Internal-only environment variable used to indicate that the post-init Action
# should expect to upload a SARIF file for the failed run. # should expect to upload a SARIF file for the failed run.

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 - Swift analysis using autobuild
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:
swift-autobuild:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: nightly-latest
name: Swift analysis using autobuild
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@v5
- 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
id: init
with:
languages: swift
build-mode: autobuild
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check working directory
run: pwd
- uses: ./../action/autobuild
timeout-minutes: 30
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
- name: Check database
run: |
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
if [[ ! -d "$SWIFT_DB" ]]; then
echo "Did not create a database for Swift."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,102 +1,101 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
swift-custom-build: swift-custom-build:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: macos-latest - os: ubuntu-latest
version: linked version: latest
- os: macos-latest - os: macos-latest
version: default version: latest
- os: macos-latest - os: ubuntu-latest
version: nightly-latest version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- name: Use Xcode 16 - name: Check out repository
if: runner.os == 'macOS' && matrix.version != 'nightly-latest' uses: actions/checkout@v4
run: sudo xcode-select -s "/Applications/Xcode_16.app" - name: Prepare test
- uses: ./../action/init id: prepare-test
id: init uses: ./.github/actions/prepare-test
with: with:
languages: swift version: ${{ matrix.version }}
tools: ${{ steps.prepare-test.outputs.tools-url }} use-all-platform-bundle: 'false'
- name: Check working directory - name: Set environment variable for Swift enablement
run: pwd if: runner.os != 'Windows' && matrix.version == '20221211'
- name: Build code shell: bash
run: ./build.sh run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/analyze - uses: ./../action/init
id: analysis id: init
with: with:
upload-database: false languages: swift
- name: Check database tools: ${{ steps.prepare-test.outputs.tools-url }}
run: | - uses: ./../action/.github/actions/setup-swift
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" with:
if [[ ! -d "$SWIFT_DB" ]]; then codeql-path: ${{steps.init.outputs.codeql-path}}
echo "Did not create a database for Swift." - name: Check working directory
exit 1 shell: bash
fi run: pwd
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
- name: Check database
shell: bash
run: |
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
if [[ ! -d "$SWIFT_DB" ]]; then
echo "Did not create a database for Swift."
exit 1
fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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

@@ -0,0 +1,89 @@
# 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
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
test-autobuild-working-dir:
strategy:
matrix:
include:
- os: ubuntu-latest
version: latest
name: Autobuild working directory
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python on MacOS
uses: actions/setup-python@v5
if: >-
matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- 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
with:
upload-database: false
- 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

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

@@ -0,0 +1,83 @@
# 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
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
test-local-codeql:
strategy:
matrix:
include:
- os: ubuntu-latest
version: nightly-latest
name: Local CodeQL bundle
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python on MacOS
uses: actions/setup-python@v5
if: >-
matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- 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:
tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
env:
CODEQL_ACTION_TEST_MODE: true

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

@@ -0,0 +1,80 @@
# 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
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
test-proxy:
strategy:
matrix:
include:
- os: ubuntu-latest
version: latest
name: Proxy test
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python on MacOS
uses: actions/setup-python@v5
if: >-
matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6')
with:
python-version: '3.11'
- 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'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
upload-database: false
env:
https_proxy: http://squid-proxy:3128
CODEQL_ACTION_TEST_MODE: true
container:
image: ubuntu:22.04
options: --dns 127.0.0.1
services:
squid-proxy:
image: ubuntu/squid:latest
ports:
- 3128:3128

View File

@@ -1,126 +1,132 @@
# 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
unset-environment: unset-environment:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: ubuntu-latest
version: latest
- os: ubuntu-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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
id: init uses: actions/checkout@v4
with: - name: Prepare test
db-location: ${{ runner.temp }}/customDbLocation id: prepare-test
# Swift is not supported on Ubuntu so we manually exclude it from the list here uses: ./.github/actions/prepare-test
languages: cpp,csharp,go,java,javascript,python,ruby with:
tools: ${{ steps.prepare-test.outputs.tools-url }} version: ${{ matrix.version }}
- name: Build code use-all-platform-bundle: 'false'
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh - name: Set environment variable for Swift enablement
- uses: ./../action/analyze if: runner.os != 'Windows' && matrix.version == '20221211'
id: analysis shell: bash
with: run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
upload-database: false - uses: ./../action/init
- run: | id: init
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" with:
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then db-location: ${{ runner.temp }}/customDbLocation
echo "::error::Did not create a database for CPP, or created it in the wrong location." \ tools: ${{ steps.prepare-test.outputs.tools-url }}
"Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'" - uses: ./../action/.github/actions/setup-swift
exit 1 with:
fi codeql-path: ${{ steps.init.outputs.codeql-path }}
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - name: Build code
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then shell: bash
echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ # Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
"Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'" # workaround for our PR checks.
exit 1 run: env -i CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN=true PATH="$PATH" HOME="$HOME"
fi ./build.sh
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - uses: ./../action/analyze
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then id: analysis
echo "::error::Did not create a database for Go, or created it in the wrong location." \ with:
"Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'" upload-database: false
exit 1 - shell: bash
fi run: |
JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then
echo "::error::Did not create a database for Java, or created it in the wrong location." \ echo "::error::Did not create a database for CPP, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'"
exit 1 exit 1
fi fi
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then
echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'"
exit 1 exit 1
fi fi
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then
echo "::error::Did not create a database for Python, or created it in the wrong location." \ echo "::error::Did not create a database for Go, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'"
exit 1 exit 1
fi fi
JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}"
if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then
echo "::error::Did not create a database for Java, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'"
exit 1
fi
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then
echo "::error::Did not create a database for Javascript, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'"
exit 1
fi
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then
echo "::error::Did not create a database for Python, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,95 +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 - Upload-sarif: code quality endpoint'
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'
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:
upload-quality-sarif:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: default
name: 'Upload-sarif: code quality endpoint'
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@v5
- 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
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: csharp,java,javascript,python
analysis-kinds: code-quality
- 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
- uses: ./../action/upload-sarif
id: upload-sarif
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
- name: Check output from `upload-sarif` step
if: '!(fromJSON(steps.upload-sarif.outputs.sarif-ids).code-quality)'
run: exit 1
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,92 +1,87 @@
# 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"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
upload-ref-sha-input: upload-ref-sha-input:
strategy: strategy:
fail-fast: false
matrix: matrix:
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- uses: ./../action/init - name: Check out repository
with: uses: actions/checkout@v4
tools: ${{ steps.prepare-test.outputs.tools-url }} - name: Prepare test
languages: cpp,csharp,java,javascript,python id: prepare-test
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ uses: ./.github/actions/prepare-test
github.sha }} with:
- name: Build code version: ${{ matrix.version }}
run: ./build.sh use-all-platform-bundle: 'false'
# Generate some SARIF we can upload with the upload-sarif step - name: Set environment variable for Swift enablement
- uses: ./../action/analyze if: runner.os != 'Windows' && matrix.version == '20221211'
with: shell: bash
ref: refs/heads/main run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 - uses: ./../action/init
upload: never with:
- uses: ./../action/upload-sarif tools: ${{ steps.prepare-test.outputs.tools-url }}
with: languages: cpp,csharp,java,javascript,python
ref: refs/heads/main config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 github.sha }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
upload: never
- uses: ./../action/upload-sarif
with:
ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,132 +1,137 @@
# 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`
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule: workflow_dispatch: {}
- cron: '0 5 * * *'
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:
with-checkout-path: with-checkout-path:
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
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: write
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Setup Python on MacOS
uses: actions/checkout@v5 uses: actions/setup-python@v5
- name: Prepare test if: >-
id: prepare-test matrix.os == 'macos-latest' && (
uses: ./.github/actions/prepare-test
with: matrix.version == 'stable-20221211' ||
version: ${{ matrix.version }}
use-all-platform-bundle: 'false' matrix.version == 'stable-20230418' ||
setup-kotlin: 'true'
- name: Install Go matrix.version == 'stable-v2.13.5' ||
uses: actions/setup-go@v6
with: matrix.version == 'stable-v2.14.6')
go-version: ${{ inputs.go-version || '>=1.21.0' }} with:
cache: false python-version: '3.11'
- name: Delete original checkout - name: Check out repository
run: | uses: actions/checkout@v4
# delete the original checkout so we don't accidentally use it. - name: Prepare test
# Actions does not support deleting the current working directory, so we id: prepare-test
# delete the contents of the directory instead. uses: ./.github/actions/prepare-test
rm -rf ./* .github .git with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Delete original checkout
shell: bash
run: |
# delete the original checkout so we don't accidentally use it.
# Actions does not support deleting the current working directory, so we
# delete the contents of the directory instead.
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@v5 - uses: actions/checkout@v4
with: with:
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
path: x/y/z/some-path path: x/y/z/some-path
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
# it's enough to test one compiled language and one interpreted language # it's enough to test one compiled language and one interpreted language
languages: csharp,javascript languages: csharp,javascript
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
working-directory: x/y/z/some-path/tests/multi-language-repo shell: bash
run: | working-directory: x/y/z/some-path/tests/multi-language-repo
./build.sh run: |
./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
checkout_path: x/y/z/some-path/tests/multi-language-repo checkout_path: x/y/z/some-path/tests/multi-language-repo
ref: v1.1.0 ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
upload: never
upload-database: false
- name: Verify SARIF after upload - uses: ./../action/upload-sarif
run: | with:
EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6" ref: v1.1.0
EXPECTED_REF="v1.1.0" sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo" checkout_path: x/y/z/some-path/tests/multi-language-repo
ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)" - name: Verify SARIF after upload
ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)" shell: bash
ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)" run: |
EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6"
EXPECTED_REF="v1.1.0"
EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo"
if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)"
echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID" ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)"
echo "$RUNNER_TEMP/payload.json" ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)"
exit 1
fi
if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then
echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'" echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
if [[ "$ACTUAL_CHECKOUT_URI" != *$EXPECTED_CHECKOUT_URI_SUFFIX ]]; then if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then
echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI" echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
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 "$RUNNER_TEMP/payload.json"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -9,20 +9,13 @@ 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-latest runs-on: ubuntu-latest
permissions:
contents: read
steps: steps:
- name: Checkout CodeQL Action - name: Checkout CodeQL Action
uses: actions/checkout@v5 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

@@ -13,26 +13,21 @@ 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 }}
permissions: permissions:
contents: read security-events: write
steps: steps:
- uses: actions/checkout@v5 - 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
@@ -46,7 +41,7 @@ jobs:
id: init-latest id: init-latest
uses: ./init uses: ./init
with: with:
tools: linked tools: latest
languages: javascript languages: javascript
- name: Compare default and latest CodeQL bundle versions - name: Compare default and latest CodeQL bundle versions
id: compare id: compare
@@ -59,88 +54,45 @@ jobs:
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT" echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST" echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
# If we're running on a pull request, run with both bundles, even if `tools: linked` would # If we're running on a pull request, run with both bundles, even if `tools: latest` would
# be the same as `tools: null`. This allows us to make the job for each of the bundles a # be the same as `tools: null`. This allows us to make the job for each of the bundles a
# required status check. # required status check.
# #
# If we're running on push or schedule, then we can skip running with `tools: linked` when it would be # If we're running on push or schedule, then we can skip running with `tools: latest` when it would be
# the same as running with `tools: null`. # the same as running with `tools: null`.
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
VERSIONS_JSON='[null]' VERSIONS_JSON='[null]'
else else
VERSIONS_JSON='[null, "linked"]' VERSIONS_JSON='[null, "latest"]'
fi fi
# Output a JSON-encoded list with the distinct versions to test against. # Output a JSON-encoded list with the distinct versions to test against.
echo "Suggested matrix config for analysis job: $VERSIONS_JSON" echo "Suggested matrix config for analysis job: $VERSIONS_JSON"
echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT
analyze-javascript: build:
if: github.triggering_actor != 'dependabot[bot]'
needs: [check-codeql-versions] needs: [check-codeql-versions]
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ubuntu-22.04,ubuntu-24.04,windows-2022,windows-2025,macos-13,macos-14,macos-15] os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-11,macos-12,macos-13]
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }} tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions: permissions:
contents: read
security-events: write security-events: write
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 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:
category: "/language:javascript"
upload: ${{ (matrix.os == 'ubuntu-24.04' && !matrix.tools && 'always') || 'never' }}
analyze-other:
if: github.triggering_actor != 'dependabot[bot]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- language: actions
- language: python
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Initialize CodeQL
uses: ./init
with:
languages: ${{ matrix.language }}
build-mode: none
config: >
paths-ignore:
- lib
- tests
queries:
- uses: security-and-quality
- name: Perform CodeQL Analysis
uses: ./analyze
with:
category: "/language:${{ matrix.language }}"

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:
@@ -18,34 +15,27 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- 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:
contents: read
packages: read
security-events: read
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: linked version: latest
- os: macos-latest
version: latest
- 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,17 +43,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v5 uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
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
@@ -175,13 +155,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

@@ -1,107 +0,0 @@
# Checks logs, SARIF, and database bundle debug artifacts exist
# when the analyze step fails.
name: PR Check - Debug artifacts after failure
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
defaults:
run:
shell: bash
jobs:
upload-artifacts:
if: github.triggering_actor != 'dependabot[bot]'
strategy:
fail-fast: false
matrix:
version:
- stable-v2.20.3
- default
- linked
- nightly-latest
name: Upload debug artifacts after failure in analyze
continue-on-error: true
env:
CODEQL_ACTION_TEST_MODE: true
permissions:
contents: read
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Dump GitHub event
run: cat "${GITHUB_EVENT_PATH}"
- name: Check out repository
uses: actions/checkout@v5
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
- uses: actions/setup-go@v6
with:
go-version: ^1.13.1
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
debug: true
debug-artifact-name: my-debug-artifacts
debug-database-name: my-db
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
id: analysis
env:
# Forces a failure in this step.
CODEQL_ACTION_EXTRA_OPTIONS: '{ "database": { "finalize": ["--invalid-option"] } }'
with:
expect-error: true
download-and-check-artifacts:
name: Download and check debug artifacts after failure in analyze
if: github.triggering_actor != 'dependabot[bot]'
needs: upload-artifacts
timeout-minutes: 45
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v5
- name: Check expected artifacts exist
run: |
LANGUAGES="cpp csharp go java javascript python"
for version in $VERSIONS; do
echo "Artifacts from version $version:"
pushd "./my-debug-artifacts-${version//./}"
for language in $LANGUAGES; do
echo "- Checking $language"
if [[ ! -f "my-db-$language-partial.zip" ]] ; then
echo "Missing a partial database bundle for $language"
exit 1
fi
if [[ ! -d "log" ]] ; then
echo "Missing database initialization logs"
exit 1
fi
if [[ ! "$language" == "go" ]] && [[ ! -d "$language/log" ]] ; then
echo "Missing logs for $language"
exit 1
fi
done
popd
done
env:
GO111MODULE: auto

View File

@@ -0,0 +1,86 @@
# Checks logs, SARIF, and database bundle debug artifacts exist
# when the analyze step fails.
name: PR Check - Debug artifacts after failure
env:
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
# workaround for our PR checks.
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
upload-artifacts:
name: Upload debug artifacts after failure in analyze
continue-on-error: true
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Dump GitHub event
run: cat "${GITHUB_EVENT_PATH}"
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: latest
- uses: actions/setup-go@v5
with:
go-version: ^1.13.1
- uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
debug: true
debug-artifact-name: my-debug-artifacts
debug-database-name: my-db
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
with:
expect-error: true
ram: 1
download-and-check-artifacts:
name: Download and check debug artifacts after failure in analyze
needs: upload-artifacts
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Check expected artifacts exist
shell: bash
run: |
LANGUAGES="cpp csharp go java javascript python"
cd "./my-debug-artifacts"
echo "Artifacts from run:"
for language in $LANGUAGES; do
echo "- Checking $language"
if [[ ! -f "my-db-$language-partial.zip" ]] ; then
echo "Missing a partial database bundle for $language"
exit 1
fi
if [[ ! -d "log" ]] ; then
echo "Missing database initialization logs"
exit 1
fi
if [[ ! "$language" == "go" ]] && [[ ! -d "$language/log" ]] ; then
echo "Missing logs for $language"
exit 1
fi
done
env:
GO111MODULE: auto

View File

@@ -1,102 +0,0 @@
# Checks logs, SARIF, and database bundle debug artifacts exist.
name: PR Check - Debug artifact upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
defaults:
run:
shell: bash
jobs:
upload-artifacts:
if: github.triggering_actor != 'dependabot[bot]'
strategy:
fail-fast: false
matrix:
version:
- stable-v2.20.3
- default
- linked
- nightly-latest
name: Upload debug artifacts
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
- uses: actions/setup-go@v6
with:
go-version: ^1.13.1
- uses: ./../action/init
id: init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
debug: true
debug-artifact-name: my-debug-artifacts
debug-database-name: my-db
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby
- name: Build code
run: ./build.sh
- uses: ./../action/analyze
id: analysis
download-and-check-artifacts:
name: Download and check debug artifacts
if: github.triggering_actor != 'dependabot[bot]'
needs: upload-artifacts
timeout-minutes: 45
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v5
- name: Check expected artifacts exist
run: |
VERSIONS="stable-v2.20.3 default linked nightly-latest"
LANGUAGES="cpp csharp go java javascript python"
for version in $VERSIONS; do
pushd "./my-debug-artifacts-${version//./}"
echo "Artifacts from version $version:"
for language in $LANGUAGES; do
echo "- Checking $language"
if [[ ! -f "$language.sarif" ]] ; then
echo "Missing a SARIF file for $language"
exit 1
fi
if [[ ! -f "my-db-$language.zip" ]] ; then
echo "Missing a database bundle for $language"
exit 1
fi
if [[ ! -d "$language/log" ]] ; then
echo "Missing logs for $language"
exit 1
fi
done
popd
done
env:
GO111MODULE: auto

97
.github/workflows/debug-artifacts.yml vendored Normal file
View File

@@ -0,0 +1,97 @@
# Checks logs, SARIF, and database bundle debug artifacts exist.
name: PR Check - Debug artifact upload
env:
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
# workaround for our PR checks.
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
upload-artifacts:
strategy:
matrix:
version:
- stable-20221211
- stable-20230418
- stable-v2.13.5
- stable-v2.14.6
- default
- latest
- nightly-latest
name: Upload debug artifacts
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
- uses: actions/setup-go@v5
with:
go-version: ^1.13.1
- uses: ./../action/init
id: init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
debug: true
debug-artifact-name: my-debug-artifacts
debug-database-name: my-db
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
download-and-check-artifacts:
name: Download and check debug artifacts
needs: upload-artifacts
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Check expected artifacts exist
shell: bash
run: |
VERSIONS="stable-20221211 stable-20230418 stable-v2.13.5 stable-v2.14.6 default latest nightly-latest"
LANGUAGES="cpp csharp go java javascript python"
for version in $VERSIONS; do
pushd "./my-debug-artifacts-${version//./}"
echo "Artifacts from version $version:"
for language in $LANGUAGES; do
echo "- Checking $language"
if [[ ! -f "$language.sarif" ]] ; then
echo "Missing a SARIF file for $language"
exit 1
fi
if [[ ! -f "my-db-$language.zip" ]] ; then
echo "Missing a database bundle for $language"
exit 1
fi
if [[ ! -d "$language/log" ]] ; then
echo "Missing logs for $language"
exit 1
fi
done
popd
done
env:
GO111MODULE: auto

View File

@@ -0,0 +1,46 @@
name: Check queries that ran
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
expected-queries:
name: Expected Queries Tests
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: latest
- uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
upload: never
- 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

@@ -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,23 +18,14 @@ on:
branches: branches:
- releases/v* - releases/v*
defaults:
run:
shell: bash
jobs: jobs:
merge-back: merge-back:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: Automation
if: github.repository == 'github/codeql-action' if: github.repository == 'github/codeql-action'
env: env:
BASE_BRANCH: "${{ github.event.inputs.baseBranch || 'main' }}" BASE_BRANCH: "${{ github.event.inputs.baseBranch || 'main' }}"
HEAD_BRANCH: "${{ github.head_ref || github.ref }}" HEAD_BRANCH: "${{ github.head_ref || github.ref }}"
permissions:
contents: write # needed to create tags and push commits
pull-requests: write
steps: steps:
- name: Dump environment - name: Dump environment
run: env run: env
@@ -44,10 +35,10 @@ jobs:
GITHUB_CONTEXT: '${{ toJson(github) }}' GITHUB_CONTEXT: '${{ toJson(github) }}'
run: echo "${GITHUB_CONTEXT}" run: echo "${GITHUB_CONTEXT}"
- uses: actions/checkout@v5 - 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@v5 - uses: actions/setup-node@v4
- name: Update git config - name: Update git config
run: | run: |
@@ -117,43 +108,45 @@ jobs:
# - `--force` since we're overwriting the `vN` tag # - `--force` since we're overwriting the `vN` tag
git push origin --atomic --force refs/tags/"${VERSION}" refs/tags/"${major_version_tag}" git push origin --atomic --force refs/tags/"${VERSION}" refs/tags/"${major_version_tag}"
- name: Prepare partial Changelog - name: Create mergeback branch
env:
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
VERSION: "${{ steps.getVersion.outputs.version }}"
run: |
python .github/workflows/script/prepare_changelog.py CHANGELOG.md "$VERSION" > $PARTIAL_CHANGELOG
echo "::group::Partial CHANGELOG"
cat $PARTIAL_CHANGELOG
echo "::endgroup::"
- name: Create mergeback branch and PR
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
with:
base: "${{ env.BASE_BRANCH }}"
head: "${{ env.HEAD_BRANCH }}"
branch: "${{ steps.getVersion.outputs.newBranch }}"
version: "${{ steps.getVersion.outputs.version }}"
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Generate token
uses: actions/create-github-app-token@v2.1.4
id: app-token
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Create the GitHub release
env: env:
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
VERSION: "${{ steps.getVersion.outputs.version }}" VERSION: "${{ steps.getVersion.outputs.version }}"
GH_TOKEN: ${{ steps.app-token.outputs.token }} NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: | run: |
# Do not mark this release as latest. The most recent CLI release must be marked as latest. set -exu
gh release create \ pr_title="Mergeback ${VERSION} ${HEAD_BRANCH} into ${BASE_BRANCH}"
"$VERSION" \ pr_body=$(cat << EOF
--latest=false \ This PR bumps the version number and updates the changelog after the ${VERSION} release.
--title "$VERSION" \
--notes-file "$PARTIAL_CHANGELOG" 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

View File

@@ -2,95 +2,118 @@ name: PR Checks
on: on:
push: push:
branches: [main, releases/v*]
pull_request: pull_request:
# 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]
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
timeout-minutes: 45
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] node-types-version: [16.11, current] # we backport this matrix job in order to maintain the same check names
permissions:
contents: read steps:
security-events: write # needed to upload ESLint results - name: Checkout
runs-on: ${{ matrix.os }} uses: actions/checkout@v4
- name: Lint
run: npm run-script lint
- name: Update version of @types/node
if: matrix.node-types-version != 'current'
env:
NODE_TYPES_VERSION: ${{ matrix.node-types-version }}
run: |
# Export `NODE_TYPES_VERSION` so it's available to jq
export NODE_TYPES_VERSION="${NODE_TYPES_VERSION}"
contents=$(jq '.devDependencies."@types/node" = env.NODE_TYPES_VERSION' package.json)
echo "${contents}" > package.json
# Usually we run `npm install` on macOS to ensure that we pick up macOS-only dependencies.
# However we're not checking in the updated lockfile here, so it's fine to run
# `npm install` on Linux.
npm install
if [ ! -z "$(git status --porcelain)" ]; then
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions[bot]"
# The period in `git add --all .` ensures that we stage deleted files too.
git add --all .
git commit -m "Use @types/node=${NODE_TYPES_VERSION}"
fi
- name: Check generated JS
if: matrix.node-types-version != 'current' # we do not need to test the newer node on the v2 branch
run: .github/workflows/script/check-js.sh
check-node-modules:
name: Check modules up to date
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@v5 check-file-contents:
name: Check file contents
runs-on: ubuntu-latest
timeout-minutes: 45
- name: Set up Node.js steps:
uses: actions/setup-node@v5 - name: Checkout
with: uses: actions/checkout@v4
node-version: '20.x'
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() name: Unit Test
run: npm test needs: [check-js, check-node-modules]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
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@v3
if: matrix.os == 'ubuntu-latest'
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
env: env:
BASE_REF: ${{ github.base_ref }} BASE_REF: ${{ github.base_ref }}
permissions:
contents: read
steps: steps:
- uses: actions/checkout@v5 - 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: |
@@ -105,7 +128,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@v5 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-latest
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@v5
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,39 +0,0 @@
name: 'Publish Immutable Action Version'
on:
release:
types: [published]
defaults:
run:
shell: bash
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Check release name
id: check
env:
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@v5
- name: Publish
if: steps.check.outputs.is-action-release == 'true'
id: publish
uses: actions/publish-immutable-action@v0.0.4

174
.github/workflows/python-deps.yml vendored Normal file
View File

@@ -0,0 +1,174 @@
name: Test Python Package Installation
on:
push:
branches: [main, releases/v*]
pull_request:
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
# by other workflows.
types: [opened, synchronize, reopened, ready_for_review]
paths:
# Changes to this workflow.
- '.github/workflows/python-deps.yml'
# Changes to the Python package installation scripts and their tests.
- 'python-setup/**'
# Changes to the default CodeQL bundle version.
- '**/defaults.json'
schedule:
# Weekly on Monday.
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
test-setup-python-scripts:
timeout-minutes: 45
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest]
python_deps_type: [pipenv, poetry, requirements, setup_py]
python_version: [3]
env:
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
PYTHON_VERSION: ${{ matrix.python_version }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: ./init
id: init
with:
tools: latest
languages: python
setup-python-dependencies: false
- name: Test Auto Package Installation
run: |
set -x
$GITHUB_WORKSPACE/python-setup/install_tools.sh
cd $GITHUB_WORKSPACE/python-setup/tests/${PYTHON_DEPS_TYPE}/requests-${PYTHON_VERSION}
case ${{ matrix.os }} in
ubuntu-20.04*) basePath="/opt";;
ubuntu-22.04*) basePath="/opt";;
macos-latest*) basePath="/Users/runner";;
esac
echo ${basePath}
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})"
- name: Setup for extractor
run: |
echo $CODEQL_PYTHON
# only run if $CODEQL_PYTHON is set
if [ ! -z $CODEQL_PYTHON ]; then
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
fi
- name: Verify packages installed
run: |
$GITHUB_WORKSPACE/python-setup/tests/check_requests.sh ${PYTHON_VERSION} 2.31.0
# This one shouldn't fail, but also won't install packages
test-setup-python-scripts-non-standard-location:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: ./init
id: init
with:
tools: latest
languages: python
setup-python-dependencies: false
- name: Test Auto Package Installation
run: |
set -x
$GITHUB_WORKSPACE/python-setup/install_tools.sh
cd $GITHUB_WORKSPACE/python-setup/tests/requirements/non-standard-location
case ${{ matrix.os }} in
ubuntu-20.04*) basePath="/opt";;
ubuntu-22.04*) basePath="/opt";;
macos-latest*) basePath="/Users/runner";;
esac
echo ${basePath}
$GITHUB_WORKSPACE/python-setup/auto_install_packages.py "$(dirname ${{steps.init.outputs.codeql-path}})"
- name: Setup for extractor
run: |
echo $CODEQL_PYTHON
# only run if $CODEQL_PYTHON is set
if [ ! -z $CODEQL_PYTHON ]; then
$GITHUB_WORKSPACE/python-setup/tests/from_python_exe.py $CODEQL_PYTHON;
fi
- name: Verify packages installed
run: |
test -z $LGTM_INDEX_IMPORT_PATH
test-setup-python-scripts-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python_deps_type: [pipenv, poetry, requirements, setup_py]
python_version: [3]
env:
CODEQL_ACTION_TEST_MODE: true
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
PYTHON_VERSION: ${{ matrix.python_version }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Initialize CodeQL
id: init
uses: ./init
with:
tools: latest
languages: python
setup-python-dependencies: false
- name: Test Auto Package Installation
env:
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
run: |
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\install_tools.ps1"
powershell -File $cmd
cd $Env:GITHUB_WORKSPACE\\python-setup/tests/$Env:PYTHON_DEPS_TYPE/requests-$Env:PYTHON_VERSION
$codeql_dist = (get-item $Env:CODEQL_PATH).Directory.FullName
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\auto_install_packages.py $codeql_dist
- name: Setup for extractor
run: |
echo $Env:CODEQL_PYTHON
py -3 $Env:GITHUB_WORKSPACE\\python-setup\\tests\\from_python_exe.py $Env:CODEQL_PYTHON
- name: Verify packages installed
run: |
$cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests.ps1"
powershell -File $cmd $Env:PYTHON_VERSION 2.31.0

View File

@@ -12,26 +12,17 @@ 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:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45 timeout-minutes: 45
permissions:
contents: read
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@v5 - uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
@@ -41,8 +32,11 @@ jobs:
- name: Initialize CodeQL - name: Initialize CodeQL
uses: ./../action/init uses: ./../action/init
with: with:
tools: linked tools: latest
languages: python languages: python
- name: Analyze - name: Analyze
uses: ./../action/analyze uses: ./../action/analyze
with:
upload: false
upload-database: false

View File

@@ -11,40 +11,21 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- 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:
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@v5 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v5
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
with: with:
version: linked version: latest
- name: Check SARIF for default queries with Single include, Single exclude - name: Check SARIF for default queries with Single include, Single exclude
uses: ./../action/.github/actions/query-filter-test uses: ./../action/.github/actions/query-filter-test

View File

@@ -3,34 +3,20 @@ name: Rebuild Action
on: on:
pull_request: pull_request:
types: [labeled] types: [labeled]
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:
contents: write # needed to push rebuilt commit
pull-requests: write # needed to comment on the PR
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 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 +24,54 @@ 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 commit -am "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@v5
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.1.4
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

@@ -7,7 +7,7 @@ if [ ! -z "$(git status --porcelain)" ]; then
>&2 echo "Failed: Repo should be clean before testing!" >&2 echo "Failed: Repo should be clean before testing!"
exit 1 exit 1
fi fi
# Wipe the lib directory in case there are extra unnecessary files in there # Wipe the lib directory incase there are extra unnecessary files in there
rm -rf lib rm -rf lib
# Generate the JavaScript files # Generate the JavaScript files
npm run-script build npm run-script build
@@ -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

@@ -1,37 +0,0 @@
import os
import sys
EMPTY_CHANGELOG = 'No changes.\n\n'
# Prepare the changelog for the new release
# This function will extract the part of the changelog that
# we want to include in the new release.
def extract_changelog_snippet(changelog_file, version_tag):
output = ''
if (not os.path.exists(changelog_file)):
output = EMPTY_CHANGELOG
else:
with open(changelog_file, 'r') as f:
lines = f.readlines()
# Include everything up to, but excluding the second heading
found_first_section = False
for i, line in enumerate(lines):
if line.startswith('## '):
if found_first_section:
break
found_first_section = True
output += line
output += f"See the full [CHANGELOG.md](https://github.com/github/codeql-action/blob/{version_tag}/CHANGELOG.md) for more information."
return output
if len(sys.argv) < 3:
raise Exception('Expecting argument: changelog_file version_tag')
changelog_file = sys.argv[1]
version_tag = sys.argv[2]
print(extract_changelog_snippet(changelog_file, version_tag))

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,18 @@
if [ "$1" != "update" && "$1" != "check-only" ]; then
>&2 echo "Failed: Invalid argument. Must be 'update' or 'check-only'"
exit 1
fi
sudo 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")"
@@ -28,17 +27,11 @@ 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, and Update 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") | not)] | unique | sort')" CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") 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