Compare commits

...

121 Commits

Author SHA1 Message Date
Andrew Eisenberg
8f596b4ae3 Merge pull request #2254 from github/update-v3.25.2-4909c1ffb
Merge main into releases/v3
2024-04-22 13:33:59 -07:00
github-actions[bot]
de8916ec5a Update changelog for v3.25.2 2024-04-22 20:00:13 +00:00
dependabot[bot]
4909c1ffb9 Bump the npm group with 3 updates (#2253)
* Bump the npm group with 3 updates

Bumps the npm group with 3 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) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@octokit/types` from 13.4.0 to 13.4.1
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v13.4.0...v13.4.1)

Updates `@typescript-eslint/eslint-plugin` from 7.7.0 to 7.7.1
- [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/v7.7.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 7.7.0 to 7.7.1
- [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/v7.7.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  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>
2024-04-22 12:51:37 -07:00
Henry Mercer
f45390cde1 Merge pull request #2252 from github/henrymercer/failed-external-repo-config-error
Add configuration error for failing to clone external Git repo
2024-04-22 11:14:13 +01:00
Henry Mercer
1be8c488eb Add configuration error for failing to clone external Git repo 2024-04-19 19:44:05 +01:00
Koen Vlaswinkel
82edfe29ce Merge pull request #2246 from github/koesie10/remove-incorrect-log
Remove incorrect log message
2024-04-17 13:57:30 +02:00
Henry Mercer
8786e1f9a1 Merge pull request #2249 from github/mergeback/v3.25.1-to-main-c7f91257
Mergeback v3.25.1 refs/heads/releases/v3 into main
2024-04-17 12:32:26 +01:00
github-actions[bot]
3c7ac61481 Update checked-in dependencies 2024-04-17 11:14:37 +00:00
github-actions[bot]
b5bd9be6da Update changelog and version after v3.25.1 2024-04-17 10:57:12 +00:00
Henry Mercer
c7f9125735 Merge pull request #2248 from github/update-v3.25.1-c4fb45143
Merge main into releases/v3
2024-04-17 11:56:07 +01:00
github-actions[bot]
1c7e8b2cf2 Update changelog for v3.25.1 2024-04-17 10:35:01 +00:00
Koen Vlaswinkel
5d73b1bd71 Remove incorrect log message 2024-04-17 10:20:46 +02:00
Henry Mercer
c4fb451437 Merge pull request #2245 from github/henrymercer/ignore-already-specified-flags
Ensure `--overwrite` flag is only passed once
2024-04-16 20:07:08 +01:00
Henry Mercer
556b3bcfae Add changelog note 2024-04-16 19:03:11 +01:00
Henry Mercer
ef66aeacbf Merge branch 'main' into henrymercer/ignore-already-specified-flags 2024-04-16 19:01:20 +01:00
Henry Mercer
9b87e0a8c4 Merge pull request #2241 from github/nickfyson/speculative-script-fix
fix handling of backport changelog
2024-04-16 19:00:12 +01:00
Henry Mercer
18111b696b Merge pull request #2235 from github/henrymercer/autobuild-with-direct-tracing
Improve reliability and performance when using the `autobuild` build mode
2024-04-16 18:59:43 +01:00
Henry Mercer
ade98b980a Ensure --overwrite flag is only passed once 2024-04-16 18:10:18 +01:00
Henry Mercer
8566d50a79 Add regression test for double --overwrite 2024-04-16 18:10:17 +01:00
Nick Fyson
453a95695a Merge pull request #2243 from github/dependabot/npm_and_yarn/npm-9b31496ffc
Bump the npm group with 4 updates
2024-04-16 15:30:21 +01:00
Nick Fyson
c7a8056fc3 simplify while loop 2024-04-16 15:05:09 +01:00
Nick Fyson
71e6077db0 Merge branch 'main' into nickfyson/speculative-script-fix 2024-04-16 14:52:36 +01:00
Henry Mercer
db2b739f55 Fix PR link in changelog 2024-04-16 12:34:10 +01:00
Henry Mercer
b8e2556072 Merge pull request #2242 from github/henrymercer/even-more-configuration-errors
Add some more API-related configuration errors
2024-04-16 10:58:46 +01:00
github-actions[bot]
d8b8ad0cb2 Update checked-in dependencies 2024-04-15 18:20:40 +00:00
dependabot[bot]
fc090c44d2 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 13.1.0 to 13.4.0
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v13.1.0...v13.4.0)

Updates `@typescript-eslint/eslint-plugin` from 7.5.0 to 7.7.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/v7.7.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 7.5.0 to 7.7.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/v7.7.0/packages/parser)

Updates `typescript` from 5.4.4 to 5.4.5
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.4...v5.4.5)

---
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>
2024-04-15 18:18:46 +00:00
Henry Mercer
ea78e51e31 Merge branch 'main' into henrymercer/autobuild-with-direct-tracing 2024-04-15 18:29:26 +01:00
Henry Mercer
14eab9153b Improve changelog note 2024-04-15 18:28:21 +01:00
Henry Mercer
59771ddf53 Run PR check on Windows too 2024-04-15 18:26:58 +01:00
Henry Mercer
24b71bdbcc Merge pull request #2239 from github/mergeback/v3.25.0-to-main-df5a14dc
Mergeback v3.25.0 refs/heads/releases/v3 into main
2024-04-15 16:35:11 +01:00
Nick Fyson
f2c09fb28a fix handling of backport changelog 2024-04-15 15:54:09 +01:00
Henry Mercer
e006461bad Mark some upload-sarif errors as always configuration errors 2024-04-15 15:52:19 +01:00
github-actions[bot]
d37ec9a9ec Update checked-in dependencies 2024-04-15 14:31:18 +00:00
github-actions[bot]
1ae9ce7145 Update changelog and version after v3.25.0 2024-04-15 12:21:05 +00:00
Henry Mercer
df5a14dc28 Merge pull request #2238 from github/update-v3.25.0-2b2cee522
Merge main into releases/v3
2024-04-15 13:19:53 +01:00
Henry Mercer
a22989dcd4 Mark commit not found as a user error too 2024-04-15 13:14:52 +01:00
github-actions[bot]
3f70eaa4d3 Update changelog for v3.25.0 2024-04-15 10:57:47 +00:00
Michael B. Gale
2b2cee5229 Merge pull request #2234 from github/mbg/clearer-file-command-failure 2024-04-15 10:30:28 +01:00
Michael B. Gale
4fcf7a216c Add changelog entry 2024-04-12 21:43:00 +01:00
Henry Mercer
d30d1cabb4 Merge pull request #2237 from github/henrymercer/more-configuration-errors
Add some more configuration errors
2024-04-12 18:58:06 +01:00
Henry Mercer
f21d2d2d1a Merge branch 'main' into henrymercer/autobuild-with-direct-tracing 2024-04-12 18:35:07 +01:00
Henry Mercer
55585360a3 Add configuration error for unsupported build mode 2024-04-12 18:30:45 +01:00
Henry Mercer
fa75c144b4 Capture rate limit and ref not existing config errors 2024-04-12 18:25:10 +01:00
Henry Mercer
5a599c68cf Merge pull request #2236 from github/henrymercer/feature-flags-with-tool-feature-dependencies
Allow feature flags to specify tool feature requirements
2024-04-12 18:00:55 +01:00
Henry Mercer
aa4a08dd29 Add PR check for direct tracing 2024-04-12 17:48:45 +01:00
Henry Mercer
2eaad471b6 Add changelog note 2024-04-12 17:07:08 +01:00
Henry Mercer
cbe29f55df Run autobuild script via direct tracing when feature enabled 2024-04-12 17:07:08 +01:00
Henry Mercer
8f057a3d8e Apply network timeout fix to extraction with direct tracing 2024-04-12 17:07:08 +01:00
Henry Mercer
3d49faaabb Use extraction via build mode in autobuild Action when available 2024-04-12 17:07:08 +01:00
Henry Mercer
e37d0f3e7c Use direct tracing when autobuild build mode specified
Behind a flag, for now
2024-04-12 17:06:35 +01:00
Henry Mercer
5b74166227 Move BuildMode to util.ts 2024-04-12 16:37:13 +01:00
Henry Mercer
829376a618 Allow feature flags to specify tool feature requirements 2024-04-12 16:15:12 +01:00
Michael B. Gale
efc474680f Downgrade log levels for some messages to debug 2024-04-12 14:04:44 +01:00
Michael B. Gale
93f93fc2ad Include "Linux" in diagnostic name and message 2024-04-12 14:01:43 +01:00
Michael B. Gale
1ac88f37c7 Unconditionally report unwritten diagnostics at the end of the init Action 2024-04-12 14:00:33 +01:00
Michael B. Gale
3901d1208a Unify error messages in getFileType 2024-04-12 13:22:28 +01:00
Michael B. Gale
4b0172d9c2 Store diagnostics in memory until the database is available 2024-04-11 17:21:17 +01:00
Michael B. Gale
d4e7b0e493 Check that the database exists before writing diagnostics to it 2024-04-11 17:20:51 +01:00
Michael B. Gale
96f44cb9d2 Add integration test for new diagnostic 2024-04-11 17:20:51 +01:00
Michael B. Gale
1829b70201 Emit diagnostic if file is not installed 2024-04-11 17:20:48 +01:00
Michael B. Gale
8ea1a11e72 Produce a clearer error message when file is not installed 2024-04-11 12:57:47 +01:00
Henry Mercer
24a01703e4 Merge pull request #2232 from github/henrymercer/remove-support-codeql-2.12.5
Remove support for CodeQL 2.12.5 and earlier
2024-04-09 20:03:42 +01:00
Henry Mercer
987236cc0f Merge branch 'main' into henrymercer/remove-support-codeql-2.12.5 2024-04-09 18:57:26 +01:00
dependabot[bot]
287c064d05 Bump the npm group with 4 updates (#2230)
* 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.6.0 to 13.1.0
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v12.6.0...v13.1.0)

Updates `@typescript-eslint/eslint-plugin` from 7.4.0 to 7.5.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/v7.5.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 7.4.0 to 7.5.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/v7.5.0/packages/parser)

Updates `typescript` from 5.4.3 to 5.4.4
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.3...v5.4.4)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-major
  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

---------

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: Angela P Wen <angelapwen@github.com>
2024-04-09 17:26:48 +00:00
Henry Mercer
ee097cec19 Add changelog note 2024-04-09 18:26:42 +01:00
Henry Mercer
5e9199f7b4 Update language autodetect Swift check 2024-04-09 18:25:58 +01:00
Rasmus Wriedt Larsen
21eac7ce4e Merge pull request #2224 from github/RasmusWL/remove-python-dep-inst
Delete python dependency installation code
2024-04-09 14:07:45 +02:00
Henry Mercer
88fafebdd3 Update diagnostics export PR check to use 2.12.6 2024-04-09 12:32:29 +01:00
Henry Mercer
1a60a91726 Remove support for CodeQL v2.12.5 and earlier 2024-04-09 12:29:14 +01:00
Henry Mercer
2f0d0eaebd Update PR checks 2024-04-09 12:19:26 +01:00
Henry Mercer
8f1e24411b Bump minimum CodeQL Bundle version to 2.12.6 2024-04-09 12:19:20 +01:00
Henry Mercer
33e3a7c976 Merge branch 'main' into RasmusWL/remove-python-dep-inst 2024-04-09 11:59:59 +01:00
Henry Mercer
84efe241da Merge pull request #2231 from github/redsun82/setup-swift-fix
CI: apply `setup-swift` workaround
2024-04-09 11:59:24 +01:00
github-actions[bot]
218c52e7c7 Rebuild 2024-04-09 10:47:15 +00:00
Henry Mercer
dd2106d0d1 Merge branch 'main' into RasmusWL/remove-python-dep-inst 2024-04-09 11:45:03 +01:00
Rasmus Wriedt Larsen
3d026bcb8d Apply suggestions from code review
Co-authored-by: Henry Mercer <henrymercer@github.com>
2024-04-09 12:28:29 +02:00
Paolo Tranquilli
f242fc9172 CI: apply setup-swift workaround 2024-04-09 10:28:58 +02:00
Andrew Eisenberg
24a95a0411 Merge pull request #2229 from github/aeisenberg/add-overwrite
Add the overwrite flag when init-ing databases
2024-04-08 10:38:24 -07:00
Rasmus Wriedt Larsen
7c23a5e578 Fix lint 2024-04-08 13:05:34 +02:00
Rasmus Wriedt Larsen
746a1af6ad Rebuild 2024-04-08 12:02:58 +02:00
Rasmus Wriedt Larsen
1f8d877ef2 fix comment 2024-04-08 12:02:45 +02:00
Rasmus Wriedt Larsen
140158642f Update CHANGELOG wording
Co-authored-by: Henry Mercer <henrymercer@github.com>
2024-04-08 12:01:54 +02:00
Rasmus Wriedt Larsen
3f0cb87e80 Improve Python dep inst warning
Co-authored-by: Henry Mercer <henrymercer@github.com>
2024-04-08 12:01:41 +02:00
Rasmus Wriedt Larsen
d33e75159d Warn on deprecated Python dep inst config usage 2024-04-08 11:58:31 +02:00
Rasmus Wriedt Larsen
e94a917e33 bump minor version 2024-04-08 11:57:44 +02:00
github-actions[bot]
bcb5e6e0b8 Rebuild 2024-04-08 09:27:23 +00:00
Rasmus Wriedt Larsen
fcdff8b3c9 Update changelog 2024-04-08 10:47:30 +02:00
Rasmus Wriedt Larsen
e6b2c0d6b8 Python: suppress dependency extraction warning
See https://github.com/github/codeql/pull/16127 (which will be released
as part of 2.17.1)
2024-04-08 10:44:12 +02:00
Rasmus Wriedt Larsen
4e8e3439dd Merge branch 'main' into RasmusWL/remove-python-dep-inst 2024-04-08 10:25:42 +02:00
Rasmus Wriedt Larsen
f0a5e52d93 Restore python-setup/check_python12.ps1
I think we can delete this logic too, but let's deal with that in a
separate PR
2024-04-08 10:22:09 +02:00
Andrew Eisenberg
4a666f8539 Add the overwrite flag when init-ing databases
This ensures that if there is a database already in the filesystem, we
can gracefully handle creating a new one. This sometimes happens when
a user is on a self-hosted runner and neglects to clean state across
runs.
2024-04-05 15:02:18 -07:00
Chuan-kai Lin
1c270d01c7 Merge pull request #2227 from github/mergeback/v3.24.10-to-main-4355270b
Mergeback v3.24.10 refs/heads/releases/v3 into main
2024-04-05 08:26:22 -07:00
github-actions[bot]
11eab0d2e6 Update checked-in dependencies 2024-04-05 15:04:02 +00:00
github-actions[bot]
f64694af39 Update changelog and version after v3.24.10 2024-04-05 15:01:33 +00:00
Chuan-kai Lin
4355270be1 Merge pull request #2226 from github/update-v3.24.10-7df281f2f
Merge main into releases/v3
2024-04-05 07:59:34 -07:00
github-actions[bot]
3f041c51a5 Update changelog for v3.24.10 2024-04-05 14:03:20 +00:00
Angela P Wen
7df281f2fe Gracefully continue if createStatusReportBase throws (#2225)
Previously, we weren't catching any possible exceptions in `createStatusReportBase` and runs would fail if any of the telemetry sub-items threw exceptions. As telemetry should not block the analysis, we continue here even if the status report throws.
2024-04-04 15:26:14 -07:00
Angela P Wen
f421cda8e7 Run integration test PR checks nightly (#2222)
* Run integration test PR checks nightly

Scheduled for 5AM UTC. This will assist in catching bugs introduced with new runner images.

* Specify generated YAML indentations

For consistency with our non-autogenerated files and GitHub documentation, we should further indent items in lists (`sequence`).
2024-04-04 10:30:18 -07:00
Nick Fyson
5f535debfe Merge pull request #2221 from github/nickfyson/upload-logging
improve logging coverage during sarif upload
2024-04-04 17:30:55 +01:00
Chuan-kai Lin
278465cdfb Merge pull request #2219 from github/update-bundle/codeql-bundle-v2.17.0
Update default bundle to 2.17.0
2024-04-04 08:20:40 -07:00
Rasmus Wriedt Larsen
e0bc6b7942 Delete python-setup/ 2024-04-04 17:16:05 +02:00
Rasmus Wriedt Larsen
6ab7733abd build 2024-04-04 17:15:39 +02:00
Rasmus Wriedt Larsen
d8293662f4 Fix linting errors 2024-04-04 17:14:42 +02:00
Rasmus Wriedt Larsen
9ba21c3639 Autoformat 2024-04-04 17:13:31 +02:00
Rasmus Wriedt Larsen
c7eea240e2 Remove python dependency installation logic
I've left a few warning logging cases, but overall this feature is no
longer supported.
2024-04-04 17:12:58 +02:00
Chuan-kai Lin
65e69c8a4b Merge branch 'main' into update-bundle/codeql-bundle-v2.17.0 2024-04-04 07:23:39 -07:00
nickfyson
c037115ddf clarify logging in response to pr review comments 2024-04-03 21:19:06 +01:00
nickfyson
d3c32a84cb fix test to respect updated logging behaviour 2024-04-03 21:04:50 +01:00
Nick Fyson
26540626a5 Merge branch 'main' into nickfyson/upload-logging 2024-04-03 20:54:58 +01:00
nickfyson
d3257627d7 fix linting error 2024-04-03 20:50:03 +01:00
nickfyson
978bdd643f fix test that runs flakily locally 2024-04-03 20:43:26 +01:00
Nick Fyson
2cc8bbd0e0 Apply suggestions from code review
Co-authored-by: Henry Mercer <henrymercer@github.com>
2024-04-03 20:42:48 +01:00
Henry Mercer
3bd9c3e65c Merge pull request #2220 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2024-04-03 18:06:05 +01:00
Henry Mercer
dcf00b3fd4 Account for varying major version number in error message 2024-04-03 15:50:23 +01:00
Henry Mercer
f8dd543c81 Add changelog note 2024-04-03 15:48:31 +01:00
nickfyson
6514cbb626 improve logging coverage when uploaing sarif files 2024-04-03 15:45:28 +01:00
Henry Mercer
f06c933b16 Update soon to be deprecated CodeQL version 2024-04-03 15:44:00 +01:00
Henry Mercer
eda4878a3d Only pass --new-analysis-summary if it is not default behavior 2024-04-03 15:39:22 +01:00
github-actions[bot]
eeaea14a62 Update supported GitHub Enterprise Server versions 2024-04-03 00:11:45 +00:00
github-actions[bot]
ec214df87a Add changelog note 2024-04-02 19:07:27 +00:00
github-actions[bot]
f4936c4c20 Update default bundle to codeql-bundle-v2.17.0 2024-04-02 19:07:23 +00:00
358 changed files with 11268 additions and 10884 deletions

View File

@@ -33,7 +33,7 @@ runs:
fi fi
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
- uses: swift-actions/setup-swift@e1dca7c4a36344146bbc2803f0d538462477bb37 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test. - uses: redsun82/setup-swift@b2b6f77ab14f6a9b136b520dc53ec8eca27d2b99 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null' if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
with: with:
swift-version: "${{ steps.get_swift_version.outputs.version }}" swift-version: "${{ steps.get_swift_version.outputs.version }}"

View File

@@ -186,16 +186,17 @@ 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
while True: found_first_section = False
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}')
# we have found the first section, so now handle things differently found_first_section = True
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

View File

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
all-platform-bundle: all-platform-bundle:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: All-platform bundle name: All-platform bundle
permissions: permissions:
contents: read contents: read
@@ -34,44 +36,38 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'true'
version: ${{ matrix.version }} - id: init
use-all-platform-bundle: 'true' uses: ./../action/init
- name: Set environment variable for Swift enablement with:
if: runner.os != 'Windows' && matrix.version == '20221211' tools: ${{ steps.prepare-test.outputs.tools-url }}
shell: bash - uses: ./../action/.github/actions/setup-swift
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV with:
- id: init codeql-path: ${{ steps.init.outputs.codeql-path }}
uses: ./../action/init - name: Build code
with: shell: bash
tools: ${{ steps.prepare-test.outputs.tools-url }} run: ./build.sh
- uses: ./../action/.github/actions/setup-swift - uses: ./../action/analyze
with: with:
codeql-path: ${{ steps.init.outputs.codeql-path }} upload-database: false
- 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

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
analyze-ref-input: analyze-ref-input:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
name: "Analyze: 'ref' and 'sha' from inputs" name: "Analyze: 'ref' and 'sha' from inputs"
permissions: permissions:
contents: read contents: read
@@ -38,45 +40,39 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement tools: ${{ steps.prepare-test.outputs.tools-url }}
if: runner.os != 'Windows' && matrix.version == '20221211' languages: cpp,csharp,java,javascript,python
shell: bash config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV github.sha }}
- uses: ./../action/init - name: Build code
with: shell: bash
tools: ${{ steps.prepare-test.outputs.tools-url }} run: ./build.sh
languages: cpp,csharp,java,javascript,python - uses: ./../action/analyze
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ with:
github.sha }} upload-database: false
- name: Build code ref: refs/heads/main
shell: bash sha: 5e235361806c361d4d3f8859e3c897658025a9a2
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

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
autobuild-action: autobuild-action:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
name: autobuild-action name: autobuild-action
permissions: permissions:
contents: read contents: read
@@ -38,55 +40,49 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement languages: csharp
if: runner.os != 'Windows' && matrix.version == '20221211' tools: ${{ steps.prepare-test.outputs.tools-url }}
shell: bash - uses: ./../action/autobuild
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV 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
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d csharp ]]; then if [[ ! -d csharp ]]; then
echo "Did not find a C# database" echo "Did not find a C# database"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

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

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

View File

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-autobuild: build-mode-autobuild:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode autobuild name: Build mode autobuild
permissions: permissions:
contents: read contents: read
@@ -34,55 +36,49 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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 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/* .
matrix.version == 'stable-v2.14.6') - uses: ./../action/init
with: id: init
python-version: '3.11' with:
- name: Check out repository build-mode: autobuild
uses: actions/checkout@v4 db-location: ${{ runner.temp }}/customDbLocation
- name: Prepare test languages: java
id: prepare-test tools: ${{ steps.prepare-test.outputs.tools-url }}
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 - name: Validate database build mode
id: init run: |
with: metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build-mode: autobuild build_mode=$(yq eval '.buildMode' "$metadata_path")
db-location: ${{ runner.temp }}/customDbLocation if [[ "$build_mode" != "autobuild" ]]; then
languages: java echo "Expected build mode to be 'autobuild' but was $build_mode"
tools: ${{ steps.prepare-test.outputs.tools-url }} exit 1
fi
- name: Validate database build mode - uses: ./../action/analyze
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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-manual: build-mode-manual:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode manual name: Build mode manual
permissions: permissions:
contents: read contents: read
@@ -34,57 +36,51 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- uses: ./../action/init
id: init
with:
build-mode: manual
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
matrix.version == 'stable-v2.14.6') - name: Validate database build mode
with: run: |
python-version: '3.11' metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
- name: Check out repository build_mode=$(yq eval '.buildMode' "$metadata_path")
uses: actions/checkout@v4 if [[ "$build_mode" != "manual" ]]; then
- name: Prepare test echo "Expected build mode to be 'manual' but was $build_mode"
id: prepare-test exit 1
uses: ./.github/actions/prepare-test fi
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 - uses: ./../action/.github/actions/setup-swift
run: | with:
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" codeql-path: ${{ steps.init.outputs.codeql-path }}
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 - name: Build code
with: shell: bash
codeql-path: ${{ steps.init.outputs.codeql-path }} run: ./build.sh
- name: Build code - uses: ./../action/analyze
shell: bash
run: ./build.sh
- uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,24 +11,26 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-none: build-mode-none:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode none name: Build mode none
permissions: permissions:
contents: read contents: read
@@ -36,53 +38,47 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- uses: ./../action/init
id: init
with:
build-mode: none
db-location: ${{ runner.temp }}/customDbLocation
languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }}
matrix.version == 'stable-v2.14.6') - name: Validate database build mode
with: run: |
python-version: '3.11' metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
- name: Check out repository build_mode=$(yq eval '.buildMode' "$metadata_path")
uses: actions/checkout@v4 if [[ "$build_mode" != "none" ]]; then
- name: Prepare test echo "Expected build mode to be 'none' but was $build_mode"
id: prepare-test exit 1
uses: ./.github/actions/prepare-test fi
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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-rollback: build-mode-rollback:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode rollback name: Build mode rollback
permissions: permissions:
contents: read contents: read
@@ -34,56 +36,50 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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 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/* .
matrix.version == 'stable-v2.14.6') - uses: ./../action/init
with: id: init
python-version: '3.11' with:
- name: Check out repository build-mode: none
uses: actions/checkout@v4 db-location: ${{ runner.temp }}/customDbLocation
- name: Prepare test languages: java
id: prepare-test tools: ${{ steps.prepare-test.outputs.tools-url }}
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 - name: Validate database build mode
id: init run: |
with: metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build-mode: none build_mode=$(yq eval '.buildMode' "$metadata_path")
db-location: ${{ runner.temp }}/customDbLocation if [[ "$build_mode" != "autobuild" ]]; then
languages: java echo "Expected build mode to be 'autobuild' but was $build_mode"
tools: ${{ steps.prepare-test.outputs.tools-url }} exit 1
fi
- name: Validate database build mode - uses: ./../action/analyze
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

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

@@ -11,32 +11,34 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
config-export: config-export:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- 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: Config export name: Config export
permissions: permissions:
contents: read contents: read
@@ -44,72 +46,66 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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');
matrix.version == 'stable-v2.14.6') const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
with: const run = sarif.runs[0];
python-version: '3.11' const configSummary = run.properties.codeqlConfigSummary;
- 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
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')); if (configSummary === undefined) {
const run = sarif.runs[0]; core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.');
const configSummary = run.properties.codeqlConfigSummary; }
if (configSummary.disableDefaultQueries !== false) {
if (configSummary === undefined) { core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' +
core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.'); `${JSON.stringify(configSummary.disableDefaultQueries)}.`);
} }
if (configSummary.disableDefaultQueries !== false) { const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }];
core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' + // Use JSON.stringify to deep-equal the arrays.
`${JSON.stringify(configSummary.disableDefaultQueries)}.`); if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) {
} core.setFailed(`\`queries\` property incorrect: expected ${JSON.stringify(expectedQueries)}, got ` +
const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }]; `${JSON.stringify(configSummary.queries)}.`);
// Use JSON.stringify to deep-equal the arrays. }
if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) { core.info('Finished config export tests.');
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

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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
config-input: config-input:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Config input name: Config input
permissions: permissions:
contents: read contents: read
@@ -34,59 +36,53 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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: Copy queries into workspace
run: |
cp -a ../action/queries .
matrix.version == 'stable-v2.14.6') - uses: ./../action/init
with: with:
python-version: '3.11' tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check out repository languages: javascript
uses: actions/checkout@v4 build-mode: none
- name: Prepare test config: |
id: prepare-test disable-default-queries: true
uses: ./.github/actions/prepare-test queries:
with: - name: Run custom query
version: ${{ matrix.version }} uses: ./queries/default-setup-environment-variables.ql
use-all-platform-bundle: 'false' paths-ignore:
- name: Set environment variable for Swift enablement - tests
if: runner.os != 'Windows' && matrix.version == '20221211' - lib
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 - uses: ./../action/analyze
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} output: ${{ runner.temp }}/results
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 - name: Check SARIF
with: uses: ./../action/.github/actions/check-sarif
output: ${{ runner.temp }}/results with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
- name: Check SARIF queries-run: javascript/codeql-action/default-setup-env-vars
uses: ./../action/.github/actions/check-sarif queries-not-run: javascript/codeql-action/default-setup-context-properties
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

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
cpp-deptrace-disabled: cpp-deptrace-disabled:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest 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)'
permissions: permissions:
contents: read contents: read
@@ -38,51 +40,45 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Test setup
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement run: |
if: runner.os != 'Windows' && matrix.version == '20221211' cp -a ../action/tests/cpp-autobuild autobuild-dir
shell: bash - uses: ./../action/init
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV with:
- name: Test setup languages: cpp
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: | - uses: ./../action/autobuild
cp -a ../action/tests/cpp-autobuild autobuild-dir with:
- uses: ./../action/init working-directory: autobuild-dir
with: env:
languages: cpp CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
tools: ${{ steps.prepare-test.outputs.tools-url }} - shell: bash
- uses: ./../action/autobuild run: |
with: if ls /usr/bin/errno; then
working-directory: autobuild-dir echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled."
env: exit 1
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false fi
- 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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
cpp-deptrace-enabled-on-macos: cpp-deptrace-enabled-on-macos:
strategy: strategy:
matrix: matrix:
include: include:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: autoinstalling dependencies is skipped (macOS)' name: 'C/C++: autoinstalling dependencies is skipped (macOS)'
permissions: permissions:
contents: read contents: read
@@ -34,53 +36,47 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Test setup
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement run: |
if: runner.os != 'Windows' && matrix.version == '20221211' cp -a ../action/tests/cpp-autobuild autobuild-dir
shell: bash - uses: ./../action/init
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV with:
- name: Test setup languages: cpp
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: | - uses: ./../action/autobuild
cp -a ../action/tests/cpp-autobuild autobuild-dir with:
- uses: ./../action/init working-directory: autobuild-dir
with: env:
languages: cpp CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
tools: ${{ steps.prepare-test.outputs.tools-url }} - shell: bash
- uses: ./../action/autobuild run: |
with: if ! ls /usr/bin/errno; then
working-directory: autobuild-dir echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS"
env: else
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS"
- shell: bash exit 1
run: | fi
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

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
cpp-deptrace-enabled: cpp-deptrace-enabled:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest 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)'
permissions: permissions:
contents: read contents: read
@@ -38,51 +40,45 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Test setup
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement run: |
if: runner.os != 'Windows' && matrix.version == '20221211' cp -a ../action/tests/cpp-autobuild autobuild-dir
shell: bash - uses: ./../action/init
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV with:
- name: Test setup languages: cpp
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: | - uses: ./../action/autobuild
cp -a ../action/tests/cpp-autobuild autobuild-dir with:
- uses: ./../action/init working-directory: autobuild-dir
with: env:
languages: cpp CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
tools: ${{ steps.prepare-test.outputs.tools-url }} - shell: bash
- uses: ./../action/autobuild run: |
with: if ! ls /usr/bin/errno; then
working-directory: autobuild-dir echo "Did not autoinstall errno"
env: exit 1
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true fi
- 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

@@ -11,38 +11,40 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
diagnostics-export: diagnostics-export:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230317 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20230317 version: stable-20230403
- os: windows-latest - os: windows-latest
version: stable-20230317 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- 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: Diagnostic export name: Diagnostic export
permissions: permissions:
contents: read contents: read
@@ -50,113 +52,107 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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.6 that
# produces an invalid diagnostic with multiple identical location objects.
"$CODEQL_PATH" database add-diagnostic \
"$RUNNER_TEMP/codeql_databases/javascript" \
--file-path /path/to/file \
--plaintext-message "Plaintext message $i" \
--source-id "lang/diagnostics/example" \
--source-name "Diagnostic name" \
--ready-for-status-page
done
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostics appear in SARIF
uses: actions/github-script@v7
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
matrix.version == 'stable-v2.14.6') function checkStatusPageNotification(n) {
with: const expectedMessage = 'Plaintext message 1\n\nCodeQL also found 1 other diagnostic like this. See the workflow log for details.';
python-version: '3.11' if (n.message.text !== expectedMessage) {
- name: Check out repository core.setFailed(`Expected the status page diagnostic to have the message '${expectedMessage}', but found '${n.message.text}'.`);
uses: actions/checkout@v4 }
- name: Prepare test if (n.locations.length !== 1) {
id: prepare-test core.setFailed(`Expected the status page diagnostic to have exactly 1 location, but found ${n.locations.length}.`);
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 \
"$RUNNER_TEMP/codeql_databases/javascript" \
--file-path /path/to/file \
--plaintext-message "Plaintext message $i" \
--source-id "lang/diagnostics/example" \
--source-name "Diagnostic name" \
--ready-for-status-page
done
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostics appear in SARIF
uses: actions/github-script@v7
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
function checkStatusPageNotification(n) {
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) {
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}.`); 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 === '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)}.`
);
} }
} checkStatusPageNotification(statusPageNotifications[0]);
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); const notifications = run.tool.driver.notifications;
const run = sarif.runs[0]; const diagnosticNotification = notifications.filter(n =>
n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' &&
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications; n.fullDescription.text === 'Diagnostic name'
const statusPageNotifications = toolExecutionNotifications.filter(n =>
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 (diagnosticNotification.length !== 1) {
checkStatusPageNotification(statusPageNotifications[0]); 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)}.`
);
}
const notifications = run.tool.driver.notifications; core.info('Finished diagnostic export test');
const diagnosticNotification = notifications.filter(n =>
n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' &&
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)}.`
);
}
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

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
export-file-baseline-information: export-file-baseline-information:
strategy: strategy:
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
permissions: permissions:
contents: read contents: read
@@ -38,72 +40,66 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' id: init
- name: Set environment variable for Swift enablement with:
if: runner.os != 'Windows' && matrix.version == '20221211' languages: javascript
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV - uses: ./../action/.github/actions/setup-swift
- uses: ./../action/init with:
id: init codeql-path: ${{ steps.init.outputs.codeql-path }}
with: - name: Build code
languages: javascript shell: bash
tools: ${{ steps.prepare-test.outputs.tools-url }} run: ./build.sh
- uses: ./../action/.github/actions/setup-swift - uses: ./../action/analyze
with: with:
codeql-path: ${{ steps.init.outputs.codeql-path }} output: ${{ runner.temp }}/results
- name: Build code - name: Upload SARIF
shell: bash uses: actions/upload-artifact@v3
run: ./build.sh with:
- uses: ./../action/analyze name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
with: path: ${{ runner.temp }}/results/javascript.sarif
output: ${{ runner.temp }}/results retention-days: 7
- name: Upload SARIF - name: Check results
uses: actions/upload-artifact@v3 shell: bash
with: run: |
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json cd "$RUNNER_TEMP/results"
path: ${{ runner.temp }}/results/javascript.sarif expected_baseline_languages="c csharp go java kotlin javascript python ruby"
retention-days: 7 if [[ $RUNNER_OS != "Windows" ]]; then
- name: Check results expected_baseline_languages+=" swift"
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 fi
done
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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
extractor-ram-threads: extractor-ram-threads:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Extractor ram and threads options test name: Extractor ram and threads options test
permissions: permissions:
contents: read contents: read
@@ -34,55 +36,49 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement languages: java
if: runner.os != 'Windows' && matrix.version == '20221211' ram: 230
shell: bash threads: 1
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV - name: Assert Results
- uses: ./../action/init shell: bash
with: run: |
languages: java if [ "${CODEQL_RAM}" != "230" ]; then
ram: 230 echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230"
threads: 1 exit 1
- name: Assert Results fi
shell: bash if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then
run: | echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230"
if [ "${CODEQL_RAM}" != "230" ]; then exit 1
echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230" fi
exit 1 if [ "${CODEQL_THREADS}" != "1" ]; then
fi echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1"
if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then exit 1
echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230" fi
exit 1 if [ "${CODEQL_EXTRACTOR_JAVA_THREADS}" != "1" ]; then
fi echo "CODEQL_EXTRACTOR_JAVA_THREADS is '${CODEQL_EXTRACTOR_JAVA_THREADS}' instead of 1"
if [ "${CODEQL_THREADS}" != "1" ]; then exit 1
echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1" fi
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

View File

@@ -11,62 +11,70 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-custom-queries: go-custom-queries:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: windows-latest - os: windows-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: windows-latest - os: windows-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: windows-latest - os: windows-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: windows-latest - os: windows-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: windows-latest - os: windows-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- os: windows-latest - os: windows-latest
version: nightly-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'
permissions: permissions:
contents: read contents: read
@@ -74,43 +82,37 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement languages: go
if: runner.os != 'Windows' && matrix.version == '20221211' config-file: ./.github/codeql/custom-queries.yml
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV - name: Build code
- uses: ./../action/init shell: bash
with: run: ./build.sh
languages: go - uses: ./../action/analyze
config-file: ./.github/codeql/custom-queries.yml with:
tools: ${{ steps.prepare-test.outputs.tools-url }} upload-database: false
- 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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-indirect-tracing-workaround-diagnostic: go-indirect-tracing-workaround-diagnostic:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 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'
permissions: permissions:
contents: read contents: read
@@ -34,73 +36,67 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: actions/setup-go@v5
use-all-platform-bundle: 'false' with:
- 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 # We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0' go-version: '>=1.21.0'
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
# Deliberately change Go after the `init` step # Deliberately change Go after the `init` step
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: '1.20' go-version: '1.20'
- name: Build code - name: Build code
shell: bash shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check diagnostic appears in SARIF - name: Check diagnostic appears in SARIF
uses: actions/github-script@v7 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/go.sarif SARIF_PATH: ${{ runner.temp }}/results/go.sarif
with: with:
script: | script: |
const fs = require('fs'); 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

@@ -0,0 +1,103 @@
# 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 - Go: diagnostic when `file` is not installed'
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
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
go-indirect-tracing-workaround-no-file-program:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-v2.14.6
name: 'Go: diagnostic when `file` is not installed'
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-20230403' ||
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'
- uses: actions/setup-go@v5
with:
# We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0'
- 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
shell: bash
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@v7
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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-indirect-tracing-workaround: go-indirect-tracing-workaround:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
name: 'Go: workaround for indirect tracing' name: 'Go: workaround for indirect tracing'
permissions: permissions:
contents: read contents: read
@@ -34,71 +36,65 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: actions/setup-go@v5
use-all-platform-bundle: 'false' with:
- 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 # We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0' go-version: '>=1.21.0'
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \ echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
"CODEQL_ACTION_GO_BINARY environment variable is not set." "CODEQL_ACTION_GO_BINARY environment variable is not set."
exit 1 exit 1
fi fi
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist." echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
exit 1 exit 1
fi 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

@@ -11,48 +11,54 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-tracing-autobuilder: go-tracing-autobuilder:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: 'Go: tracing with autobuilder step' name: 'Go: tracing with autobuilder step'
permissions: permissions:
contents: read contents: read
@@ -60,58 +66,52 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: actions/setup-go@v5
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement go-version: ~1.22.0
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:
go-version: ~1.22.0
# to avoid potentially misleading autobuilder results where we expect it to download # to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache # dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
echo "Expected the Go autobuilder to be run, but the" \ echo "Expected the Go autobuilder to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true." "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true."
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:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,48 +11,54 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-tracing-custom-build-steps: go-tracing-custom-build-steps:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- 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'
permissions: permissions:
contents: read contents: read
@@ -60,62 +66,56 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: actions/setup-go@v5
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement go-version: ~1.22.0
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:
go-version: ~1.22.0
# to avoid potentially misleading autobuilder results where we expect it to download # to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache # dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
# Once we start running Bash 4.2 in all environments, we can replace the # Once we start running Bash 4.2 in all environments, we can replace the
# `! -z` flag with the more elegant `-v` which confirms that the variable # `! -z` flag with the more elegant `-v` which confirms that the variable
# is actually unset and not potentially set to a blank value. # is actually unset and not potentially set to a blank value.
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

@@ -11,48 +11,54 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-tracing-legacy-workflow: go-tracing-legacy-workflow:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: 'Go: tracing with legacy workflow' name: 'Go: tracing with legacy workflow'
permissions: permissions:
contents: read contents: read
@@ -60,52 +66,46 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: actions/setup-go@v5
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement go-version: ~1.22.0
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:
go-version: ~1.22.0
# to avoid potentially misleading autobuilder results where we expect it to download # to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache # dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then if [[ ! -d go ]]; then
echo "Did not find a Go database" echo "Did not find a Go database"
exit 1 exit 1
fi 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

@@ -11,38 +11,40 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
init-with-registries: init-with-registries:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- 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: 'Packaging: Download using registries' name: 'Packaging: Download using registries'
permissions: permissions:
contents: read contents: read
@@ -51,94 +53,88 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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: 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 }}"
matrix.version == 'stable-v2.14.6') - name: Verify packages installed
with: shell: bash
python-version: '3.11' run: |
- name: Check out repository PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack"
uses: actions/checkout@v4 CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1"
- 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: 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 if [[ -d $PRIVATE_PACK ]]
shell: bash then
run: | echo "$PRIVATE_PACK was installed."
PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack" else
CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1" echo "::error $PRIVATE_PACK pack was not installed."
exit 1
fi
if [[ -d $PRIVATE_PACK ]] if [[ -d $CODEQL_PACK1 ]]
then then
echo "$PRIVATE_PACK was installed." echo "$CODEQL_PACK1 was installed."
else else
echo "::error $PRIVATE_PACK pack was not installed." echo "::error $CODEQL_PACK1 pack was not installed."
exit 1 exit 1
fi fi
if [[ -d $CODEQL_PACK1 ]] - name: Verify qlconfig.yml file was created
then shell: bash
echo "$CODEQL_PACK1 was installed." run: |
else QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
echo "::error $CODEQL_PACK1 pack was not installed." echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH"
exit 1 if [[ -f $QLCONFIG_PATH ]]
fi then
echo "qlconfig.yml file was created."
else
echo "::error qlconfig.yml file was not created."
exit 1
fi
- name: Verify qlconfig.yml file was created - name: Verify contents of qlconfig.yml
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 # yq is not available on windows
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: bash shell: bash
run: | run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")' cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")'
if [[ $? -eq 0 ]] if [[ $? -eq 0 ]]
then then
echo "Registry was added to qlconfig.yml file." echo "Registry was added to qlconfig.yml file."
else else
echo "::error Registry was not added to qlconfig.yml file." echo "::error Registry was not added to qlconfig.yml file."
echo "Contents of qlconfig.yml file:" echo "Contents of qlconfig.yml file:"
cat $QLCONFIG_PATH cat $QLCONFIG_PATH
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
javascript-source-root: javascript-source-root:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest 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
permissions: permissions:
contents: read contents: read
@@ -38,54 +40,48 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Move codeql-action
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement run: |
if: runner.os != 'Windows' && matrix.version == '20221211' mkdir ../new-source-root
shell: bash mv * ../new-source-root
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV - uses: ./../action/init
- name: Move codeql-action with:
shell: bash languages: javascript
run: | source-root: ../new-source-root
mkdir ../new-source-root tools: ${{ steps.prepare-test.outputs.tools-url }}
mv * ../new-source-root - uses: ./../action/analyze
- uses: ./../action/init with:
with: upload-database: false
languages: javascript skip-queries: true
source-root: ../new-source-root upload: never
tools: ${{ steps.prepare-test.outputs.tools-url }} - name: Assert database exists
- uses: ./../action/analyze shell: bash
with: run: |
upload-database: false cd "$RUNNER_TEMP/codeql_databases"
skip-queries: true if [[ ! -d javascript ]]; then
upload: never echo "Did not find a JavaScript database"
- name: Assert database exists exit 1
shell: bash fi
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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
language-aliases: language-aliases:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Language aliases name: Language aliases
permissions: permissions:
contents: read contents: read
@@ -34,46 +36,40 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- uses: ./../action/init
with:
languages: C#,java-kotlin,swift,typescript
tools: ${{ steps.prepare-test.outputs.tools-url }}
matrix.version == 'stable-v2.14.6') - name: Check languages
with: run: |
python-version: '3.11' expected_languages="csharp,java,swift,javascript"
- name: Check out repository actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
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 if [ "$expected_languages" != "$actual_languages" ]; then
run: | echo "Resolved languages did not match expected list. " \
expected_languages="csharp,java,swift,javascript" "Expected languages: $expected_languages. Actual languages: $actual_languages."
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config) exit 1
fi
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

View File

@@ -11,48 +11,54 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
multi-language-autodetect: multi-language-autodetect:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Multi-language repository name: Multi-language repository
permissions: permissions:
contents: read contents: read
@@ -60,100 +66,92 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
matrix.version == 'stable-v2.14.6') - uses: ./../action/.github/actions/setup-swift
with: with:
python-version: '3.11' codeql-path: ${{ steps.init.outputs.codeql-path }}
- 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 - name: Build code
with: shell: bash
codeql-path: ${{ steps.init.outputs.codeql-path }} run: ./build.sh
- name: Build code - uses: ./../action/analyze
shell: bash id: analysis
run: ./build.sh with:
upload-database: false
- uses: ./../action/analyze - name: Check language autodetect for all languages excluding Swift
id: analysis shell: bash
with: run: |
upload-database: false 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 all languages excluding Swift - name: Check language autodetect for Swift
shell: bash if: runner.os != 'Windows' && matrix.version != 'stable-20230403'
run: | shell: bash
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} run: |
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
echo "Did not create a database for CPP, or created it in the wrong location." if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
exit 1 echo "Did not create a database for Swift, or created it in the wrong location."
fi exit 1
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} fi
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_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-codescanning-config-inputs-js: packaging-codescanning-config-inputs-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-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
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Config and input passed to the CLI' name: 'Packaging: Config and input passed to the CLI'
permissions: permissions:
contents: read contents: read
@@ -50,67 +52,61 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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
matrix.version == 'stable-v2.14.6') - name: Check results
with: uses: ./../action/.github/actions/check-sarif
python-version: '3.11' with:
- name: Check out repository sarif-file: ${{ runner.temp }}/results/javascript.sarif
uses: actions/checkout@v4 queries-run:
- name: Prepare test javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
id: prepare-test queries-not-run: foo,bar
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 - name: Assert Results
uses: ./../action/.github/actions/check-sarif shell: bash
with: run: |
sarif-file: ${{ runner.temp }}/results/javascript.sarif cd "$RUNNER_TEMP/results"
queries-run: # We should have 4 hits from these rules
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block EXPECTED_RULES="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 # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
shell: bash RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
run: | echo "Found matching rules '$RULES'"
cd "$RUNNER_TEMP/results" if [ "$RULES" != "$EXPECTED_RULES" ]; then
# We should have 4 hits from these rules echo "Did not match expected rules '$EXPECTED_RULES'."
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" exit 1
fi
# 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

@@ -11,38 +11,40 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-config-inputs-js: packaging-config-inputs-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-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
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Config and input' name: 'Packaging: Config and input'
permissions: permissions:
contents: read contents: read
@@ -50,67 +52,61 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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
matrix.version == 'stable-v2.14.6') - name: Check results
with: uses: ./../action/.github/actions/check-sarif
python-version: '3.11' with:
- name: Check out repository sarif-file: ${{ runner.temp }}/results/javascript.sarif
uses: actions/checkout@v4 queries-run:
- name: Prepare test javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
id: prepare-test queries-not-run: foo,bar
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 - name: Assert Results
uses: ./../action/.github/actions/check-sarif shell: bash
with: run: |
sarif-file: ${{ runner.temp }}/results/javascript.sarif cd "$RUNNER_TEMP/results"
queries-run: # We should have 4 hits from these rules
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block EXPECTED_RULES="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 # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
shell: bash RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
run: | echo "Found matching rules '$RULES'"
cd "$RUNNER_TEMP/results" if [ "$RULES" != "$EXPECTED_RULES" ]; then
# We should have 4 hits from these rules echo "Did not match expected rules '$EXPECTED_RULES'."
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" exit 1
fi
# 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

@@ -11,38 +11,40 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-config-js: packaging-config-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-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
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Config file' name: 'Packaging: Config file'
permissions: permissions:
contents: read contents: read
@@ -50,66 +52,60 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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
matrix.version == 'stable-v2.14.6') - name: Check results
with: uses: ./../action/.github/actions/check-sarif
python-version: '3.11' with:
- name: Check out repository sarif-file: ${{ runner.temp }}/results/javascript.sarif
uses: actions/checkout@v4 queries-run:
- name: Prepare test javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
id: prepare-test queries-not-run: foo,bar
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 - name: Assert Results
uses: ./../action/.github/actions/check-sarif shell: bash
with: run: |
sarif-file: ${{ runner.temp }}/results/javascript.sarif cd "$RUNNER_TEMP/results"
queries-run: # We should have 4 hits from these rules
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block EXPECTED_RULES="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 # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
shell: bash RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
run: | echo "Found matching rules '$RULES'"
cd "$RUNNER_TEMP/results" if [ "$RULES" != "$EXPECTED_RULES" ]; then
# We should have 4 hits from these rules echo "Did not match expected rules '$EXPECTED_RULES'."
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" exit 1
fi
# 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

@@ -11,38 +11,40 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-inputs-js: packaging-inputs-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-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
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Action input' name: 'Packaging: Action input'
permissions: permissions:
contents: read contents: read
@@ -50,66 +52,60 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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
matrix.version == 'stable-v2.14.6') - name: Check results
with: uses: ./../action/.github/actions/check-sarif
python-version: '3.11' with:
- name: Check out repository sarif-file: ${{ runner.temp }}/results/javascript.sarif
uses: actions/checkout@v4 queries-run:
- name: Prepare test javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
id: prepare-test queries-not-run: foo,bar
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 - name: Assert Results
uses: ./../action/.github/actions/check-sarif shell: bash
with: run: |
sarif-file: ${{ runner.temp }}/results/javascript.sarif cd "$RUNNER_TEMP/results"
queries-run: # We should have 4 hits from these rules
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block EXPECTED_RULES="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 # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
shell: bash RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
run: | echo "Found matching rules '$RULES'"
cd "$RUNNER_TEMP/results" if [ "$RULES" != "$EXPECTED_RULES" ]; then
# We should have 4 hits from these rules echo "Did not match expected rules '$EXPECTED_RULES'."
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" exit 1
fi
# 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

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

@@ -11,62 +11,70 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
remote-config: remote-config:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: windows-latest - os: windows-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: windows-latest - os: windows-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: windows-latest - os: windows-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: windows-latest - os: windows-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: windows-latest - os: windows-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- os: windows-latest - os: windows-latest
version: nightly-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
permissions: permissions:
contents: read contents: read
@@ -74,41 +82,35 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement tools: ${{ steps.prepare-test.outputs.tools-url }}
if: runner.os != 'Windows' && matrix.version == '20221211' languages: cpp,csharp,java,javascript,python
shell: bash config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV github.sha }}
- uses: ./../action/init - name: Build code
with: shell: bash
tools: ${{ steps.prepare-test.outputs.tools-url }} run: ./build.sh
languages: cpp,csharp,java,javascript,python - uses: ./../action/analyze
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

@@ -11,44 +11,46 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
resolve-environment-action: resolve-environment-action:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.4 version: stable-v2.13.4
- os: macos-latest - os: macos-latest
version: stable-v2.13.4 version: stable-v2.13.4
- os: windows-latest - os: windows-latest
version: stable-v2.13.4 version: stable-v2.13.4
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- 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: Resolve environment name: Resolve environment
permissions: permissions:
contents: read contents: read
@@ -56,58 +58,52 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- uses: ./../action/init
with:
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
}}
tools: ${{ steps.prepare-test.outputs.tools-url }}
matrix.version == 'stable-v2.14.6') - name: Resolve environment for Go
with: uses: ./../action/resolve-environment
python-version: '3.11' id: resolve-environment-go
- name: Check out repository with:
uses: actions/checkout@v4 language: go
- 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 - name: Fail if Go configuration missing
uses: ./../action/resolve-environment if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
id: resolve-environment-go run: exit 1
with:
language: go
- name: Fail if Go configuration missing - name: Resolve environment for JavaScript/TypeScript
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go) if: matrix.version != 'stable-v2.13.4'
run: exit 1 uses: ./../action/resolve-environment
id: resolve-environment-js
with:
language: javascript-typescript
- name: Resolve environment for JavaScript/TypeScript - name: Fail if JavaScript/TypeScript configuration present
if: matrix.version != 'stable-v2.13.4' if: matrix.version != 'stable-v2.13.4' &&
uses: ./../action/resolve-environment fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
id: resolve-environment-js run: exit 1
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

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
rubocop-multi-language: rubocop-multi-language:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
name: RuboCop multi-language name: RuboCop multi-language
permissions: permissions:
contents: read contents: read
@@ -34,51 +36,45 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Set up Ruby
use-all-platform-bundle: 'false' uses: ruby/setup-ruby@v1
- name: Set environment variable for Swift enablement with:
if: runner.os != 'Windows' && matrix.version == '20221211' ruby-version: 2.6
shell: bash - name: Install Code Scanning integration
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV shell: bash
- name: Set up Ruby run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
uses: ruby/setup-ruby@v1 - name: Install dependencies
with: shell: bash
ruby-version: 2.6 run: bundle install
- name: Install Code Scanning integration - name: RuboCop run
shell: bash shell: bash
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install run: |
- name: Install dependencies bash -c "
shell: bash bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
run: bundle install [[ $? -ne 2 ]]
- name: RuboCop run "
shell: bash - uses: ./../action/upload-sarif
run: | with:
bash -c " sarif_file: rubocop.sarif
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

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

@@ -11,32 +11,34 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
ruby: ruby:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest 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
permissions: permissions:
contents: read contents: read
@@ -44,47 +46,41 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement languages: ruby
if: runner.os != 'Windows' && matrix.version == '20221211' tools: ${{ steps.prepare-test.outputs.tools-url }}
shell: bash - uses: ./../action/analyze
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV id: analysis
- uses: ./../action/init with:
with: upload-database: false
languages: ruby - name: Check database
tools: ${{ steps.prepare-test.outputs.tools-url }} shell: bash
- uses: ./../action/analyze run: |
id: analysis RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
with: if [[ ! -d "$RUBY_DB" ]]; then
upload-database: false echo "Did not create a database for Ruby."
- name: Check database exit 1
shell: bash fi
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

View File

@@ -11,48 +11,54 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
scaling-reserved-ram: scaling-reserved-ram:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: macos-latest - os: macos-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Scaling reserved RAM name: Scaling reserved RAM
permissions: permissions:
contents: read contents: read
@@ -60,50 +66,44 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
matrix.version == 'stable-v2.14.6') - uses: ./../action/.github/actions/setup-swift
with: with:
python-version: '3.11' codeql-path: ${{ steps.init.outputs.codeql-path }}
- 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 - name: Build code
with: shell: bash
codeql-path: ${{ steps.init.outputs.codeql-path }} run: ./build.sh
- name: Build code - uses: ./../action/analyze
shell: bash id: analysis
run: ./build.sh with:
upload-database: false
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
env: env:
CODEQL_ACTION_SCALING_RESERVED_RAM: true CODEQL_ACTION_SCALING_RESERVED_RAM: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,32 +11,34 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
split-workflow: split-workflow:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest 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
permissions: permissions:
contents: read contents: read
@@ -44,71 +46,65 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
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'
- 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
matrix.version == 'stable-v2.14.6') - name: Assert No Results
with: shell: bash
python-version: '3.11' run: |
- name: Check out repository if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
uses: actions/checkout@v4 echo "Expected results directory to be empty after skipping query execution!"
- name: Prepare test exit 1
id: prepare-test fi
uses: ./.github/actions/prepare-test - uses: ./../action/analyze
with: with:
version: ${{ matrix.version }} output: ${{ runner.temp }}/results
use-all-platform-bundle: 'false' upload-database: false
- name: Set environment variable for Swift enablement - name: Assert Results
if: runner.os != 'Windows' && matrix.version == '20221211' shell: bash
shell: bash run: |
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV cd "$RUNNER_TEMP/results"
- uses: ./../action/init # We should have 4 hits from these rules
with: EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
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 # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
shell: bash RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
run: | echo "Found matching rules '$RULES'"
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Expected results directory to be empty after skipping query execution!" echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi 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

View File

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
submit-sarif-failure: submit-sarif-failure:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest 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
permissions: permissions:
contents: read contents: read
@@ -38,49 +40,43 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: actions/checkout@v4
use-all-platform-bundle: 'false' - uses: ./init
- name: Set environment variable for Swift enablement with:
if: runner.os != 'Windows' && matrix.version == '20221211' languages: javascript
shell: bash - name: Fail
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

@@ -11,32 +11,34 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
swift-custom-build: swift-custom-build:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest 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: Swift analysis using a custom build command name: Swift analysis using a custom build command
permissions: permissions:
contents: read contents: read
@@ -44,58 +46,52 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' id: init
- name: Set environment variable for Swift enablement with:
if: runner.os != 'Windows' && matrix.version == '20221211' languages: swift
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV - uses: ./../action/.github/actions/setup-swift
- uses: ./../action/init with:
id: init codeql-path: ${{steps.init.outputs.codeql-path}}
with: - name: Check working directory
languages: swift shell: bash
tools: ${{ steps.prepare-test.outputs.tools-url }} run: pwd
- uses: ./../action/.github/actions/setup-swift - name: Build code
with: shell: bash
codeql-path: ${{steps.init.outputs.codeql-path}} run: ./build.sh
- name: Check working directory - uses: ./../action/analyze
shell: bash id: analysis
run: pwd with:
- name: Build code upload-database: false
shell: bash - name: Check database
run: ./build.sh shell: bash
- uses: ./../action/analyze run: |
id: analysis SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
with: if [[ ! -d "$SWIFT_DB" ]]; then
upload-database: false echo "Did not create a database for Swift."
- name: Check database exit 1
shell: bash fi
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

View File

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-autobuild-working-dir: test-autobuild-working-dir:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Autobuild working directory name: Autobuild working directory
permissions: permissions:
contents: read contents: read
@@ -34,56 +36,50 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Test setup
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement run: |
if: runner.os != 'Windows' && matrix.version == '20221211' # Make sure that Gradle build succeeds in autobuild-dir ...
shell: bash cp -a ../action/tests/java-repo autobuild-dir
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV # ... and fails if attempted in the current directory
- name: Test setup echo > build.gradle
shell: bash - uses: ./../action/init
run: | with:
# Make sure that Gradle build succeeds in autobuild-dir ... languages: java
cp -a ../action/tests/java-repo autobuild-dir tools: ${{ steps.prepare-test.outputs.tools-url }}
# ... and fails if attempted in the current directory - uses: ./../action/autobuild
echo > build.gradle with:
- uses: ./../action/init working-directory: autobuild-dir
with: - uses: ./../action/analyze
languages: java with:
tools: ${{ steps.prepare-test.outputs.tools-url }} upload-database: false
- uses: ./../action/autobuild - name: Check database
with: shell: bash
working-directory: autobuild-dir run: |
- uses: ./../action/analyze cd "$RUNNER_TEMP/codeql_databases"
with: if [[ ! -d java ]]; then
upload-database: false echo "Did not find a Java database"
- name: Check database exit 1
shell: bash fi
run: |
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d java ]]; then
echo "Did not find a Java database"
exit 1
fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-local-codeql: test-local-codeql:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Local CodeQL bundle name: Local CodeQL bundle
permissions: permissions:
contents: read contents: read
@@ -34,50 +36,44 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Fetch a CodeQL bundle
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement env:
if: runner.os != 'Windows' && matrix.version == '20221211' CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
shell: bash run: |
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV wget "$CODEQL_URL"
- name: Fetch a CodeQL bundle - id: init
shell: bash uses: ./../action/init
env: with:
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }} tools: ./codeql-bundle-linux64.tar.gz
run: | - uses: ./../action/.github/actions/setup-swift
wget "$CODEQL_URL" with:
- id: init codeql-path: ${{ steps.init.outputs.codeql-path }}
uses: ./../action/init - name: Build code
with: shell: bash
tools: ./codeql-bundle-linux64.tar.gz run: ./build.sh
- uses: ./../action/.github/actions/setup-swift - uses: ./../action/analyze
with: with:
codeql-path: ${{ steps.init.outputs.codeql-path }} upload-database: false
- 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

74
.github/workflows/__test-proxy.yml generated vendored
View File

@@ -11,22 +11,24 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-proxy: test-proxy:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Proxy test name: Proxy test
permissions: permissions:
contents: read contents: read
@@ -34,39 +36,33 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement languages: javascript
if: runner.os != 'Windows' && matrix.version == '20221211' tools: ${{ steps.prepare-test.outputs.tools-url }}
shell: bash - uses: ./../action/analyze
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV with:
- uses: ./../action/init upload-database: false
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
upload-database: false
env: env:
https_proxy: http://squid-proxy:3128 https_proxy: http://squid-proxy:3128
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true
@@ -77,4 +73,4 @@ jobs:
squid-proxy: squid-proxy:
image: ubuntu/squid:latest image: ubuntu/squid:latest
ports: ports:
- 3128:3128 - 3128:3128

View File

@@ -11,34 +11,38 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
unset-environment: unset-environment:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20230403
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.15.5
- os: ubuntu-latest - os: ubuntu-latest
version: default version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: latest
- os: ubuntu-latest
version: nightly-latest
name: Test unsetting environment variables name: Test unsetting environment variables
permissions: permissions:
contents: read contents: read
@@ -46,87 +50,81 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' id: init
- name: Set environment variable for Swift enablement with:
if: runner.os != 'Windows' && matrix.version == '20221211' db-location: ${{ runner.temp }}/customDbLocation
shell: bash tools: ${{ steps.prepare-test.outputs.tools-url }}
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV - uses: ./../action/.github/actions/setup-swift
- uses: ./../action/init with:
id: init codeql-path: ${{ steps.init.outputs.codeql-path }}
with: - name: Build code
db-location: ${{ runner.temp }}/customDbLocation shell: bash
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
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a # Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
# workaround for our PR checks. # workaround for our PR checks.
run: env -i CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN=true PATH="$PATH" HOME="$HOME" run: env -i CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN=true PATH="$PATH" HOME="$HOME"
./build.sh ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then
echo "::error::Did not create a database for CPP, or created it in the wrong location." \ echo "::error::Did not create a database for CPP, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'"
exit 1 exit 1
fi fi
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then
echo "::error::Did not create a database for C Sharp, 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/csharp' but actual was '${CSHARP_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'"
exit 1 exit 1
fi fi
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then
echo "::error::Did not create a database for Go, 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/go' but actual was '${GO_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 }}" JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}"
if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then 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." \ 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}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'"
exit 1 exit 1
fi fi
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then 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." \ 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}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'"
exit 1 exit 1
fi fi
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then 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." \ 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}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
upload-ref-sha-input: upload-ref-sha-input:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
name: "Upload-sarif: 'ref' and 'sha' from inputs" name: "Upload-sarif: 'ref' and 'sha' from inputs"
permissions: permissions:
contents: read contents: read
@@ -38,50 +40,44 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - uses: ./../action/init
use-all-platform-bundle: 'false' with:
- name: Set environment variable for Swift enablement tools: ${{ steps.prepare-test.outputs.tools-url }}
if: runner.os != 'Windows' && matrix.version == '20221211' languages: cpp,csharp,java,javascript,python
shell: bash config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV github.sha }}
- uses: ./../action/init - name: Build code
with: shell: bash
tools: ${{ steps.prepare-test.outputs.tools-url }} run: ./build.sh
languages: cpp,csharp,java,javascript,python - uses: ./../action/analyze
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ with:
github.sha }} upload-database: false
- name: Build code ref: refs/heads/main
shell: bash sha: 5e235361806c361d4d3f8859e3c897658025a9a2
run: ./build.sh upload: never
- uses: ./../action/analyze - uses: ./../action/upload-sarif
with: with:
upload-database: false ref: refs/heads/main
ref: refs/heads/main sha: 5e235361806c361d4d3f8859e3c897658025a9a2
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

@@ -11,26 +11,28 @@ env:
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:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
with-checkout-path: with-checkout-path:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
name: Use a custom `checkout_path` name: Use a custom `checkout_path`
permissions: permissions:
contents: read contents: read
@@ -38,100 +40,94 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20230403' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.14.6')
with:
matrix.version == 'stable-v2.14.6') python-version: '3.11'
with: - name: Check out repository
python-version: '3.11' uses: actions/checkout@v4
- name: Check out repository - name: Prepare test
uses: actions/checkout@v4 id: prepare-test
- name: Prepare test uses: ./.github/actions/prepare-test
id: prepare-test with:
uses: ./.github/actions/prepare-test version: ${{ matrix.version }}
with: use-all-platform-bundle: 'false'
version: ${{ matrix.version }} - name: Delete original checkout
use-all-platform-bundle: 'false' shell: bash
- name: Set environment variable for Swift enablement run: |
if: runner.os != 'Windows' && matrix.version == '20221211' # delete the original checkout so we don't accidentally use it.
shell: bash # Actions does not support deleting the current working directory, so we
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV # delete the contents of the directory instead.
- name: Delete original checkout rm -rf ./* .github .git
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@v4 - 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
shell: bash shell: bash
working-directory: x/y/z/some-path/tests/multi-language-repo working-directory: x/y/z/some-path/tests/multi-language-repo
run: | run: |
./build.sh ./build.sh
- 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: never
upload-database: false upload-database: false
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
ref: v1.1.0 ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
checkout_path: x/y/z/some-path/tests/multi-language-repo checkout_path: x/y/z/some-path/tests/multi-language-repo
- name: Verify SARIF after upload - name: Verify SARIF after upload
shell: bash shell: bash
run: | run: |
EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6" EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6"
EXPECTED_REF="v1.1.0" EXPECTED_REF="v1.1.0"
EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo" EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo"
ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)" ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)"
ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)" ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)"
ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)" ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)"
if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then
echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID" echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then
echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'" echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'"
echo "$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 [[ "$ACTUAL_CHECKOUT_URI" != *$EXPECTED_CHECKOUT_URI_SUFFIX ]]; then
echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI" echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -15,6 +15,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:

View File

@@ -17,6 +17,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
upload-artifacts: upload-artifacts:

View File

@@ -16,16 +16,19 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
upload-artifacts: upload-artifacts:
strategy: strategy:
matrix: matrix:
version: version:
- stable-20221211 - stable-20230403
- stable-20230418
- stable-v2.13.5 - stable-v2.13.5
- stable-v2.14.6 - stable-v2.14.6
- stable-v2.15.5
- stable-v2.16.6
- default - default
- latest - latest
- nightly-latest - nightly-latest
@@ -71,7 +74,7 @@ jobs:
- name: Check expected artifacts exist - name: Check expected artifacts exist
shell: bash shell: bash
run: | run: |
VERSIONS="stable-20221211 stable-20230418 stable-v2.13.5 stable-v2.14.6 default latest nightly-latest" VERSIONS="stable-20230403 stable-v2.13.5 stable-v2.14.6 stable-v2.15.5 stable-v2.16.6 default latest nightly-latest"
LANGUAGES="cpp csharp go java javascript python" LANGUAGES="cpp csharp go java javascript python"
for version in $VERSIONS; do for version in $VERSIONS; do
pushd "./my-debug-artifacts-${version//./}" pushd "./my-debug-artifacts-${version//./}"

View File

@@ -11,6 +11,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:

View File

@@ -1,174 +0,0 @@
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

@@ -11,6 +11,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:

View File

@@ -16,6 +16,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-codeql-bundle-all: test-codeql-bundle-all:

View File

@@ -4,10 +4,36 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers. Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.
## [UNRELEASED] ## 3.25.2 - 22 Apr 2024
No user facing changes. No user facing changes.
## 3.25.1 - 17 Apr 2024
- We are rolling out a feature in April/May 2024 that improves the reliability and performance of analyzing code when analyzing a compiled language with the `autobuild` [build mode](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#codeql-build-modes). [#2235](https://github.com/github/codeql-action/pull/2235)
- Fix a bug where the `init` Action would fail if `--overwrite` was specified in `CODEQL_ACTION_EXTRA_OPTIONS`. [#2245](https://github.com/github/codeql-action/pull/2245)
## 3.25.0 - 15 Apr 2024
- The deprecated feature for extracting dependencies for a Python analysis has been removed. [#2224](https://github.com/github/codeql-action/pull/2224)
As a result, the following inputs and environment variables are now ignored:
- The `setup-python-dependencies` input to the `init` Action
- The `CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION` environment variable
We recommend removing any references to these from your workflows. For more information, see the release notes for CodeQL Action v3.23.0 and v2.23.0.
- Automatically overwrite an existing database if found on the filesystem. [#2229](https://github.com/github/codeql-action/pull/2229)
- Bump the minimum CodeQL bundle version to 2.12.6. [#2232](https://github.com/github/codeql-action/pull/2232)
- A more relevant log message and a diagnostic are now emitted when the `file` program is not installed on a Linux runner, but is required for Go tracing to succeed. [#2234](https://github.com/github/codeql-action/pull/2234)
## 3.24.10 - 05 Apr 2024
- Update default CodeQL bundle version to 2.17.0. [#2219](https://github.com/github/codeql-action/pull/2219)
- Add a deprecation warning for customers using CodeQL version 2.12.5 and earlier. These versions of CodeQL were discontinued on 26 March 2024 alongside GitHub Enterprise Server 3.8, and will be unsupported by CodeQL Action versions 3.25.0 and later and versions 2.25.0 and later. [#2220](https://github.com/github/codeql-action/pull/2220)
- If you are using one of these versions, please update to CodeQL CLI version 2.12.6 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
- Alternatively, if you want to continue using a version of the CodeQL CLI between 2.11.6 and 2.12.5, you can replace `github/codeql-action/*@v3` by `github/codeql-action/*@v3.24.10` and `github/codeql-action/*@v2` by `github/codeql-action/*@v2.24.10` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
## 3.24.9 - 22 Mar 2024 ## 3.24.9 - 22 Mar 2024
- Update default CodeQL bundle version to 2.16.5. [#2203](https://github.com/github/codeql-action/pull/2203) - Update default CodeQL bundle version to 2.16.5. [#2203](https://github.com/github/codeql-action/pull/2203)

View File

@@ -1,3 +1 @@
**/* @github/codeql-action-reviewers **/* @github/codeql-action-reviewers
/python-setup/ @github/codeql-python @github/codeql-action-reviewers

View File

@@ -21,7 +21,7 @@ inputs:
The build mode that will be used to analyze the language. This input is only available when The build mode that will be used to analyze the language. This input is only available when
analyzing a single CodeQL language per job, for example using a matrix. analyzing a single CodeQL language per job, for example using a matrix.
Available build modes will differ based on the language being analyzed. One of: Available build modes will differ based on the language being analyzed. One of:
- `none`: The database will be created without building the source code. - `none`: The database will be created without building the source code.
Available for all interpreted languages and some compiled languages. Available for all interpreted languages and some compiled languages.
@@ -89,9 +89,8 @@ inputs:
description: A token for fetching external config files and queries if they reside in a private repository in the same GitHub instance that is running this action. description: A token for fetching external config files and queries if they reside in a private repository in the same GitHub instance that is running this action.
required: false required: false
setup-python-dependencies: setup-python-dependencies:
description: Try to auto-install your python dependencies description: DEPRECATED. This option is ignored since CodeQL Action no longer installs Python dependencies as of versions 3.25.0 and 2.25.0.
required: true required: false
default: 'true'
source-root: source-root:
description: Path of the root source code directory, relative to $GITHUB_WORKSPACE. description: Path of the root source code directory, relative to $GITHUB_WORKSPACE.
required: false required: false

18
lib/actions-util.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileType = exports.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0; exports.getFileType = exports.FileCmdNotFoundError = exports.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
@@ -380,6 +380,13 @@ function getWorkflowRunAttempt() {
return workflowRunAttempt; return workflowRunAttempt;
} }
exports.getWorkflowRunAttempt = getWorkflowRunAttempt; exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
class FileCmdNotFoundError extends Error {
constructor(msg) {
super(msg);
this.name = "FileCmdNotFoundError";
}
}
exports.FileCmdNotFoundError = FileCmdNotFoundError;
/** /**
* Tries to obtain the output of the `file` command for the file at the specified path. * Tries to obtain the output of the `file` command for the file at the specified path.
* The output will vary depending on the type of `file`, which operating system we are running on, etc. * The output will vary depending on the type of `file`, which operating system we are running on, etc.
@@ -387,11 +394,18 @@ exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
const getFileType = async (filePath) => { const getFileType = async (filePath) => {
let stderr = ""; let stderr = "";
let stdout = ""; let stdout = "";
let fileCmdPath;
try {
fileCmdPath = await safeWhich.safeWhich("file");
}
catch (e) {
throw new FileCmdNotFoundError(`The \`file\` program is required, but does not appear to be installed. Please install it: ${e}`);
}
try { try {
// The `file` command will output information about the type of file pointed at by `filePath`. // The `file` command will output information about the type of file pointed at by `filePath`.
// For binary files, this may include e.g. whether they are static of dynamic binaries. // For binary files, this may include e.g. whether they are static of dynamic binaries.
// The `-L` switch instructs the command to follow symbolic links. // The `-L` switch instructs the command to follow symbolic links.
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", filePath], { await new toolrunner.ToolRunner(fileCmdPath, ["-L", filePath], {
silent: true, silent: true,
listeners: { listeners: {
stdout: (data) => { stdout: (data) => {

File diff suppressed because one or more lines are too long

View File

@@ -227,7 +227,9 @@ const util_1 = require("./util");
const infoStub = sinon.stub(core, "info"); const infoStub = sinon.stub(core, "info");
process.env["GITHUB_EVENT_NAME"] = "pull_request"; process.env["GITHUB_EVENT_NAME"] = "pull_request";
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a"; process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../..")); await (0, util_1.withTmpDir)(async (tmpDir) => {
await actionsUtil.determineMergeBaseCommitOid(tmpDir);
});
t.deepEqual(1, infoStub.callCount); t.deepEqual(1, infoStub.callCount);
t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository.")); t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository."));
infoStub.restore(); infoStub.restore();

File diff suppressed because one or more lines are too long

45
lib/analyze-action.js generated
View File

@@ -51,21 +51,23 @@ const util = __importStar(require("./util"));
async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) { async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) {
const status = (0, status_report_1.getActionsStatus)(error, stats?.analyze_failure_language); const status = (0, status_report_1.getActionsStatus)(error, stats?.analyze_failure_language);
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, status, startedAt, config, await util.checkDiskUsage(), logger, error?.message, error?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, status, startedAt, config, await util.checkDiskUsage(), logger, error?.message, error?.stack);
const report = { if (statusReportBase !== undefined) {
...statusReportBase, const report = {
...(stats || {}), ...statusReportBase,
...(dbCreationTimings || {}), ...(stats || {}),
}; ...(dbCreationTimings || {}),
if (config && didUploadTrapCaches) {
const trapCacheUploadStatusReport = {
...report,
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
}; };
await statusReport.sendStatusReport(trapCacheUploadStatusReport); if (config && didUploadTrapCaches) {
} const trapCacheUploadStatusReport = {
else { ...report,
await statusReport.sendStatusReport(report); trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
};
await statusReport.sendStatusReport(trapCacheUploadStatusReport);
}
else {
await statusReport.sendStatusReport(report);
}
} }
} }
// `expect-error` should only be set to a non-false value by the CodeQL Action PR checks. // `expect-error` should only be set to a non-false value by the CodeQL Action PR checks.
@@ -105,7 +107,7 @@ function doesGoExtractionOutputExist(config) {
* - We approximate whether manual build steps are present by looking at * - We approximate whether manual build steps are present by looking at
* whether any extraction output already exists for Go. * whether any extraction output already exists for Go.
*/ */
async function runAutobuildIfLegacyGoWorkflow(config, logger) { async function runAutobuildIfLegacyGoWorkflow(config, features, logger) {
if (!config.languages.includes(languages_1.Language.go)) { if (!config.languages.includes(languages_1.Language.go)) {
return; return;
} }
@@ -132,7 +134,7 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
return; return;
} }
logger.debug("Running Go autobuild because extraction output (TRAP files) for Go code has not been found."); logger.debug("Running Go autobuild because extraction output (TRAP files) for Go code has not been found.");
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger); await (0, autobuild_1.runAutobuild)(config, languages_1.Language.go, features, logger);
} }
async function run() { async function run() {
const startedAt = new Date(); const startedAt = new Date();
@@ -145,11 +147,15 @@ async function run() {
util.initializeEnvironment(actionsUtil.getActionVersion()); util.initializeEnvironment(actionsUtil.getActionVersion());
const logger = (0, logging_1.getActionsLogger)(); const logger = (0, logging_1.getActionsLogger)();
try { try {
await statusReport.sendStatusReport(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, "starting", startedAt, config, await util.checkDiskUsage(logger), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, "starting", startedAt, config, await util.checkDiskUsage(logger), logger);
if (statusReportBase !== undefined) {
await statusReport.sendStatusReport(statusReportBase);
}
config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger); config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
if (config === undefined) { if (config === undefined) {
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?"); throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
} }
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
if (hasBadExpectErrorInput()) { if (hasBadExpectErrorInput()) {
throw new util.ConfigurationError("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork."); throw new util.ConfigurationError("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
} }
@@ -162,8 +168,8 @@ async function run() {
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger); const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger); const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
await (0, analyze_1.warnIfGoInstalledAfterInit)(config, logger); await (0, analyze_1.warnIfGoInstalledAfterInit)(config, logger);
await runAutobuildIfLegacyGoWorkflow(config, logger); await runAutobuildIfLegacyGoWorkflow(config, features, logger);
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features); dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, codeql, config, features, logger);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") { if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger, features); runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger, features);
} }
@@ -188,7 +194,6 @@ async function run() {
await (0, database_upload_1.uploadDatabases)(repositoryNwo, config, apiDetails, logger); await (0, database_upload_1.uploadDatabases)(repositoryNwo, config, apiDetails, logger);
// Possibly upload the TRAP caches for later re-use // Possibly upload the TRAP caches for later re-use
const trapCacheUploadStartTime = perf_hooks_1.performance.now(); const trapCacheUploadStartTime = perf_hooks_1.performance.now();
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
didUploadTrapCaches = await (0, trap_caching_1.uploadTrapCaches)(codeql, config, logger); didUploadTrapCaches = await (0, trap_caching_1.uploadTrapCaches)(codeql, config, logger);
trapCacheUploadTime = perf_hooks_1.performance.now() - trapCacheUploadStartTime; trapCacheUploadTime = perf_hooks_1.performance.now() - trapCacheUploadStartTime;
// We don't upload results in test mode, so don't wait for processing // We don't upload results in test mode, so don't wait for processing

File diff suppressed because one or more lines are too long

69
lib/analyze.js generated
View File

@@ -30,13 +30,11 @@ exports.runCleanup = exports.warnIfGoInstalledAfterInit = exports.runFinalize =
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks"); const perf_hooks_1 = require("perf_hooks");
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
const safe_which_1 = require("@chrisgavin/safe-which"); const safe_which_1 = require("@chrisgavin/safe-which");
const del_1 = __importDefault(require("del")); const del_1 = __importDefault(require("del"));
const yaml = __importStar(require("js-yaml")); const yaml = __importStar(require("js-yaml"));
const autobuild_1 = require("./autobuild"); const autobuild_1 = require("./autobuild");
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils");
const diagnostics_1 = require("./diagnostics"); const diagnostics_1 = require("./diagnostics");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
@@ -45,6 +43,7 @@ const tools_features_1 = require("./tools-features");
const tracer_config_1 = require("./tracer-config"); const tracer_config_1 = require("./tracer-config");
const upload_lib_1 = require("./upload-lib"); const upload_lib_1 = require("./upload-lib");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
const util_1 = require("./util");
class CodeQLAnalysisError extends Error { class CodeQLAnalysisError extends Error {
constructor(queriesStatusReport, message) { constructor(queriesStatusReport, message) {
super(message); super(message);
@@ -53,35 +52,17 @@ class CodeQLAnalysisError extends Error {
} }
} }
exports.CodeQLAnalysisError = CodeQLAnalysisError; exports.CodeQLAnalysisError = CodeQLAnalysisError;
async function setupPythonExtractor(logger, features, codeql) { async function setupPythonExtractor(logger) {
const codeqlPython = process.env["CODEQL_PYTHON"]; const codeqlPython = process.env["CODEQL_PYTHON"];
if (codeqlPython === undefined || codeqlPython.length === 0) { if (codeqlPython === undefined || codeqlPython.length === 0) {
// If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything // If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything
return; return;
} }
if (await (0, feature_flags_1.isPythonDependencyInstallationDisabled)(codeql, features)) { logger.warning("The CODEQL_PYTHON environment variable is no longer supported. Please remove it from your workflow. This environment variable was originally used to specify a Python executable that included the dependencies of your Python code, however Python analysis no longer uses these dependencies." +
logger.warning("We recommend that you remove the CODEQL_PYTHON environment variable from your workflow. This environment variable was originally used to specify a Python executable that included the dependencies of your Python code, however Python analysis no longer uses these dependencies." + "\nIf you used CODEQL_PYTHON to force the version of Python to analyze as, please use CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION instead, such as 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=2.7' or 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=3.11'.");
"\nIf you used CODEQL_PYTHON to force the version of Python to analyze as, please use CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION instead, such as 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=2.7' or 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=3.11'."); return;
return;
}
const scriptsFolder = path.resolve(__dirname, "../python-setup");
let output = "";
const options = {
listeners: {
stdout: (data) => {
output += data.toString();
},
},
};
await new toolrunner.ToolRunner(codeqlPython, [path.join(scriptsFolder, "find_site_packages.py")], options).exec();
logger.info(`Setting LGTM_INDEX_IMPORT_PATH=${output}`);
process.env["LGTM_INDEX_IMPORT_PATH"] = output;
output = "";
await new toolrunner.ToolRunner(codeqlPython, ["-c", "import sys; print(sys.version_info[0])"], options).exec();
logger.info(`Setting LGTM_PYTHON_SETUP_VERSION=${output}`);
process.env["LGTM_PYTHON_SETUP_VERSION"] = output;
} }
async function runExtraction(codeql, config, logger, features) { async function runExtraction(codeql, config, logger) {
for (const language of config.languages) { for (const language of config.languages) {
if (dbIsFinalized(config, language, logger)) { if (dbIsFinalized(config, language, logger)) {
logger.debug(`Database for ${language} has already been finalized, skipping extraction.`); logger.debug(`Database for ${language} has already been finalized, skipping extraction.`);
@@ -90,32 +71,15 @@ async function runExtraction(codeql, config, logger, features) {
if (shouldExtractLanguage(config, language)) { if (shouldExtractLanguage(config, language)) {
logger.startGroup(`Extracting ${language}`); logger.startGroup(`Extracting ${language}`);
if (language === languages_1.Language.python) { if (language === languages_1.Language.python) {
await setupPythonExtractor(logger, features, codeql); await setupPythonExtractor(logger);
} }
if (config.buildMode && if (config.buildMode &&
(await codeql.supportsFeature(tools_features_1.ToolsFeature.TraceCommandUseBuildMode))) { (await codeql.supportsFeature(tools_features_1.ToolsFeature.TraceCommandUseBuildMode))) {
if (language === languages_1.Language.cpp && if (language === languages_1.Language.cpp &&
config.buildMode === config_utils_1.BuildMode.Autobuild) { config.buildMode === util_1.BuildMode.Autobuild) {
await (0, autobuild_1.setupCppAutobuild)(codeql, logger); await (0, autobuild_1.setupCppAutobuild)(codeql, logger);
} }
try { await codeql.extractUsingBuildMode(config, language);
await codeql.extractUsingBuildMode(config, language);
}
catch (e) {
if (config.buildMode === config_utils_1.BuildMode.Autobuild) {
const prefix = "We were unable to automatically build your code. " +
"Please change the build mode for this language to manual and specify build steps " +
"for your project. For more information, see " +
"https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/automatic-build-failed.";
const ErrorConstructor = e instanceof util.ConfigurationError
? util.ConfigurationError
: Error;
throw new ErrorConstructor(`${prefix} ${util.wrapError(e).message}`);
}
else {
throw e;
}
}
} }
else { else {
await codeql.extractScannedLanguage(config, language); await codeql.extractScannedLanguage(config, language);
@@ -126,8 +90,8 @@ async function runExtraction(codeql, config, logger, features) {
} }
exports.runExtraction = runExtraction; exports.runExtraction = runExtraction;
function shouldExtractLanguage(config, language) { function shouldExtractLanguage(config, language) {
return (config.buildMode === config_utils_1.BuildMode.None || return (config.buildMode === util_1.BuildMode.None ||
(config.buildMode === config_utils_1.BuildMode.Autobuild && (config.buildMode === util_1.BuildMode.Autobuild &&
process.env[environment_1.EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY] !== "true") || process.env[environment_1.EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY] !== "true") ||
(!config.buildMode && (0, languages_1.isScannedLanguage)(language))); (!config.buildMode && (0, languages_1.isScannedLanguage)(language)));
} }
@@ -143,10 +107,9 @@ function dbIsFinalized(config, language, logger) {
} }
} }
exports.dbIsFinalized = dbIsFinalized; exports.dbIsFinalized = dbIsFinalized;
async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger, features) { async function finalizeDatabaseCreation(codeql, config, threadsFlag, memoryFlag, logger) {
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
const extractionStart = perf_hooks_1.performance.now(); const extractionStart = perf_hooks_1.performance.now();
await runExtraction(codeql, config, logger, features); await runExtraction(codeql, config, logger);
const extractionTime = perf_hooks_1.performance.now() - extractionStart; const extractionTime = perf_hooks_1.performance.now() - extractionStart;
const trapImportStart = perf_hooks_1.performance.now(); const trapImportStart = perf_hooks_1.performance.now();
for (const language of config.languages) { for (const language of config.languages) {
@@ -251,7 +214,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
} }
} }
exports.runQueries = runQueries; exports.runQueries = runQueries;
async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, features) { async function runFinalize(outputDir, threadsFlag, memoryFlag, codeql, config, features, logger) {
try { try {
await (0, del_1.default)(outputDir, { force: true }); await (0, del_1.default)(outputDir, { force: true });
} }
@@ -261,14 +224,14 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, f
} }
} }
await fs.promises.mkdir(outputDir, { recursive: true }); await fs.promises.mkdir(outputDir, { recursive: true });
const timings = await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger, features); const timings = await finalizeDatabaseCreation(codeql, config, threadsFlag, memoryFlag, logger);
// WARNING: This does not _really_ end tracing, as the tracer will restore its // WARNING: This does not _really_ end tracing, as the tracer will restore its
// critical environment variables and it'll still be active for all processes // critical environment variables and it'll still be active for all processes
// launched from this build step. // launched from this build step.
// However, it will stop tracing for all steps past the codeql-action/analyze // However, it will stop tracing for all steps past the codeql-action/analyze
// step. // step.
// Delete variables as specified by the end-tracing script // Delete variables as specified by the end-tracing script
await (0, tracer_config_1.endTracingForCluster)(config); await (0, tracer_config_1.endTracingForCluster)(codeql, config, features);
return timings; return timings;
} }
exports.runFinalize = runFinalize; exports.runFinalize = runFinalize;

File diff suppressed because one or more lines are too long

13
lib/api-client.js generated
View File

@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRelativePath = exports.getGitHubVersion = exports.getGitHubVersionFromApi = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0; exports.wrapApiConfigurationError = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRelativePath = exports.getGitHubVersion = exports.getGitHubVersionFromApi = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0;
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const githubUtils = __importStar(require("@actions/github/lib/utils")); const githubUtils = __importStar(require("@actions/github/lib/utils"));
const retry = __importStar(require("@octokit/plugin-retry")); const retry = __importStar(require("@octokit/plugin-retry"));
@@ -163,4 +163,15 @@ function computeAutomationID(analysis_key, environment) {
return automationID; return automationID;
} }
exports.computeAutomationID = computeAutomationID; exports.computeAutomationID = computeAutomationID;
function wrapApiConfigurationError(e) {
if ((0, util_1.isHTTPError)(e)) {
if (e.message.includes("API rate limit exceeded for site ID installation") ||
e.message.includes("commit not found") ||
/^ref .* not found in this repository$/.test(e.message)) {
return new util_1.ConfigurationError(e.message);
}
}
return e;
}
exports.wrapApiConfigurationError = wrapApiConfigurationError;
//# sourceMappingURL=api-client.js.map //# sourceMappingURL=api-client.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,uEAAyD;AACzD,6DAA+C;AAC/C,0EAAgD;AAEhD,iDAAoE;AACpE,iCAOgB;AAEhB,MAAM,gCAAgC,GAAG,6BAA6B,CAAC;AAEvE,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,+FAAc,CAAA;IACd,+FAAc,CAAA;AAChB,CAAC,EAHW,0BAA0B,0CAA1B,0BAA0B,QAGrC;AAiBD,SAAS,0BAA0B,CACjC,UAAoC,EACpC,EAAE,aAAa,GAAG,KAAK,EAAE,GAAG,EAAE;IAE9B,MAAM,IAAI,GACR,CAAC,aAAa,IAAI,UAAU,CAAC,gBAAgB,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC;IACpE,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/D,OAAO,IAAI,eAAe,CACxB,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAClC,OAAO,EAAE,UAAU,CAAC,MAAM;QAC1B,SAAS,EAAE,iBAAiB,IAAA,+BAAgB,GAAE,EAAE;QAChD,GAAG,EAA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CAAC,EACvD,CAAC;YACD,OAAO,IAAI,yBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAXD,8DAWC"}

View File

@@ -1 +1 @@
{ "maximumVersion": "3.13", "minimumVersion": "3.8" } { "maximumVersion": "3.13", "minimumVersion": "3.9" }

View File

@@ -30,19 +30,23 @@ const autobuild_1 = require("./autobuild");
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils"); const config_utils_1 = require("./config-utils");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const repository_1 = require("./repository");
const status_report_1 = require("./status-report"); const status_report_1 = require("./status-report");
const util_1 = require("./util"); const util_1 = require("./util");
async function sendCompletedStatusReport(config, logger, startedAt, allLanguages, failingLanguage, cause) { async function sendCompletedStatusReport(config, logger, startedAt, allLanguages, failingLanguage, cause) {
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)()); (0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
const status = (0, status_report_1.getActionsStatus)(cause, failingLanguage); const status = (0, status_report_1.getActionsStatus)(cause, failingLanguage);
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, status, startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, cause?.message, cause?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, status, startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, cause?.message, cause?.stack);
const statusReport = { if (statusReportBase !== undefined) {
...statusReportBase, const statusReport = {
autobuild_languages: allLanguages.join(","), ...statusReportBase,
autobuild_failure: failingLanguage, autobuild_languages: allLanguages.join(","),
}; autobuild_failure: failingLanguage,
await (0, status_report_1.sendStatusReport)(statusReport); };
await (0, status_report_1.sendStatusReport)(statusReport);
}
} }
async function run() { async function run() {
const startedAt = new Date(); const startedAt = new Date();
@@ -51,10 +55,15 @@ async function run() {
let currentLanguage; let currentLanguage;
let languages; let languages;
try { try {
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger); (0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
(0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion); (0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion);
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
config = await (0, config_utils_1.getConfig)((0, actions_util_1.getTemporaryDirectory)(), logger); config = await (0, config_utils_1.getConfig)((0, actions_util_1.getTemporaryDirectory)(), logger);
if (config === undefined) { if (config === undefined) {
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?"); throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
@@ -69,7 +78,7 @@ async function run() {
} }
for (const language of languages) { for (const language of languages) {
currentLanguage = language; currentLanguage = language;
await (0, autobuild_1.runAutobuild)(language, config, logger); await (0, autobuild_1.runAutobuild)(config, language, features, logger);
} }
} }
} }

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;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E,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} {"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,qCAAqC;AACrC,iDAAmD;AACnD,+CAAuC;AACvC,mDAA2C;AAE3C,uCAAqD;AACrD,6CAAkD;AAClD,mDAMyB;AACzB,iCAOgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAA0B,EAC1B,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,SAAS,EACpB,MAAM,EACN,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,EACN,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,KAAK,CACb,CAAC;IACF,I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K,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

15
lib/autobuild.js generated
View File

@@ -28,7 +28,6 @@ const core = __importStar(require("@actions/core"));
const actions_util_1 = require("./actions-util"); const actions_util_1 = require("./actions-util");
const api_client_1 = require("./api-client"); const api_client_1 = require("./api-client");
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages"); const languages_1 = require("./languages");
@@ -36,9 +35,9 @@ const repository_1 = require("./repository");
const tools_features_1 = require("./tools-features"); const tools_features_1 = require("./tools-features");
const util_1 = require("./util"); const util_1 = require("./util");
async function determineAutobuildLanguages(codeql, config, logger) { async function determineAutobuildLanguages(codeql, config, logger) {
if ((config.buildMode === config_utils_1.BuildMode.None && if ((config.buildMode === util_1.BuildMode.None &&
(await codeql.supportsFeature(tools_features_1.ToolsFeature.TraceCommandUseBuildMode))) || (await codeql.supportsFeature(tools_features_1.ToolsFeature.TraceCommandUseBuildMode))) ||
config.buildMode === config_utils_1.BuildMode.Manual) { config.buildMode === util_1.BuildMode.Manual) {
logger.info(`Using ${config.buildMode} build mode, nothing to autobuild.`); logger.info(`Using ${config.buildMode} build mode, nothing to autobuild.`);
return undefined; return undefined;
} }
@@ -135,13 +134,19 @@ async function setupCppAutobuild(codeql, logger) {
} }
} }
exports.setupCppAutobuild = setupCppAutobuild; exports.setupCppAutobuild = setupCppAutobuild;
async function runAutobuild(language, config, logger) { async function runAutobuild(config, language, features, logger) {
logger.startGroup(`Attempting to automatically build ${language} code`); logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd); const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
if (language === languages_1.Language.cpp) { if (language === languages_1.Language.cpp) {
await setupCppAutobuild(codeQL, logger); await setupCppAutobuild(codeQL, logger);
} }
await codeQL.runAutobuild(language, config.debugMode); if (config.buildMode &&
(await features.getValue(feature_flags_1.Feature.AutobuildDirectTracingEnabled, codeQL))) {
await codeQL.extractUsingBuildMode(config, language);
}
else {
await codeQL.runAutobuild(config, language, features);
}
if (language === languages_1.Language.go) { if (language === languages_1.Language.go) {
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true"); core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
} }

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAA6E;AAC7E,6CAAgD;AAChD,qCAA6C;AAE7C,iDAA2C;AAC3C,+CAAuC;AACvC,mDAAmE;AACnE,2CAAyD;AAEzD,6CAAkD;AAClD,qDAAgD;AAChD,iCAA6C;AAEtC,KAAK,UAAU,2BAA2B,CAC/C,MAAc,EACd,MAA0B,EAC1B,MAAc;IAEd,IACE,CAAC,MAAM,CAAC,SAAS,KAAK,wBAAS,CAAC,IAAI;QAClC,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,6BAAY,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACxE,MAAM,CAAC,SAAS,KAAK,wBAAS,CAAC,MAAM,EACrC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,SAAS,oCAAoC,CAAC,CAAC;QAC3E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,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AAQ,EAAE,CAAC;AACpB,CAAC;AAvBD,oCAuBC"}

38
lib/cli-errors.js generated
View File

@@ -2,7 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapCliConfigurationError = exports.getCliConfigCategoryIfExists = exports.cliErrorsConfig = exports.CliConfigErrorCategory = exports.CommandInvocationError = void 0; exports.wrapCliConfigurationError = exports.getCliConfigCategoryIfExists = exports.cliErrorsConfig = exports.CliConfigErrorCategory = exports.CommandInvocationError = void 0;
const util_1 = require("./util"); const util_1 = require("./util");
const NO_SOURCE_CODE_SEEN_DOCS_LINK = "https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build";
/** /**
* A class of Error that we can classify as an error stemming from a CLI * A class of Error that we can classify as an error stemming from a CLI
* invocation, with associated exit code, stderr,etc. * invocation, with associated exit code, stderr,etc.
@@ -117,6 +116,7 @@ function ensureEndsInPeriod(text) {
/** Error messages from the CLI that we consider configuration errors and handle specially. */ /** Error messages from the CLI that we consider configuration errors and handle specially. */
var CliConfigErrorCategory; var CliConfigErrorCategory;
(function (CliConfigErrorCategory) { (function (CliConfigErrorCategory) {
CliConfigErrorCategory["ExternalRepositoryCloneFailed"] = "ExternalRepositoryCloneFailed";
CliConfigErrorCategory["GradleBuildFailed"] = "GradleBuildFailed"; CliConfigErrorCategory["GradleBuildFailed"] = "GradleBuildFailed";
CliConfigErrorCategory["IncompatibleWithActionVersion"] = "IncompatibleWithActionVersion"; CliConfigErrorCategory["IncompatibleWithActionVersion"] = "IncompatibleWithActionVersion";
CliConfigErrorCategory["InitCalledTwice"] = "InitCalledTwice"; CliConfigErrorCategory["InitCalledTwice"] = "InitCalledTwice";
@@ -128,12 +128,18 @@ var CliConfigErrorCategory;
CliConfigErrorCategory["NoSupportedBuildCommandSucceeded"] = "NoSupportedBuildCommandSucceeded"; CliConfigErrorCategory["NoSupportedBuildCommandSucceeded"] = "NoSupportedBuildCommandSucceeded";
CliConfigErrorCategory["NoSupportedBuildSystemDetected"] = "NoSupportedBuildSystemDetected"; CliConfigErrorCategory["NoSupportedBuildSystemDetected"] = "NoSupportedBuildSystemDetected";
CliConfigErrorCategory["SwiftBuildFailed"] = "SwiftBuildFailed"; CliConfigErrorCategory["SwiftBuildFailed"] = "SwiftBuildFailed";
CliConfigErrorCategory["UnsupportedBuildMode"] = "UnsupportedBuildMode";
})(CliConfigErrorCategory || (exports.CliConfigErrorCategory = CliConfigErrorCategory = {})); })(CliConfigErrorCategory || (exports.CliConfigErrorCategory = CliConfigErrorCategory = {}));
/** /**
* All of our caught CLI error messages that we handle specially: ie. if we * All of our caught CLI error messages that we handle specially: ie. if we
* would like to categorize an error as a configuration error or not. * would like to categorize an error as a configuration error or not.
*/ */
exports.cliErrorsConfig = { exports.cliErrorsConfig = {
[CliConfigErrorCategory.ExternalRepositoryCloneFailed]: {
cliErrorMessageCandidates: [
new RegExp("Failed to clone external Git repository"),
],
},
[CliConfigErrorCategory.GradleBuildFailed]: { [CliConfigErrorCategory.GradleBuildFailed]: {
cliErrorMessageCandidates: [ cliErrorMessageCandidates: [
new RegExp("[autobuild] FAILURE: Build failed with an exception."), new RegExp("[autobuild] FAILURE: Build failed with an exception."),
@@ -177,15 +183,6 @@ exports.cliErrorsConfig = {
cliErrorMessageCandidates: [ cliErrorMessageCandidates: [
new RegExp("CodeQL detected code written in .* but could not process any of it"), new RegExp("CodeQL detected code written in .* but could not process any of it"),
new RegExp("CodeQL did not detect any code written in languages supported by CodeQL"), new RegExp("CodeQL did not detect any code written in languages supported by CodeQL"),
/**
* Earlier versions of the JavaScript extractor (pre-CodeQL 2.12.0) extract externs even if no
* source code was found. This means that we don't get the no code found error from
* `codeql database finalize`. To ensure users get a good error message, we detect this manually
* here, and upon detection override the error message.
*
* This can be removed once support for CodeQL 2.11.6 is removed.
*/
new RegExp("No JavaScript or TypeScript code found"),
], ],
}, },
[CliConfigErrorCategory.NoSupportedBuildCommandSucceeded]: { [CliConfigErrorCategory.NoSupportedBuildCommandSucceeded]: {
@@ -203,6 +200,11 @@ exports.cliErrorsConfig = {
new RegExp("\\[autobuilder/build\\] \\[build-command-failed\\] `autobuild` failed to run the build command"), new RegExp("\\[autobuilder/build\\] \\[build-command-failed\\] `autobuild` failed to run the build command"),
], ],
}, },
[CliConfigErrorCategory.UnsupportedBuildMode]: {
cliErrorMessageCandidates: [
new RegExp("does not support the .* build mode. Please try using one of the following build modes instead"),
],
},
}; };
/** /**
* Check if the given CLI error or exit code, if applicable, apply to any known * Check if the given CLI error or exit code, if applicable, apply to any known
@@ -226,17 +228,6 @@ function getCliConfigCategoryIfExists(cliError) {
return undefined; return undefined;
} }
exports.getCliConfigCategoryIfExists = getCliConfigCategoryIfExists; exports.getCliConfigCategoryIfExists = getCliConfigCategoryIfExists;
/**
* Prepend a clearer error message with the docs link if the error message does not already
* include it. Can be removed once support for CodeQL 2.11.6 is removed; at that point, all runs
* should already include the doc link.
*/
function prependDocsLinkIfApplicable(cliErrorMessage) {
if (!cliErrorMessage.includes(NO_SOURCE_CODE_SEEN_DOCS_LINK)) {
return `No code found during the build. Please see: ${NO_SOURCE_CODE_SEEN_DOCS_LINK}. Detailed error: ${cliErrorMessage}`;
}
return cliErrorMessage;
}
/** /**
* Changes an error received from the CLI to a ConfigurationError with optionally an extra * Changes an error received from the CLI to a ConfigurationError with optionally an extra
* error message appended, if it exists in a known set of configuration errors. Otherwise, * error message appended, if it exists in a known set of configuration errors. Otherwise,
@@ -251,11 +242,6 @@ function wrapCliConfigurationError(cliError) {
return cliError; return cliError;
} }
let errorMessageBuilder = cliError.message; let errorMessageBuilder = cliError.message;
// Can be removed once support for CodeQL 2.11.6 is removed; at that point, all runs should
// already include the doc link.
if (cliConfigErrorCategory === CliConfigErrorCategory.NoSourceCodeSeen) {
errorMessageBuilder = prependDocsLinkIfApplicable(errorMessageBuilder);
}
const additionalErrorMessageToAppend = exports.cliErrorsConfig[cliConfigErrorCategory].additionalErrorMessageToAppend; const additionalErrorMessageToAppend = exports.cliErrorsConfig[cliConfigErrorCategory].additionalErrorMessageToAppend;
if (additionalErrorMessageToAppend !== undefined) { if (additionalErrorMessageToAppend !== undefined) {
errorMessageBuilder = `${errorMessageBuilder} ${additionalErrorMessageToAppend}`; errorMessageBuilder = `${errorMessageBuilder} ${additionalErrorMessageToAppend}`;

File diff suppressed because one or more lines are too long

167
lib/codeql.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = void 0; exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
@@ -34,9 +34,9 @@ const actions_util_1 = require("./actions-util");
const cli_errors_1 = require("./cli-errors"); const cli_errors_1 = require("./cli-errors");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const setupCodeql = __importStar(require("./setup-codeql")); const setupCodeql = __importStar(require("./setup-codeql"));
const tools_features_1 = require("./tools-features"); const tools_features_1 = require("./tools-features");
const tracer_config_1 = require("./tracer-config");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
const util_1 = require("./util"); const util_1 = require("./util");
/** /**
@@ -52,19 +52,19 @@ let cachedCodeQL = undefined;
* The version flags below can be used to conditionally enable certain features * The version flags below can be used to conditionally enable certain features
* on versions newer than this. * on versions newer than this.
*/ */
const CODEQL_MINIMUM_VERSION = "2.11.6"; const CODEQL_MINIMUM_VERSION = "2.12.6";
/** /**
* This version will shortly become the oldest version of CodeQL that the Action will run with. * This version will shortly become the oldest version of CodeQL that the Action will run with.
*/ */
const CODEQL_NEXT_MINIMUM_VERSION = "2.11.6"; const CODEQL_NEXT_MINIMUM_VERSION = "2.12.6";
/** /**
* This is the version of GHES that was most recently deprecated. * This is the version of GHES that was most recently deprecated.
*/ */
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.7"; const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.8";
/** /**
* This is the deprecation date for the version of GHES that was most recently deprecated. * This is the deprecation date for the version of GHES that was most recently deprecated.
*/ */
const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-11-08"; const GHES_MOST_RECENT_DEPRECATION_DATE = "2024-03-26";
/** The CLI verbosity level to use for extraction in debug mode. */ /** The CLI verbosity level to use for extraction in debug mode. */
const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++"; const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
/* /*
@@ -74,20 +74,6 @@ const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
* For convenience, please keep these in descending order. Once a version * For convenience, please keep these in descending order. Once a version
* flag is older than the oldest supported version above, it may be removed. * flag is older than the oldest supported version above, it may be removed.
*/ */
/**
* Versions 2.12.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
* each language.
*/
exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
/**
* Versions 2.12.3+ of the CodeQL CLI support exporting configuration information from a code
* scanning config file to SARIF.
*/
exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = "2.12.3";
/**
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
*/
exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
/** /**
* Versions 2.13.1+ of the CodeQL CLI fix a bug where diagnostics export could produce invalid SARIF. * Versions 2.13.1+ of the CodeQL CLI fix a bug where diagnostics export could produce invalid SARIF.
*/ */
@@ -268,9 +254,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
async supportsFeature(feature) { async supportsFeature(feature) {
return (0, tools_features_1.isSupportedToolsFeature)(await this.getVersion(), feature); return (0, tools_features_1.isSupportedToolsFeature)(await this.getVersion(), feature);
}, },
async databaseInitCluster(config, sourceRoot, processName, qlconfigFile, logger) { async databaseInitCluster(config, sourceRoot, processName, qlconfigFile, features, logger) {
const extraArgs = config.languages.map((language) => `--language=${language}`); const extraArgs = config.languages.map((language) => `--language=${language}`);
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) { if (await (0, tracer_config_1.shouldEnableIndirectTracing)(codeql, config, features)) {
extraArgs.push("--begin-tracing"); extraArgs.push("--begin-tracing");
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config))); extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
extraArgs.push(`--trace-process-name=${processName}`); extraArgs.push(`--trace-process-name=${processName}`);
@@ -285,8 +271,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
(await this.supportsFeature(tools_features_1.ToolsFeature.BuildModeOption))) { (await this.supportsFeature(tools_features_1.ToolsFeature.BuildModeOption))) {
extraArgs.push(`--build-mode=${config.buildMode}`); extraArgs.push(`--build-mode=${config.buildMode}`);
} }
if (qlconfigFile !== undefined && if (qlconfigFile !== undefined) {
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
extraArgs.push(`--qlconfig-file=${qlconfigFile}`); extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
} }
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) { if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
@@ -301,29 +286,33 @@ async function getCodeQLForCmd(cmd, checkVersion) {
await runTool(cmd, [ await runTool(cmd, [
"database", "database",
"init", "init",
"--overwrite",
"--db-cluster", "--db-cluster",
config.dbLocation, config.dbLocation,
`--source-root=${sourceRoot}`, `--source-root=${sourceRoot}`,
...(await getLanguageAliasingArguments(this)), ...(await getLanguageAliasingArguments(this)),
...extraArgs, ...extraArgs,
...getExtraOptionsFromEnv(["database", "init"]), ...getExtraOptionsFromEnv(["database", "init"], {
ignoringOptions: ["--overwrite"],
}),
], { stdin: externalRepositoryToken }); ], { stdin: externalRepositoryToken });
}, },
async runAutobuild(language, enableDebugLogging) { async runAutobuild(config, language, features) {
applyAutobuildAzurePipelinesTimeoutFix();
if (await features.getValue(feature_flags_1.Feature.AutobuildDirectTracingEnabled, this)) {
await runTool(cmd, [
"database",
"trace-command",
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
...getExtractionVerbosityArguments(config.debugMode),
...getExtraOptionsFromEnv(["database", "trace-command"]),
util.getCodeQLDatabasePath(config, language),
]);
return;
}
const autobuildCmd = path.join(await this.resolveExtractor(language), "tools", process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh"); const autobuildCmd = path.join(await this.resolveExtractor(language), "tools", process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh");
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
// and Maven not properly handling closed connections
// Otherwise long build processes will timeout when pulling down Java packages
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
const javaToolOptions = process.env["JAVA_TOOL_OPTIONS"] || "";
process.env["JAVA_TOOL_OPTIONS"] = [
...javaToolOptions.split(/\s+/),
"-Dhttp.keepAlive=false",
"-Dmaven.wagon.http.pool=false",
].join(" ");
// Bump the verbosity of the autobuild command if we're in debug mode // Bump the verbosity of the autobuild command if we're in debug mode
if (enableDebugLogging) { if (config.debugMode) {
process.env[environment_1.EnvVar.CLI_VERBOSITY] = process.env[environment_1.EnvVar.CLI_VERBOSITY] =
process.env[environment_1.EnvVar.CLI_VERBOSITY] || EXTRACTION_DEBUG_MODE_VERBOSITY; process.env[environment_1.EnvVar.CLI_VERBOSITY] || EXTRACTION_DEBUG_MODE_VERBOSITY;
} }
@@ -354,15 +343,35 @@ async function getCodeQLForCmd(cmd, checkVersion) {
]); ]);
}, },
async extractUsingBuildMode(config, language) { async extractUsingBuildMode(config, language) {
await runTool(cmd, [ if (config.buildMode === util_1.BuildMode.Autobuild) {
"database", applyAutobuildAzurePipelinesTimeoutFix();
"trace-command", }
"--use-build-mode", try {
...(await getTrapCachingExtractorConfigArgsForLang(config, language)), await runTool(cmd, [
...getExtractionVerbosityArguments(config.debugMode), "database",
...getExtraOptionsFromEnv(["database", "trace-command"]), "trace-command",
util.getCodeQLDatabasePath(config, language), "--use-build-mode",
]); ...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
...getExtractionVerbosityArguments(config.debugMode),
...getExtraOptionsFromEnv(["database", "trace-command"]),
util.getCodeQLDatabasePath(config, language),
]);
}
catch (e) {
if (config.buildMode === util_1.BuildMode.Autobuild) {
const prefix = "We were unable to automatically build your code. " +
"Please change the build mode for this language to manual and specify build steps " +
"for your project. For more information, see " +
"https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/automatic-build-failed.";
const ErrorConstructor = e instanceof util.ConfigurationError
? util.ConfigurationError
: Error;
throw new ErrorConstructor(`${prefix} ${util.wrapError(e).message}`);
}
else {
throw e;
}
}
}, },
async finalizeDatabase(databasePath, threadsFlag, memoryFlag, enableDebugLogging) { async finalizeDatabase(databasePath, threadsFlag, memoryFlag, enableDebugLogging) {
const args = [ const args = [
@@ -453,13 +462,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"run-queries", "run-queries",
...flags, ...flags,
databasePath, databasePath,
"--expect-discarded-cache",
"--min-disk-free=1024", // Try to leave at least 1GB free "--min-disk-free=1024", // Try to leave at least 1GB free
"-v", "-v",
...getExtraOptionsFromEnv(["database", "run-queries"]), ...getExtraOptionsFromEnv(["database", "run-queries"], {
ignoringOptions: ["--expect-discarded-cache"],
}),
]; ];
if (await util.supportExpectDiscardedCache(this)) {
codeqlArgs.push("--expect-discarded-cache");
}
if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_FINE_GRAINED_PARALLELISM)) { if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_FINE_GRAINED_PARALLELISM)) {
codeqlArgs.push("--intra-layer-parallelism"); codeqlArgs.push("--intra-layer-parallelism");
} }
@@ -483,7 +492,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"--print-diagnostics-summary", "--print-diagnostics-summary",
"--print-metrics-summary", "--print-metrics-summary",
"--sarif-add-baseline-file-info", "--sarif-add-baseline-file-info",
...(await getCodeScanningConfigExportArguments(config, this)), `--sarif-codescanning-config=${getGeneratedCodeScanningConfigPath(config)}`,
"--sarif-group-rules-by-pack", "--sarif-group-rules-by-pack",
...(await getCodeScanningQueryHelpArguments(this)), ...(await getCodeScanningQueryHelpArguments(this)),
...getExtraOptionsFromEnv(["database", "interpret-results"]), ...getExtraOptionsFromEnv(["database", "interpret-results"]),
@@ -500,20 +509,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
if (shouldExportDiagnostics) { if (shouldExportDiagnostics) {
codeqlArgs.push("--sarif-include-diagnostics"); codeqlArgs.push("--sarif-include-diagnostics");
} }
else if (await util.codeQlVersionAbove(this, "2.12.4")) { else {
codeqlArgs.push("--no-sarif-include-diagnostics"); codeqlArgs.push("--no-sarif-include-diagnostics");
} }
if ( if ((await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) &&
// Analysis summary v2 links to the status page, so check the GHES version we're running on !(0, tools_features_1.isSupportedToolsFeature)(await this.getVersion(), tools_features_1.ToolsFeature.AnalysisSummaryV2IsDefault)) {
// supports the status page.
(config.gitHubVersion.type !== util.GitHubVariant.GHES ||
semver.gte(config.gitHubVersion.version, "3.9.0")) &&
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2))) {
codeqlArgs.push("--new-analysis-summary"); codeqlArgs.push("--new-analysis-summary");
} }
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
codeqlArgs.push("--no-new-analysis-summary");
}
codeqlArgs.push(databasePath); codeqlArgs.push(databasePath);
if (querySuitePaths) { if (querySuitePaths) {
codeqlArgs.push(...querySuitePaths); codeqlArgs.push(...querySuitePaths);
@@ -633,7 +635,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"export", "export",
"--format=sarif-latest", "--format=sarif-latest",
`--output=${sarifFile}`, `--output=${sarifFile}`,
...(await getCodeScanningConfigExportArguments(config, this)), `--sarif-codescanning-config=${getGeneratedCodeScanningConfigPath(config)}`,
...getExtraOptionsFromEnv(["diagnostics", "export"]), ...getExtraOptionsFromEnv(["diagnostics", "export"]),
]; ];
if (automationDetailsId !== undefined) { if (automationDetailsId !== undefined) {
@@ -706,8 +708,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"version of the CLI using the 'tools' input to the 'init' Action, you can remove this " + "version of the CLI using the 'tools' input to the 'init' Action, you can remove this " +
"input to use the default version.\n\n" + "input to use the default version.\n\n" +
"Alternatively, if you want to continue using CodeQL CLI version " + "Alternatively, if you want to continue using CodeQL CLI version " +
`${result.version}, you can replace 'github/codeql-action/*@v3' by ` + `${result.version}, you can replace 'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)().split(".")[0]}' by 'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
`'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
"continue using this version of the CodeQL Action."); "continue using this version of the CodeQL Action.");
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true"); core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
} }
@@ -716,10 +717,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
exports.getCodeQLForCmd = getCodeQLForCmd; exports.getCodeQLForCmd = getCodeQLForCmd;
/** /**
* Gets the options for `path` of `options` as an array of extra option strings. * Gets the options for `path` of `options` as an array of extra option strings.
*
* @param ignoringOptions Options that should be ignored, for example because they have already
* been passed and it is an error to pass them more than once.
*/ */
function getExtraOptionsFromEnv(paths) { function getExtraOptionsFromEnv(paths, { ignoringOptions } = {}) {
const options = util.getExtraOptionsEnvParam(); const options = util.getExtraOptionsEnvParam();
return getExtraOptions(options, paths, []); return getExtraOptions(options, paths, []).filter((option) => !ignoringOptions?.includes(option));
} }
/** /**
* Gets `options` as an array of extra option strings. * Gets `options` as an array of extra option strings.
@@ -859,20 +863,6 @@ async function generateCodeScanningConfig(config, logger) {
function cloneObject(obj) { function cloneObject(obj) {
return JSON.parse(JSON.stringify(obj)); return JSON.parse(JSON.stringify(obj));
} }
/**
* Gets arguments for passing the code scanning configuration file to interpretation commands like
* `codeql database interpret-results` and `codeql database export-diagnostics`.
*
* Returns an empty list if a code scanning configuration file was not generated by the CLI.
*/
async function getCodeScanningConfigExportArguments(config, codeql) {
const codeScanningConfigPath = getGeneratedCodeScanningConfigPath(config);
if (fs.existsSync(codeScanningConfigPath) &&
(await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG))) {
return ["--sarif-codescanning-config", codeScanningConfigPath];
}
return [];
}
// This constant sets the size of each TRAP cache in megabytes. // This constant sets the size of each TRAP cache in megabytes.
const TRAP_CACHE_SIZE_MB = 1024; const TRAP_CACHE_SIZE_MB = 1024;
async function getTrapCachingExtractorConfigArgs(config) { async function getTrapCachingExtractorConfigArgs(config) {
@@ -930,4 +920,19 @@ function getExtractionVerbosityArguments(enableDebugLogging) {
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`] ? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
: []; : [];
} }
/**
* Updates the `JAVA_TOOL_OPTIONS` environment variable to resolve an issue with Azure Pipelines
* timing out connections after 4 minutes and Maven not properly handling closed connections.
*
* Without the fix, long build processes will timeout when pulling down Java packages
* https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
*/
function applyAutobuildAzurePipelinesTimeoutFix() {
const javaToolOptions = process.env["JAVA_TOOL_OPTIONS"] || "";
process.env["JAVA_TOOL_OPTIONS"] = [
...javaToolOptions.split(/\s+/),
"-Dhttp.keepAlive=false",
"-Dmaven.wagon.http.pool=false",
].join(" ");
}
//# sourceMappingURL=codeql.js.map //# sourceMappingURL=codeql.js.map

File diff suppressed because one or more lines are too long

124
lib/codeql.test.js generated
View File

@@ -44,6 +44,7 @@ const languages_1 = require("./languages");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const setup_codeql_1 = require("./setup-codeql"); const setup_codeql_1 = require("./setup-codeql");
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
const tools_features_1 = require("./tools-features");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
const util_1 = require("./util"); const util_1 = require("./util");
(0, testing_utils_1.setupTests)(ava_1.default); (0, testing_utils_1.setupTests)(ava_1.default);
@@ -261,7 +262,7 @@ for (const toolcacheVersion of [
mockApiDetails(testing_utils_1.SAMPLE_DOTCOM_API_DETAILS); mockApiDetails(testing_utils_1.SAMPLE_DOTCOM_API_DETAILS);
sinon.stub(actionsUtil, "isRunningLocalAction").returns(true); sinon.stub(actionsUtil, "isRunningLocalAction").returns(true);
const releasesApiMock = mockReleaseApi({ const releasesApiMock = mockReleaseApi({
assetNames: ["cli-version-2.12.2.txt"], assetNames: ["cli-version-2.12.6.txt"],
tagName: "codeql-bundle-20230203", tagName: "codeql-bundle-20230203",
}); });
(0, testing_utils_1.mockBundleDownloadApi)({ (0, testing_utils_1.mockBundleDownloadApi)({
@@ -314,7 +315,7 @@ const injectedConfigMacro = ava_1.default.macro({
tempDir, tempDir,
augmentationProperties, augmentationProperties,
}; };
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
// should have used an config file // should have used an config file
const configArg = args.find((arg) => arg.startsWith("--codescanning-config=")); const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
@@ -449,10 +450,8 @@ const injectedConfigMacro = ava_1.default.macro({
await util.withTmpDir(async (tempDir) => { await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
.stub(codeqlObject, "getVersion") await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, "/path/to/qlconfig.yml", (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
// should have used a config file // should have used a config file
const hasCodeScanningConfigArg = args.some((arg) => arg.startsWith("--codescanning-config=")); const hasCodeScanningConfigArg = args.some((arg) => arg.startsWith("--codescanning-config="));
@@ -462,30 +461,13 @@ const injectedConfigMacro = ava_1.default.macro({
t.truthy(hasQlconfigArg, "Should have injected a codescanning config"); t.truthy(hasQlconfigArg, "Should have injected a codescanning config");
}); });
}); });
(0, ava_1.default)("passes a code scanning config BUT NOT a qlconfig to the CLI for CodeQL v2.12.2", async (t) => {
await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.2"));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should have used a config file
const hasCodeScanningConfigArg = args.some((arg) => arg.startsWith("--codescanning-config="));
t.true(hasCodeScanningConfigArg, "Should have injected a codescanning config");
// should not have passed a qlconfig file
const hasQlconfigArg = args.some((arg) => arg.startsWith("--qlconfig-file="));
t.false(hasQlconfigArg, "should NOT have injected a qlconfig");
});
});
(0, ava_1.default)("does not pass a qlconfig to the CLI when it is undefined", async (t) => { (0, ava_1.default)("does not pass a qlconfig to the CLI when it is undefined", async (t) => {
await util.withTmpDir(async (tempDir) => { await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
.stub(codeqlObject, "getVersion")
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, undefined, // undefined qlconfigFile await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, undefined, // undefined qlconfigFile
(0, logging_1.getRunnerLogger)(true)); (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
const hasQlconfigArg = args.some((arg) => arg.startsWith("--qlconfig-file=")); const hasQlconfigArg = args.some((arg) => arg.startsWith("--qlconfig-file="));
t.false(hasQlconfigArg, "should NOT have injected a qlconfig"); t.false(hasQlconfigArg, "should NOT have injected a qlconfig");
@@ -493,7 +475,17 @@ const injectedConfigMacro = ava_1.default.macro({
}); });
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [ const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
{ {
codeqlVersion: "2.15.0", codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.15.0", {
[tools_features_1.ToolsFeature.AnalysisSummaryV2IsDefault]: true,
}),
githubVersion: {
type: util.GitHubVariant.DOTCOM,
},
flagPassed: false,
negativeFlagPassed: false,
},
{
codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.15.0"),
githubVersion: { githubVersion: {
type: util.GitHubVariant.DOTCOM, type: util.GitHubVariant.DOTCOM,
}, },
@@ -501,7 +493,7 @@ const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
negativeFlagPassed: false, negativeFlagPassed: false,
}, },
{ {
codeqlVersion: "2.15.0", codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.15.0"),
githubVersion: { githubVersion: {
type: util.GitHubVariant.GHES, type: util.GitHubVariant.GHES,
version: "3.9.0", version: "3.9.0",
@@ -510,16 +502,7 @@ const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
negativeFlagPassed: false, negativeFlagPassed: false,
}, },
{ {
codeqlVersion: "2.15.0", codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.14.6"),
githubVersion: {
type: util.GitHubVariant.GHES,
version: "3.8.6",
},
flagPassed: false,
negativeFlagPassed: true,
},
{
codeqlVersion: "2.14.6",
githubVersion: { githubVersion: {
type: util.GitHubVariant.DOTCOM, type: util.GitHubVariant.DOTCOM,
}, },
@@ -532,12 +515,10 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
? "--new-analysis-summary" ? "--new-analysis-summary"
: negativeFlagPassed : negativeFlagPassed
? "--no-new-analysis-summary" ? "--no-new-analysis-summary"
: "nothing"} for CodeQL CLI v${codeqlVersion} and ${util.GitHubVariant[githubVersion.type]} ${githubVersion.version ? ` ${githubVersion.version}` : ""}`, async (t) => { : "nothing"} for CodeQL version ${JSON.stringify(codeqlVersion)} and ${util.GitHubVariant[githubVersion.type]} ${githubVersion.version ? ` ${githubVersion.version}` : ""}`, async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
.stub(codeqlObject, "getVersion")
.resolves((0, testing_utils_1.makeVersionInfo)(codeqlVersion));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", Object.assign({}, stubConfig, { gitHubVersion: githubVersion }), (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", Object.assign({}, stubConfig, { gitHubVersion: githubVersion }), (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
@@ -545,39 +526,12 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`); t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`);
}); });
} }
(0, ava_1.default)("database finalize recognises JavaScript no code found error on CodeQL 2.11.6", async (t) => { (0, ava_1.default)("database finalize does not override no code found error on CodeQL 2.12.6", async (t) => {
stubToolRunnerConstructor(1, `2020-09-07T17:39:53.9050522Z [2020-09-07 17:39:53] [build] Done extracting /opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/data/externs/web/ie_vml.js (3 ms)
2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh])`);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", "", false), {
instanceOf: util.ConfigurationError,
message: new RegExp("No code found during the build\\. Please see: " +
"https://gh\\.io/troubleshooting-code-scanning/no-source-code-seen-during-build\\."),
});
});
(0, ava_1.default)("database finalize overrides no code found error on CodeQL 2.11.6", async (t) => {
stubToolRunnerConstructor(32);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", "", false), {
instanceOf: util.ConfigurationError,
message: new RegExp("No code found during the build\\. Please see: " +
"https://gh\\.io/troubleshooting-code-scanning/no-source-code-seen-during-build\\."),
});
});
(0, ava_1.default)("database finalize does not override no code found error on CodeQL 2.12.4", async (t) => {
const cliMessage = "CodeQL did not detect any code written in languages supported by CodeQL. Review our troubleshooting guide at " + const cliMessage = "CodeQL did not detect any code written in languages supported by CodeQL. Review our troubleshooting guide at " +
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build."; "https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.";
stubToolRunnerConstructor(32, cliMessage); stubToolRunnerConstructor(32, cliMessage);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4")); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
@@ -592,7 +546,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
`${heapError}\n${datasetImportError}.`; `${heapError}\n${datasetImportError}.`;
stubToolRunnerConstructor(32, cliStderr); stubToolRunnerConstructor(32, cliStderr);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4")); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
@@ -614,11 +568,11 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
`; `;
stubToolRunnerConstructor(1, stderr); stubToolRunnerConstructor(1, stderr);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4")); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor"); sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.runAutobuild(languages_1.Language.java, false), { await t.throwsAsync(async () => await codeqlObject.runAutobuild(stubConfig, languages_1.Language.java, (0, testing_utils_1.createFeatures)([])), {
instanceOf: cli_errors_1.CommandInvocationError, instanceOf: cli_errors_1.CommandInvocationError,
message: "We were unable to automatically build your code. Please provide manual build steps. " + message: "We were unable to automatically build your code. Please provide manual build steps. " +
"For more information, see " + "For more information, see " +
@@ -633,11 +587,11 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
const stderr = Array.from({ length: 20 }, (_, i) => `[2019-09-18 12:00:00] [autobuild] [ERROR] line${i + 1}`).join("\n"); const stderr = Array.from({ length: 20 }, (_, i) => `[2019-09-18 12:00:00] [autobuild] [ERROR] line${i + 1}`).join("\n");
stubToolRunnerConstructor(1, stderr); stubToolRunnerConstructor(1, stderr);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4")); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor"); sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.runAutobuild(languages_1.Language.java, false), { await t.throwsAsync(async () => await codeqlObject.runAutobuild(stubConfig, languages_1.Language.java, (0, testing_utils_1.createFeatures)([])), {
instanceOf: cli_errors_1.CommandInvocationError, instanceOf: cli_errors_1.CommandInvocationError,
message: "We were unable to automatically build your code. Please provide manual build steps. " + message: "We were unable to automatically build your code. Please provide manual build steps. " +
"For more information, see " + "For more information, see " +
@@ -650,7 +604,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
const cliStderr = "line1\nline2\nline3\nline4\nline5"; const cliStderr = "line1\nline2\nline3\nline4\nline5";
stubToolRunnerConstructor(32, cliStderr); stubToolRunnerConstructor(32, cliStderr);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4")); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
@@ -659,6 +613,24 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
"Exit code was 32 and last log line was: line5\\. See the logs for more details\\."), "Exit code was 32 and last log line was: line5\\. See the logs for more details\\."),
}); });
}); });
(0, ava_1.default)("Avoids duplicating --overwrite flag if specified in CODEQL_ACTION_EXTRA_OPTIONS", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
process.env["CODEQL_ACTION_EXTRA_OPTIONS"] =
'{ "database": { "init": ["--overwrite"] } }';
await codeqlObject.databaseInitCluster(stubConfig, "sourceRoot", undefined, undefined, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(false));
t.true(runnerConstructorStub.calledOnce);
const args = runnerConstructorStub.firstCall.args[1];
t.is(args.filter((option) => option === "--overwrite").length, 1, "--overwrite should only be passed once");
// Clean up
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
t.truthy(configArg, "Should have injected a codescanning config");
const configFile = configArg.split("=")[1];
await (0, del_1.default)(configFile, { force: true });
});
function stubToolRunnerConstructor(exitCode = 0, stderr) { function stubToolRunnerConstructor(exitCode = 0, stderr) {
const runnerObjectStub = sinon.createStubInstance(toolrunner.ToolRunner); const runnerObjectStub = sinon.createStubInstance(toolrunner.ToolRunner);
const runnerConstructorStub = sinon.stub(toolrunner, "ToolRunner"); const runnerConstructorStub = sinon.stub(toolrunner, "ToolRunner");

File diff suppressed because one or more lines are too long

14
lib/config-utils.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.parseBuildModeInput = exports.wrapEnvironment = exports.generateRegistries = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromInput = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getPacksStrInvalid = exports.defaultAugmentationProperties = exports.BuildMode = void 0; exports.parseBuildModeInput = exports.wrapEnvironment = exports.generateRegistries = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromInput = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getPacksStrInvalid = exports.defaultAugmentationProperties = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks"); const perf_hooks_1 = require("perf_hooks");
@@ -37,12 +37,6 @@ const trap_caching_1 = require("./trap-caching");
const util_1 = require("./util"); const util_1 = require("./util");
// Property names from the user-supplied config file. // Property names from the user-supplied config file.
const PACKS_PROPERTY = "packs"; const PACKS_PROPERTY = "packs";
var BuildMode;
(function (BuildMode) {
BuildMode["None"] = "none";
BuildMode["Autobuild"] = "autobuild";
BuildMode["Manual"] = "manual";
})(BuildMode || (exports.BuildMode = BuildMode = {}));
/** /**
* The default, empty augmentation properties. This is most useful * The default, empty augmentation properties. This is most useful
* for tests. * for tests.
@@ -677,13 +671,13 @@ async function parseBuildModeInput(input, languages, features, logger) {
if (input === undefined) { if (input === undefined) {
return undefined; return undefined;
} }
if (!Object.values(BuildMode).includes(input)) { if (!Object.values(util_1.BuildMode).includes(input)) {
throw new util_1.ConfigurationError(`Invalid build mode: '${input}'. Supported build modes are: ${Object.values(BuildMode).join(", ")}.`); throw new util_1.ConfigurationError(`Invalid build mode: '${input}'. Supported build modes are: ${Object.values(util_1.BuildMode).join(", ")}.`);
} }
if (languages.includes(languages_1.Language.java) && if (languages.includes(languages_1.Language.java) &&
(await features.getValue(feature_flags_1.Feature.DisableJavaBuildlessEnabled))) { (await features.getValue(feature_flags_1.Feature.DisableJavaBuildlessEnabled))) {
logger.warning("Scanning Java code without a build is temporarily unavailable. Falling back to 'autobuild' build mode."); logger.warning("Scanning Java code without a build is temporarily unavailable. Falling back to 'autobuild' build mode.");
return BuildMode.Autobuild; return util_1.BuildMode.Autobuild;
} }
return input; return input;
} }

File diff suppressed because one or more lines are too long

View File

@@ -35,7 +35,6 @@ const sinon = __importStar(require("sinon"));
const api = __importStar(require("./api-client")); const api = __importStar(require("./api-client"));
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const configUtils = __importStar(require("./config-utils")); const configUtils = __importStar(require("./config-utils"));
const config_utils_1 = require("./config-utils");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages"); const languages_1 = require("./languages");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
@@ -269,7 +268,7 @@ function mockListLanguages(languages) {
// And the config we expect it to parse to // And the config we expect it to parse to
const expectedConfig = { const expectedConfig = {
languages: [languages_1.Language.javascript], languages: [languages_1.Language.javascript],
buildMode: config_utils_1.BuildMode.None, buildMode: util_1.BuildMode.None,
originalUserInput: { originalUserInput: {
name: "my config", name: "my config",
"disable-default-queries": true, "disable-default-queries": true,
@@ -768,19 +767,19 @@ const mockRepositoryNwo = (0, repository_1.parseRepositoryNwo)("owner/repo");
(0, ava_1.default)("Build mode not overridden when disable Java buildless feature flag disabled", async (t) => { (0, ava_1.default)("Build mode not overridden when disable Java buildless feature flag disabled", async (t) => {
const messages = []; const messages = [];
const buildMode = await configUtils.parseBuildModeInput("none", [languages_1.Language.java], (0, testing_utils_1.createFeatures)([]), (0, testing_utils_1.getRecordingLogger)(messages)); const buildMode = await configUtils.parseBuildModeInput("none", [languages_1.Language.java], (0, testing_utils_1.createFeatures)([]), (0, testing_utils_1.getRecordingLogger)(messages));
t.is(buildMode, config_utils_1.BuildMode.None); t.is(buildMode, util_1.BuildMode.None);
t.deepEqual(messages, []); t.deepEqual(messages, []);
}); });
(0, ava_1.default)("Build mode not overridden for other languages", async (t) => { (0, ava_1.default)("Build mode not overridden for other languages", async (t) => {
const messages = []; const messages = [];
const buildMode = await configUtils.parseBuildModeInput("none", [languages_1.Language.python], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableJavaBuildlessEnabled]), (0, testing_utils_1.getRecordingLogger)(messages)); const buildMode = await configUtils.parseBuildModeInput("none", [languages_1.Language.python], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableJavaBuildlessEnabled]), (0, testing_utils_1.getRecordingLogger)(messages));
t.is(buildMode, config_utils_1.BuildMode.None); t.is(buildMode, util_1.BuildMode.None);
t.deepEqual(messages, []); t.deepEqual(messages, []);
}); });
(0, ava_1.default)("Build mode overridden when analyzing Java and disable Java buildless feature flag enabled", async (t) => { (0, ava_1.default)("Build mode overridden when analyzing Java and disable Java buildless feature flag enabled", async (t) => {
const messages = []; const messages = [];
const buildMode = await configUtils.parseBuildModeInput("none", [languages_1.Language.java], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableJavaBuildlessEnabled]), (0, testing_utils_1.getRecordingLogger)(messages)); const buildMode = await configUtils.parseBuildModeInput("none", [languages_1.Language.java], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableJavaBuildlessEnabled]), (0, testing_utils_1.getRecordingLogger)(messages));
t.is(buildMode, config_utils_1.BuildMode.Autobuild); t.is(buildMode, util_1.BuildMode.Autobuild);
t.deepEqual(messages, [ t.deepEqual(messages, [
{ {
message: "Scanning Java code without a build is temporarily unavailable. Falling back to 'autobuild' build mode.", message: "Scanning Java code without a build is temporarily unavailable. Falling back to 'autobuild' build mode.",

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"bundleVersion": "codeql-bundle-v2.16.5", "bundleVersion": "codeql-bundle-v2.17.0",
"cliVersion": "2.16.5", "cliVersion": "2.17.0",
"priorBundleVersion": "codeql-bundle-v2.16.4", "priorBundleVersion": "codeql-bundle-v2.16.5",
"priorCliVersion": "2.16.4" "priorCliVersion": "2.16.5"
} }

54
lib/diagnostics.js generated
View File

@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.addDiagnostic = exports.makeDiagnostic = void 0; exports.flushDiagnostics = exports.logUnwrittenDiagnostics = exports.addDiagnostic = exports.makeDiagnostic = void 0;
const fs_1 = require("fs"); const fs_1 = require("fs");
const path_1 = __importDefault(require("path")); const path_1 = __importDefault(require("path"));
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const util_1 = require("./util"); const util_1 = require("./util");
/** A list of diagnostics which have not yet been written to disk. */
let unwrittenDiagnostics = [];
/** /**
* Constructs a new diagnostic message with the specified id and name, as well as optional additional data. * Constructs a new diagnostic message with the specified id and name, as well as optional additional data.
* *
@@ -25,12 +27,35 @@ function makeDiagnostic(id, name, data = undefined) {
} }
exports.makeDiagnostic = makeDiagnostic; exports.makeDiagnostic = makeDiagnostic;
/** /**
* Writes the given diagnostic to the database. * Adds the given diagnostic to the database. If the database does not yet exist,
* the diagnostic will be written to it once it has been created.
* *
* @param config The configuration that tells us where to store the diagnostic. * @param config The configuration that tells us where to store the diagnostic.
* @param language The language which the diagnostic is for.
* @param diagnostic The diagnostic message to add to the database. * @param diagnostic The diagnostic message to add to the database.
*/ */
function addDiagnostic(config, language, diagnostic) { function addDiagnostic(config, language, diagnostic) {
const logger = (0, logging_1.getActionsLogger)();
const databasePath = (0, util_1.getCodeQLDatabasePath)(config, language);
// Check that the database exists before writing to it. If the database does not yet exist,
// store the diagnostic in memory and write it later.
if ((0, fs_1.existsSync)(databasePath)) {
writeDiagnostic(config, language, diagnostic);
}
else {
logger.debug(`Writing a diagnostic for ${language}, but the database at ${databasePath} does not exist yet.`);
unwrittenDiagnostics.push({ diagnostic, language });
}
}
exports.addDiagnostic = addDiagnostic;
/**
* Writes the given diagnostic to the database.
*
* @param config The configuration that tells us where to store the diagnostic.
* @param language The language which the diagnostic is for.
* @param diagnostic The diagnostic message to add to the database.
*/
function writeDiagnostic(config, language, diagnostic) {
const logger = (0, logging_1.getActionsLogger)(); const logger = (0, logging_1.getActionsLogger)();
const diagnosticsPath = path_1.default.resolve((0, util_1.getCodeQLDatabasePath)(config, language), "diagnostic", "codeql-action"); const diagnosticsPath = path_1.default.resolve((0, util_1.getCodeQLDatabasePath)(config, language), "diagnostic", "codeql-action");
try { try {
@@ -41,7 +66,30 @@ function addDiagnostic(config, language, diagnostic) {
} }
catch (err) { catch (err) {
logger.warning(`Unable to write diagnostic message to database: ${err}`); logger.warning(`Unable to write diagnostic message to database: ${err}`);
logger.debug(JSON.stringify(diagnostic));
} }
} }
exports.addDiagnostic = addDiagnostic; /** Report if there are unwritten diagnostics and write them to the log. */
function logUnwrittenDiagnostics() {
const logger = (0, logging_1.getActionsLogger)();
const num = unwrittenDiagnostics.length;
if (num > 0) {
logger.warning(`${num} diagnostic(s) could not be written to the database and will not appear on the Tool Status Page.`);
for (const unwritten of unwrittenDiagnostics) {
logger.debug(JSON.stringify(unwritten.diagnostic));
}
}
}
exports.logUnwrittenDiagnostics = logUnwrittenDiagnostics;
/** Writes all unwritten diagnostics to disk. */
function flushDiagnostics(config) {
const logger = (0, logging_1.getActionsLogger)();
logger.debug(`Writing ${unwrittenDiagnostics.length} diagnostic(s) to database.`);
for (const unwritten of unwrittenDiagnostics) {
writeDiagnostic(config, unwritten.language, unwritten.diagnostic);
}
// Reset the unwritten diagnostics array.
unwrittenDiagnostics = [];
}
exports.flushDiagnostics = flushDiagnostics;
//# sourceMappingURL=diagnostics.js.map //# sourceMappingURL=diagnostics.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA8C;AAC9C,gDAAwB;AAIxB,uCAA6C;AAC7C,iCAA+C;AAmD/C;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,EAAU,EACV,IAAY,EACZ,OAA+C,SAAS;IAExD,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtD,MAAM,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE;KACtC,CAAC;AACJ,CAAC;AAVD,wCAUC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,QAAkB,EAClB,UAA6B;IAE7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CA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IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC;IACxC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACZ,MAAM,CAAC,OAAO,CACZ,GAAG,GAAG,kGAAkG,CACzG,CAAC;QAEF,KAAK,MAAM,SAAS,IAAI,oBAAoB,EAAE,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;AACH,CAAC;AAZD,0DAYC;AAED,gDAAgD;AAChD,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,CAAC,KAAK,CACV,WAAW,oBAAoB,CAAC,MAAM,6BAA6B,CACpE,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,oBAAoB,EAAE,CAAC;QAC7C,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACpE,CAAC;IAED,yCAAyC;IACzC,oBAAoB,GAAG,EAAE,CAAC;AAC5B,CAAC;AAZD,4CAYC"}

52
lib/feature-flags.js generated
View File

@@ -23,12 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.isPythonDependencyInstallationDisabled = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_FINE_GRAINED_PARALLELISM = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0; exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_FINE_GRAINED_PARALLELISM = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const semver = __importStar(require("semver")); const semver = __importStar(require("semver"));
const api_client_1 = require("./api-client"); const api_client_1 = require("./api-client");
const defaults = __importStar(require("./defaults.json")); const defaults = __importStar(require("./defaults.json"));
const tools_features_1 = require("./tools-features");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
const DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_"; const DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_";
const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled"; const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
@@ -48,17 +49,22 @@ exports.CODEQL_VERSION_FINE_GRAINED_PARALLELISM = "2.15.1";
*/ */
var Feature; var Feature;
(function (Feature) { (function (Feature) {
Feature["AutobuildDirectTracingEnabled"] = "autobuild_direct_tracing_enabled";
Feature["CliSarifMerge"] = "cli_sarif_merge_enabled"; Feature["CliSarifMerge"] = "cli_sarif_merge_enabled";
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled"; Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
Feature["CppTrapCachingEnabled"] = "cpp_trap_caching_enabled"; Feature["CppTrapCachingEnabled"] = "cpp_trap_caching_enabled";
Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled"; Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled";
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled"; Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled";
Feature["PythonDefaultIsToSkipDependencyInstallationEnabled"] = "python_default_is_to_skip_dependency_installation_enabled";
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled"; Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled"; Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
})(Feature || (exports.Feature = Feature = {})); })(Feature || (exports.Feature = Feature = {}));
exports.featureConfig = { exports.featureConfig = {
[Feature.AutobuildDirectTracingEnabled]: {
envVar: "CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING",
minimumVersion: undefined,
toolsFeature: tools_features_1.ToolsFeature.TraceCommandUseBuildMode,
defaultValue: false,
},
[Feature.CliSarifMerge]: { [Feature.CliSarifMerge]: {
envVar: "CODEQL_ACTION_CLI_SARIF_MERGE", envVar: "CODEQL_ACTION_CLI_SARIF_MERGE",
// This is guarded by a `supportsFeature` check rather than by a version check. // This is guarded by a `supportsFeature` check rather than by a version check.
@@ -87,7 +93,7 @@ exports.featureConfig = {
}, },
[Feature.ExportDiagnosticsEnabled]: { [Feature.ExportDiagnosticsEnabled]: {
envVar: "CODEQL_ACTION_EXPORT_DIAGNOSTICS", envVar: "CODEQL_ACTION_EXPORT_DIAGNOSTICS",
minimumVersion: "2.12.4", minimumVersion: undefined,
defaultValue: true, defaultValue: true,
}, },
[Feature.QaTelemetryEnabled]: { [Feature.QaTelemetryEnabled]: {
@@ -95,25 +101,6 @@ exports.featureConfig = {
minimumVersion: undefined, minimumVersion: undefined,
defaultValue: false, defaultValue: false,
}, },
[Feature.DisablePythonDependencyInstallationEnabled]: {
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
// Although the python extractor only started supporting not extracting installed
// dependencies in 2.13.1, the init-action can still benefit from not installing
// dependencies no matter what codeql version we are using, so therefore the
// minimumVersion is set to 'undefined'. This means that with an old CodeQL version,
// packages available with current python3 installation might get extracted.
minimumVersion: undefined,
defaultValue: false,
},
[Feature.PythonDefaultIsToSkipDependencyInstallationEnabled]: {
// we can reuse the same environment variable as above. If someone has set it to
// `true` in their workflow this means dependencies are not installed, setting it to
// `false` means dependencies _will_ be installed. The same semantics are applied
// here!
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
minimumVersion: "2.16.0",
defaultValue: true,
},
}; };
exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json"; exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json";
/** /**
@@ -145,6 +132,9 @@ class Features {
if (!codeql && exports.featureConfig[feature].minimumVersion) { if (!codeql && exports.featureConfig[feature].minimumVersion) {
throw new Error(`Internal error: A minimum version is specified for feature ${feature}, but no instance of CodeQL was provided.`); throw new Error(`Internal error: A minimum version is specified for feature ${feature}, but no instance of CodeQL was provided.`);
} }
if (!codeql && exports.featureConfig[feature].toolsFeature) {
throw new Error(`Internal error: A required tools feature is specified for feature ${feature}, but no instance of CodeQL was provided.`);
}
const envVar = (process.env[exports.featureConfig[feature].envVar] || "").toLocaleLowerCase(); const envVar = (process.env[exports.featureConfig[feature].envVar] || "").toLocaleLowerCase();
// Do not use this feature if user explicitly disables it via an environment variable. // Do not use this feature if user explicitly disables it via an environment variable.
if (envVar === "false") { if (envVar === "false") {
@@ -164,6 +154,17 @@ class Features {
`version ${minimumVersion} for feature ${feature}.`); `version ${minimumVersion} for feature ${feature}.`);
} }
} }
const toolsFeature = exports.featureConfig[feature].toolsFeature;
if (codeql && toolsFeature) {
if (!(await codeql.supportsFeature(toolsFeature))) {
this.logger.debug(`Feature ${feature} is disabled because the CodeQL CLI version does not support the ` +
`required tools feature ${toolsFeature}.`);
return false;
}
else {
this.logger.debug(`CodeQL CLI version ${(await codeql.getVersion()).version} supports the required tools feature ${toolsFeature} for feature ${feature}.`);
}
}
// Use this feature if user explicitly enables it via an environment variable. // Use this feature if user explicitly enables it via an environment variable.
if (envVar === "true") { if (envVar === "true") {
this.logger.debug(`Feature ${feature} is enabled via the environment variable ${exports.featureConfig[feature].envVar}.`); this.logger.debug(`Feature ${feature} is enabled via the environment variable ${exports.featureConfig[feature].envVar}.`);
@@ -343,9 +344,4 @@ class GitHubFeatureFlags {
} }
} }
} }
async function isPythonDependencyInstallationDisabled(codeql, features) {
return ((await features.getValue(Feature.DisablePythonDependencyInstallationEnabled, codeql)) ||
(await features.getValue(Feature.PythonDefaultIsToSkipDependencyInstallationEnabled, codeql)));
}
exports.isPythonDependencyInstallationDisabled = isPythonDependencyInstallationDisabled;
//# sourceMappingURL=feature-flags.js.map //# sourceMappingURL=feature-flags.js.map

File diff suppressed because one or more lines are too long

View File

@@ -34,6 +34,7 @@ const feature_flags_1 = require("./feature-flags");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const repository_1 = require("./repository"); const repository_1 = require("./repository");
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
const tools_features_1 = require("./tools-features");
const util_1 = require("./util"); const util_1 = require("./util");
(0, testing_utils_1.setupTests)(ava_1.default); (0, testing_utils_1.setupTests)(ava_1.default);
ava_1.default.beforeEach(() => { ava_1.default.beforeEach(() => {
@@ -129,14 +130,17 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
t.assert(!(await features.getValue(feature, includeCodeQlIfRequired(feature)))); t.assert(!(await features.getValue(feature, includeCodeQlIfRequired(feature))));
}); });
}); });
if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) { if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined ||
feature_flags_1.featureConfig[feature].toolsFeature !== undefined) {
(0, ava_1.default)(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => { (0, ava_1.default)(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => { await (0, util_1.withTmpDir)(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir); const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true); const expectedFeatureEnablement = initializeFeatures(true);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
await t.throwsAsync(async () => features.getValue(feature), { await t.throwsAsync(async () => features.getValue(feature), {
message: `Internal error: A minimum version is specified for feature ${feature}, but no instance of CodeQL was provided.`, message: `Internal error: A ${feature_flags_1.featureConfig[feature].minimumVersion !== undefined
? "minimum version"
: "required tools feature"} is specified for feature ${feature}, but no instance of CodeQL was provided.`,
}); });
}); });
}); });
@@ -165,14 +169,42 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
}); });
}); });
} }
if (feature_flags_1.featureConfig[feature].toolsFeature !== undefined) {
(0, ava_1.default)(`Feature '${feature}' is disabled if the required tools feature is not enabled`, async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
// feature should be disabled when the required tools feature is not enabled
let codeql = (0, testing_utils_1.mockCodeQLVersion)("2.0.0");
t.assert(!(await features.getValue(feature, codeql)));
// even setting the env var to true should not enable the feature if
// the required tools feature is not enabled
process.env[feature_flags_1.featureConfig[feature].envVar] = "true";
t.assert(!(await features.getValue(feature, codeql)));
// feature should be enabled when the required tools feature is enabled
// and env var is not set
process.env[feature_flags_1.featureConfig[feature].envVar] = "";
codeql = (0, testing_utils_1.mockCodeQLVersion)("2.0.0", {
[feature_flags_1.featureConfig[feature].toolsFeature]: true,
});
t.assert(await features.getValue(feature, codeql));
// set env var to false and check that the feature is now disabled
process.env[feature_flags_1.featureConfig[feature].envVar] = "false";
t.assert(!(await features.getValue(feature, codeql)));
});
});
}
} }
// If we ever run into a situation where we no longer have any features that // If we ever run into a situation where we no longer have any features that
// specify a minimum version, then we will have a bunch of code no longer being // specify a minimum version or required tools feature, then we will have a
// tested. This is unlikely, and this test will fail if that happens. // bunch of code no longer being tested. This is unlikely, and this test will
// fail if that happens.
// If we do end up in that situation, then we should consider adding a synthetic // If we do end up in that situation, then we should consider adding a synthetic
// feature with a minimum version that is only used for tests. // feature with a minimum version that is only used for tests.
(0, ava_1.default)("At least one feature has a minimum version specified", (t) => { (0, ava_1.default)("At least one feature has a minimum version specified", (t) => {
t.assert(Object.values(feature_flags_1.featureConfig).some((f) => f.minimumVersion !== undefined), "At least one feature should have a minimum version specified"); t.assert(Object.values(feature_flags_1.featureConfig).some((f) => f.minimumVersion !== undefined), "At least one feature should have a minimum version specified");
t.assert(Object.values(feature_flags_1.featureConfig).some((f) => f.toolsFeature !== undefined), "At least one feature should have a required tools feature specified");
// An even less likely scenario is that we no longer have any features. // An even less likely scenario is that we no longer have any features.
t.assert(Object.values(feature_flags_1.featureConfig).length > 0, "There should be at least one feature"); t.assert(Object.values(feature_flags_1.featureConfig).length > 0, "There should be at least one feature");
}); });
@@ -321,9 +353,14 @@ function setUpFeatureFlagTests(tmpDir, logger = (0, logging_1.getRunnerLogger)(t
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir); (0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
return new feature_flags_1.Features(gitHubVersion, testRepositoryNwo, tmpDir, logger); return new feature_flags_1.Features(gitHubVersion, testRepositoryNwo, tmpDir, logger);
} }
/**
* Returns an argument to pass to `getValue` that if required includes a CodeQL object meeting the
* minimum version or tool feature requirements specified by the feature.
*/
function includeCodeQlIfRequired(feature) { function includeCodeQlIfRequired(feature) {
return feature_flags_1.featureConfig[feature].minimumVersion !== undefined return feature_flags_1.featureConfig[feature].minimumVersion !== undefined ||
? (0, testing_utils_1.mockCodeQLVersion)("9.9.9") feature_flags_1.featureConfig[feature].toolsFeature !== undefined
? (0, testing_utils_1.mockCodeQLVersion)("9.9.9", Object.fromEntries(Object.values(tools_features_1.ToolsFeature).map((v) => [v, true])))
: undefined; : undefined;
} }
//# sourceMappingURL=feature-flags.test.js.map //# sourceMappingURL=feature-flags.test.js.map

File diff suppressed because one or more lines are too long

1
lib/fingerprints.js generated
View File

@@ -238,6 +238,7 @@ exports.resolveUriToFile = resolveUriToFile;
// Compute fingerprints for results in the given sarif file // Compute fingerprints for results in the given sarif file
// and return an updated sarif file contents. // and return an updated sarif file contents.
async function addFingerprints(sarif, sourceRoot, logger) { async function addFingerprints(sarif, sourceRoot, logger) {
logger.info("Adding fingerprints to SARIF file. For more information, see https://docs.github.com/en/enterprise-cloud@latest/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#providing-data-to-track-code-scanning-alerts-across-runs");
// Gather together results for the same file and construct // Gather together results for the same file and construct
// callbacks to accept hashes for that file and update the location // callbacks to accept hashes for that file and update the location
const callbacksByFile = {}; const callbacksByFile = {};

File diff suppressed because one or more lines are too long

View File

@@ -315,7 +315,7 @@ async function testFailedSarifUpload(t, actionsWorkflow, { category, databaseExi
.returns(JSON.stringify(matrix)); .returns(JSON.stringify(matrix));
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeql, "getCodeQL").resolves(codeqlObject); sinon.stub(codeql, "getCodeQL").resolves(codeqlObject);
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.0")); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.6"));
const databaseExportDiagnosticsStub = sinon.stub(codeqlObject, "databaseExportDiagnostics"); const databaseExportDiagnosticsStub = sinon.stub(codeqlObject, "databaseExportDiagnostics");
const diagnosticsExportStub = sinon.stub(codeqlObject, "diagnosticsExport"); const diagnosticsExportStub = sinon.stub(codeqlObject, "diagnosticsExport");
sinon.stub(workflow, "getWorkflow").resolves(actionsWorkflow); sinon.stub(workflow, "getWorkflow").resolves(actionsWorkflow);

View File

@@ -59,18 +59,23 @@ async function runWrapper() {
catch (unwrappedError) { catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError); const error = (0, util_1.wrapError)(unwrappedError);
core.setFailed(error.message); core.setFailed(error.message);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
return; return;
} }
const jobStatus = initActionPostHelper.getFinalJobStatus(); const jobStatus = initActionPostHelper.getFinalJobStatus();
logger.info(`CodeQL job status was ${(0, status_report_1.getJobStatusDisplayName)(jobStatus)}.`); logger.info(`CodeQL job status was ${(0, status_report_1.getJobStatusDisplayName)(jobStatus)}.`);
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger);
const statusReport = { if (statusReportBase !== undefined) {
...statusReportBase, const statusReport = {
...uploadFailedSarifResult, ...statusReportBase,
job_status: initActionPostHelper.getFinalJobStatus(), ...uploadFailedSarifResult,
}; job_status: initActionPostHelper.getFinalJobStatus(),
await (0, status_report_1.sendStatusReport)(statusReport); };
await (0, status_report_1.sendStatusReport)(statusReport);
}
} }
void runWrapper(); void runWrapper();
//# sourceMappingURL=init-action-post.js.map //# sourceMappingURL=init-action-post.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"init-action-post.js","sourceRoot":"","sources":["../src/init-action-post.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,iDAAuE;AACvE,6CAAgD;AAChD,iDAAmD;AACnD,kEAAoD;AACpD,mDAA2C;AAC3C,gFAAkE;AAClE,uCAA6C;AAC7C,6CAAkD;AAClD,mDAOyB;AACzB,iCAKgB;AAOhB,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,IAAA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SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,CACP,CAAC;IACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,YAAY,GAAyB;YACzC,GAAG,gBAAgB;YACnB,GAAG,uBAAuB;YAC1B,UAAU,EAAE,oBAAoB,CAAC,iBAAiB,EAAE;SACrD,CAAC;QACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

72
lib/init-action.js generated
View File

@@ -30,6 +30,7 @@ const safe_which_1 = require("@chrisgavin/safe-which");
const uuid_1 = require("uuid"); const uuid_1 = require("uuid");
const actions_util_1 = require("./actions-util"); const actions_util_1 = require("./actions-util");
const api_client_1 = require("./api-client"); const api_client_1 = require("./api-client");
const diagnostics_1 = require("./diagnostics");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
const init_1 = require("./init"); const init_1 = require("./init");
@@ -44,6 +45,9 @@ const util_1 = require("./util");
const workflow_1 = require("./workflow"); const workflow_1 = require("./workflow");
async function sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error) { async function sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error) {
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, error?.message, error?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, error?.message, error?.stack);
if (statusReportBase === undefined) {
return;
}
const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages"); const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages");
const initStatusReport = { const initStatusReport = {
...statusReportBase, ...statusReportBase,
@@ -122,7 +126,10 @@ async function run() {
core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)()); core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)());
core.exportVariable(environment_1.EnvVar.INIT_ACTION_HAS_RUN, "true"); core.exportVariable(environment_1.EnvVar.INIT_ACTION_HAS_RUN, "true");
try { try {
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type); const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid; toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, logger); const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, logger);
@@ -163,26 +170,14 @@ async function run() {
logger, logger,
}, codeql); }, codeql);
await (0, init_1.checkInstallPython311)(config.languages, codeql); await (0, init_1.checkInstallPython311)(config.languages, codeql);
if (config.languages.includes(languages_1.Language.python) &&
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
if (await (0, feature_flags_1.isPythonDependencyInstallationDisabled)(codeql, features)) {
logger.info("Skipping python dependency installation");
}
else {
try {
await (0, init_1.installPythonDeps)(codeql, logger);
}
catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError);
logger.warning(`${error.message} You can call this action with 'setup-python-dependencies: false' to disable this process`);
}
}
}
} }
catch (unwrappedError) { catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError); const error = (0, util_1.wrapError)(unwrappedError);
core.setFailed(error.message); core.setFailed(error.message);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, error instanceof util_1.ConfigurationError ? "user-error" : "aborted", startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, error instanceof util_1.ConfigurationError ? "user-error" : "aborted", startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
return; return;
} }
try { try {
@@ -229,6 +224,17 @@ async function run() {
} }
catch (e) { catch (e) {
logger.warning(`Failed to determine the location of the Go binary: ${e}`); logger.warning(`Failed to determine the location of the Go binary: ${e}`);
if (e instanceof actions_util_1.FileCmdNotFoundError) {
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/file-program-unavailable", "The `file` program is required on Linux, but does not appear to be installed", {
markdownMessage: "CodeQL was unable to find the `file` program on this system. Ensure that the `file` program is installed on Linux runners and accessible.",
visibility: {
statusPage: true,
telemetry: true,
cliSummaryTable: true,
},
severity: "warning",
}));
}
} }
} }
// Limit RAM and threads for extractors. When running extractors, the CodeQL CLI obeys the // Limit RAM and threads for extractors. When running extractors, the CodeQL CLI obeys the
@@ -276,22 +282,39 @@ async function run() {
core.exportVariable(envVar, "false"); core.exportVariable(envVar, "false");
} }
} }
// Disable Python dependency extraction if feature flag set // From 2.16.0 the default for the python extractor is to not perform any
if (await (0, feature_flags_1.isPythonDependencyInstallationDisabled)(codeql, features)) { // dependency extraction. For versions before that, you needed to set this flag to
// enable this behavior (supported since 2.13.1).
if (await (0, util_1.codeQlVersionAbove)(codeql, "2.17.1")) {
// disabled by default, no warning
}
else if (await (0, util_1.codeQlVersionAbove)(codeql, "2.16.0")) {
// disabled by default, prints warning if environment variable is not set
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_DISABLE_LIBRARY_EXTRACTION", "true");
}
else if (await (0, util_1.codeQlVersionAbove)(codeql, "2.13.1")) {
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_DISABLE_LIBRARY_EXTRACTION", "true"); core.exportVariable("CODEQL_EXTRACTOR_PYTHON_DISABLE_LIBRARY_EXTRACTION", "true");
} }
else { else {
// From 2.16.0 the default for the python extractor is to not perform any library logger.warning(`CodeQL Action versions 3.25.0 and later, and versions 2.25.0 and later no longer install Python dependencies. We recommend upgrading to at least CodeQL Bundle 2.16.0 to avoid any potential problems due to this (you are currently using ${(await codeql.getVersion()).version}). Alternatively, we recommend downgrading the CodeQL Action to version 3.24.10 (for customers using GitHub.com or GitHub Enterprise Server v3.12 or later) or 2.24.10 (for customers using GitHub Enterprise Server v3.11 or earlier).`);
// extraction, so we need to set this flag to enable it. }
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_FORCE_ENABLE_LIBRARY_EXTRACTION_UNTIL_2_17_0", "true"); if ((0, actions_util_1.getOptionalInput)("setup-python-dependencies") !== undefined) {
logger.warning("The setup-python-dependencies input is deprecated and no longer has any effect. We recommend removing any references from your workflows. See https://github.blog/changelog/2024-01-23-codeql-2-16-python-dependency-installation-disabled-new-queries-and-bug-fixes/ for more information.");
}
if (process.env["CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION"] !==
undefined) {
logger.warning("The CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION environment variable is deprecated and no longer has any effect. We recommend removing any references from your workflows. See https://github.blog/changelog/2024-01-23-codeql-2-16-python-dependency-installation-disabled-new-queries-and-bug-fixes/ for more information.");
} }
const sourceRoot = path.resolve((0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), (0, actions_util_1.getOptionalInput)("source-root") || ""); const sourceRoot = path.resolve((0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), (0, actions_util_1.getOptionalInput)("source-root") || "");
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", (0, actions_util_1.getOptionalInput)("registries"), apiDetails, logger); const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", (0, actions_util_1.getOptionalInput)("registries"), apiDetails, features, logger);
if (tracerConfig !== undefined) { if (tracerConfig !== undefined) {
for (const [key, value] of Object.entries(tracerConfig.env)) { for (const [key, value] of Object.entries(tracerConfig.env)) {
core.exportVariable(key, value); core.exportVariable(key, value);
} }
} }
// Write diagnostics to the database that we previously stored in memory because the database
// did not exist until now.
(0, diagnostics_1.flushDiagnostics)(config);
core.setOutput("codeql-path", config.codeQLCmd); core.setOutput("codeql-path", config.codeQLCmd);
} }
catch (unwrappedError) { catch (unwrappedError) {
@@ -300,6 +323,9 @@ async function run() {
await sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error); await sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error);
return; return;
} }
finally {
(0, diagnostics_1.logUnwrittenDiagnostics)();
}
await sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger); await sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger);
} }
function getTrapCachingEnabled() { function getTrapCachingEnabled() {

File diff suppressed because one or more lines are too long

48
lib/init.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.installPythonDeps = exports.checkInstallPython311 = exports.printPathFiltersWarning = exports.runInit = exports.initConfig = exports.initCodeQL = void 0; exports.checkInstallPython311 = exports.printPathFiltersWarning = exports.runInit = exports.initConfig = exports.initCodeQL = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner")); const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
@@ -52,7 +52,7 @@ async function initConfig(inputs, codeql) {
return config; return config;
} }
exports.initConfig = initConfig; exports.initConfig = initConfig;
async function runInit(codeql, config, sourceRoot, processName, registriesInput, apiDetails, logger) { async function runInit(codeql, config, sourceRoot, processName, registriesInput, apiDetails, features, logger) {
fs.mkdirSync(config.dbLocation, { recursive: true }); fs.mkdirSync(config.dbLocation, { recursive: true });
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, config.tempDir, logger); const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, config.tempDir, logger);
await configUtils.wrapEnvironment({ await configUtils.wrapEnvironment({
@@ -60,8 +60,8 @@ async function runInit(codeql, config, sourceRoot, processName, registriesInput,
CODEQL_REGISTRIES_AUTH: registriesAuthTokens, CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
}, },
// Init a database cluster // Init a database cluster
async () => await codeql.databaseInitCluster(config, sourceRoot, processName, qlconfigFile, logger)); async () => await codeql.databaseInitCluster(config, sourceRoot, processName, qlconfigFile, features, logger));
return await (0, tracer_config_1.getCombinedTracerConfig)(codeql, config); return await (0, tracer_config_1.getCombinedTracerConfig)(codeql, config, features);
} }
exports.runInit = runInit; exports.runInit = runInit;
function printPathFiltersWarning(config, logger) { function printPathFiltersWarning(config, logger) {
@@ -89,44 +89,4 @@ async function checkInstallPython311(languages, codeql) {
} }
} }
exports.checkInstallPython311 = checkInstallPython311; exports.checkInstallPython311 = checkInstallPython311;
async function installPythonDeps(codeql, logger) {
logger.startGroup("Setup Python dependencies");
const scriptsFolder = path.resolve(__dirname, "../python-setup");
try {
if (process.platform === "win32") {
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
path.join(scriptsFolder, "install_tools.ps1"),
]).exec();
}
else {
await new toolrunner.ToolRunner(path.join(scriptsFolder, "install_tools.sh")).exec();
}
const script = "auto_install_packages.py";
if (process.platform === "win32") {
await new toolrunner.ToolRunner(await safeWhich.safeWhich("py"), [
"-3",
"-B",
path.join(scriptsFolder, script),
path.dirname(codeql.getPath()),
]).exec();
}
else {
await new toolrunner.ToolRunner(await safeWhich.safeWhich("python3"), [
"-B",
path.join(scriptsFolder, script),
path.dirname(codeql.getPath()),
]).exec();
}
}
catch (e) {
logger.endGroup();
logger.warning(`An error occurred while trying to automatically install Python dependencies: ${e}\n` +
"Please make sure any necessary dependencies are installed before calling the codeql-action/analyze " +
"step, and add a 'setup-python-dependencies: false' argument to this step to disable our automatic " +
"dependency installation and avoid this warning.");
return;
}
logger.endGroup();
}
exports.installPythonDeps = installPythonDeps;
//# sourceMappingURL=init.js.map //# sourceMappingURL=init.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAGpD,qCAA+C;AAC/C,4DAA8C;AAE9C,2CAA0D;AAG1D,qDAAgD;AAChD,mDAAwE;AAGjE,KAAK,UAAU,UAAU,CAC9B,UAA8B,EAC9B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAA2C,EAC3C,MAAc;IAOd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,WAAW,EAAE,YAA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ACpG,CAAC;IACJ,CAAC;AACH,CAAC;AAfD,0DAeC;AAED;;;GAGG;AACI,KAAK,UAAU,qBAAqB,CACzC,SAAqB,EACrB,MAAc;IAEd,IACE,SAAS,CAAC,QAAQ,CAAC,oBAAQ,CAAC,MAAM,CAAC;QACnC,OAAO,CAAC,QAAQ,KAAK,OAAO;QAC5B,CAAC,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,EAAE,iBAAiB,EACxD,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CACzB,SAAS,EACT,iBAAiB,EACjB,oBAAoB,CACrB,CAAC;QACF,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE;YACvE,MAAM;SACP,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAlBD,sDAkBC"}

View File

@@ -38,7 +38,10 @@ async function run() {
const logger = (0, logging_1.getActionsLogger)(); const logger = (0, logging_1.getActionsLogger)();
let config; let config;
try { try {
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger); (0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
(0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion); (0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion);
@@ -61,11 +64,17 @@ async function run() {
else { else {
// For any other error types, something has more seriously gone wrong and we fail. // For any other error types, something has more seriously gone wrong and we fail.
core.setFailed(`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`); core.setFailed(`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
} }
return; return;
} }
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
} }
async function runWrapper() { async function runWrapper() {
try { try {

View File

@@ -1 +1 @@
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAKwB;AACxB,6CAAgD;AAChD,6CAAsD;AACtD,iDAAmD;AACnD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAKyB;AACzB,iCAMgB;AAEhB,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,IAAI,MAA0B,CAAC;IAE/B,IA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KAAK,CAAC,OAAO,EAAE,CACxG,CAAC;YAEF,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,0BAAU,CAAC,kBAAkB,EAC7B,IAAA,gCAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,EACN,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CACF,CAAC;QACJ,CAAC;QAED,OAAO;IACT,CAAC;IAED,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,0BAAU,CAAC,kBAAkB,EAC7B,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,CACP,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,GAAG,0BAAU,CAAC,kBAAkB,mBAC9B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OACnB,EAAE,CACH,CAAC;IACJ,CAAC;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} {"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAKwB;AACxB,6CAAgD;AAChD,6CAAsD;AACtD,iDAAmD;AACnD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAKyB;AACzB,iCAMgB;AAEhB,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;I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