mirror of
https://github.com/github/codeql-action.git
synced 2025-12-07 00:08:06 +08:00
Compare commits
390 Commits
codeql-bun
...
nickfyson/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9cc61e9d0 | ||
|
|
7e187e1c52 | ||
|
|
26036736ba | ||
|
|
8478e2a840 | ||
|
|
09783967a0 | ||
|
|
144b7d5b16 | ||
|
|
cda785ef94 | ||
|
|
8e086df084 | ||
|
|
0724061f76 | ||
|
|
fda1796670 | ||
|
|
ee53012610 | ||
|
|
e0c2b0a8a0 | ||
|
|
8e4a6c7a90 | ||
|
|
511f073971 | ||
|
|
ebf5a83713 | ||
|
|
7813bda958 | ||
|
|
2b2fb6b1dc | ||
|
|
b374143c11 | ||
|
|
95591babe8 | ||
|
|
e2b5cc75ce | ||
|
|
64e61baeac | ||
|
|
c757f9f6de | ||
|
|
7898bc2041 | ||
|
|
6b5b958063 | ||
|
|
ea1e72c669 | ||
|
|
b974542e9f | ||
|
|
0d8f348775 | ||
|
|
dcf89a7576 | ||
|
|
b995212303 | ||
|
|
3c1878d8f9 | ||
|
|
1bca5bfcf5 | ||
|
|
691226ecb5 | ||
|
|
305f654631 | ||
|
|
31e94d8cb1 | ||
|
|
1de8705f6b | ||
|
|
fe23b5a3e1 | ||
|
|
0bc194ee69 | ||
|
|
95be4b277c | ||
|
|
bf51594343 | ||
|
|
303dec0fbd | ||
|
|
3a9f6a89e0 | ||
|
|
cc4fead714 | ||
|
|
183559cea8 | ||
|
|
5b52b36d41 | ||
|
|
5b19bef41e | ||
|
|
f2d0c2e7ae | ||
|
|
d651fbc494 | ||
|
|
382a50a028 | ||
|
|
458b4226ad | ||
|
|
5e0f9dbc48 | ||
|
|
c0d1daa7f7 | ||
|
|
c6e24c94be | ||
|
|
e1d1fad1b8 | ||
|
|
0e9a210226 | ||
|
|
47e90f23ea | ||
|
|
ee748cf360 | ||
|
|
57932be6d4 | ||
|
|
a6ea3c5a45 | ||
|
|
3537bea580 | ||
|
|
3675be0110 | ||
|
|
784783de17 | ||
|
|
b6dc4ba94b | ||
|
|
1c3b8c867b | ||
|
|
65a2bb528e | ||
|
|
2dbffae187 | ||
|
|
bc50092bdb | ||
|
|
b7f289ef4d | ||
|
|
a16ac98583 | ||
|
|
cc940d75b2 | ||
|
|
b929cca357 | ||
|
|
1d367b0bec | ||
|
|
db40ac46b9 | ||
|
|
77605c75e4 | ||
|
|
773bd9bef6 | ||
|
|
4712487dc3 | ||
|
|
2da9ad5070 | ||
|
|
3b5bd49a74 | ||
|
|
8a1e474ed1 | ||
|
|
407ffafae6 | ||
|
|
4af462f4ba | ||
|
|
192ad9bd5f | ||
|
|
77c1abbd83 | ||
|
|
9f150ba795 | ||
|
|
e75de4cd73 | ||
|
|
80150c2141 | ||
|
|
4d999a4f27 | ||
|
|
83267d5070 | ||
|
|
4b6aa0b07d | ||
|
|
4618cbd952 | ||
|
|
bab3adbf38 | ||
|
|
66b90a5db1 | ||
|
|
bc9ddc2841 | ||
|
|
10f05151c5 | ||
|
|
4e80a80354 | ||
|
|
df9b50ee5f | ||
|
|
0d0a53cb13 | ||
|
|
df6aced528 | ||
|
|
0cd63ca7a5 | ||
|
|
b9e85da0b5 | ||
|
|
779838b849 | ||
|
|
ab6dd28b80 | ||
|
|
9326971847 | ||
|
|
9968bdfba4 | ||
|
|
689fdc5193 | ||
|
|
33bfd1de92 | ||
|
|
8c8c7b4d80 | ||
|
|
64981bbb5a | ||
|
|
e280207df7 | ||
|
|
e46740a99e | ||
|
|
6abf8569a1 | ||
|
|
59252d9bfb | ||
|
|
dcf348a0d3 | ||
|
|
04451e072f | ||
|
|
82284f1b28 | ||
|
|
ed686ed4b3 | ||
|
|
137a1e070d | ||
|
|
6dd4605060 | ||
|
|
91733ada76 | ||
|
|
7c60ff7ad6 | ||
|
|
9ef69a2c7a | ||
|
|
bd4005aa6a | ||
|
|
da4c46015a | ||
|
|
45a6ff4660 | ||
|
|
793adb79ac | ||
|
|
c73d8a69e1 | ||
|
|
df32e39913 | ||
|
|
88d03c647b | ||
|
|
a3795eb30d | ||
|
|
3d77e8a7ee | ||
|
|
58157f1d4c | ||
|
|
74483a38d3 | ||
|
|
2ba6829f2b | ||
|
|
2d5ffa7773 | ||
|
|
14d0fa93b4 | ||
|
|
5744b13b66 | ||
|
|
f3b55862ea | ||
|
|
95c219819d | ||
|
|
e8e83c3a56 | ||
|
|
c7abe9ca5f | ||
|
|
3fc281e079 | ||
|
|
4888104fe9 | ||
|
|
06d8f4f7f8 | ||
|
|
06662f546c | ||
|
|
25a3829e6e | ||
|
|
dad0ebd6ca | ||
|
|
7f7aa09c9a | ||
|
|
5e3a6935e7 | ||
|
|
d2b37ba145 | ||
|
|
c8e99083da | ||
|
|
2cbabeaa72 | ||
|
|
edb8265ab8 | ||
|
|
dbe5586d6e | ||
|
|
f1b64d85e4 | ||
|
|
e3f5f833da | ||
|
|
838be48ce0 | ||
|
|
8779d91384 | ||
|
|
959337a156 | ||
|
|
9734ecd5b5 | ||
|
|
9c3b394d7f | ||
|
|
79817eb679 | ||
|
|
54e4af648d | ||
|
|
d53a59d051 | ||
|
|
a291b7c6a3 | ||
|
|
64f799d15e | ||
|
|
1e9b364483 | ||
|
|
49abf0ba24 | ||
|
|
907abca61b | ||
|
|
63470275e7 | ||
|
|
b98a636a6b | ||
|
|
4a368f64ad | ||
|
|
77bbb99abd | ||
|
|
a75a0d5716 | ||
|
|
aa55b87f87 | ||
|
|
b6b0833c3d | ||
|
|
0132448784 | ||
|
|
070e92e8fd | ||
|
|
bad341350a | ||
|
|
1d83e52e9a | ||
|
|
d859d17bdb | ||
|
|
7e7f0cc085 | ||
|
|
1d83a6387b | ||
|
|
8e460e9e00 | ||
|
|
0116bc2df5 | ||
|
|
f5a984b113 | ||
|
|
325a0b06e9 | ||
|
|
632d58cb60 | ||
|
|
82ba90b1d9 | ||
|
|
34f97d7a16 | ||
|
|
74442e0a95 | ||
|
|
bd32fab74f | ||
|
|
b584cf8321 | ||
|
|
761255a4a3 | ||
|
|
346d5c4b07 | ||
|
|
5950d13564 | ||
|
|
c1a0ad9a04 | ||
|
|
76a9f5c431 | ||
|
|
d90b8d79de | ||
|
|
175f696a4d | ||
|
|
8a2cbabd43 | ||
|
|
a5cf70c3f1 | ||
|
|
a67b110795 | ||
|
|
0eb279015c | ||
|
|
275f994944 | ||
|
|
d5d445b7af | ||
|
|
2a7218bdef | ||
|
|
78bfd29301 | ||
|
|
dfb913f660 | ||
|
|
e62d946796 | ||
|
|
026e833827 | ||
|
|
5d6442e87d | ||
|
|
4ab92370dd | ||
|
|
83d1db3366 | ||
|
|
2125352e3e | ||
|
|
d52a751f8f | ||
|
|
947b43a6b6 | ||
|
|
788783aba5 | ||
|
|
fdcae64e14 | ||
|
|
8554648f41 | ||
|
|
18e6c398ce | ||
|
|
5e34d08d9e | ||
|
|
faf91ca6bd | ||
|
|
8193a92e41 | ||
|
|
ffaea6c837 | ||
|
|
0a0988c4b2 | ||
|
|
0d5c2e0228 | ||
|
|
94b6970619 | ||
|
|
669c61022c | ||
|
|
028bacb8e9 | ||
|
|
d0916526cd | ||
|
|
102a12bba4 | ||
|
|
8295705640 | ||
|
|
4eccc6dac4 | ||
|
|
aed2e7f47f | ||
|
|
a2dc5ffaff | ||
|
|
b6ea09e3e4 | ||
|
|
fd3d78671c | ||
|
|
2cb752a87e | ||
|
|
e50f53baa1 | ||
|
|
0a65c007f6 | ||
|
|
3f7850a179 | ||
|
|
27235304e0 | ||
|
|
8f0e8b0890 | ||
|
|
f243294ab7 | ||
|
|
075eb6aaea | ||
|
|
1ea6a10947 | ||
|
|
e26ed57a22 | ||
|
|
0ac7669167 | ||
|
|
235bdca565 | ||
|
|
94f3e9b563 | ||
|
|
3b2fee487e | ||
|
|
a144bf5d7f | ||
|
|
4154eb799b | ||
|
|
7f4a9481a7 | ||
|
|
faf7528b44 | ||
|
|
2b193c5ab5 | ||
|
|
eb71a60380 | ||
|
|
36777d2236 | ||
|
|
1727de39fe | ||
|
|
c8dd2bc90f | ||
|
|
db9f2c5968 | ||
|
|
738030674f | ||
|
|
68d0b65ee5 | ||
|
|
517782a2a0 | ||
|
|
bb70bab648 | ||
|
|
41a13ec084 | ||
|
|
9a5a628613 | ||
|
|
8ac187720c | ||
|
|
f6d9b6bcfa | ||
|
|
7b0b42afec | ||
|
|
abb71f14cf | ||
|
|
604448043e | ||
|
|
4cee553ea6 | ||
|
|
df098abd11 | ||
|
|
4611ff9b23 | ||
|
|
2bd75f528c | ||
|
|
3c15d2383b | ||
|
|
c08086a26a | ||
|
|
d718153f0a | ||
|
|
3fb6719bea | ||
|
|
bcbb900532 | ||
|
|
49b94f1a2d | ||
|
|
bb67eddd77 | ||
|
|
e827ad5b71 | ||
|
|
a402be8739 | ||
|
|
74b46628c3 | ||
|
|
3dd4ad872b | ||
|
|
b686e07c2b | ||
|
|
7de46310d9 | ||
|
|
896a68d162 | ||
|
|
5f88bb1ffa | ||
|
|
90f8ed12cc | ||
|
|
ed2a90b161 | ||
|
|
7b16c0dad0 | ||
|
|
37a2d1fe3c | ||
|
|
5dac60ecef | ||
|
|
ebbadee09e | ||
|
|
a370ce344f | ||
|
|
66572c69b0 | ||
|
|
e0103eab17 | ||
|
|
e7a6fa9589 | ||
|
|
f59bf3c458 | ||
|
|
6e3f5b0184 | ||
|
|
1d70a98580 | ||
|
|
e4ef094279 | ||
|
|
2cc1651ead | ||
|
|
a6484fa0f6 | ||
|
|
9ef3267030 | ||
|
|
219066c343 | ||
|
|
a9a0f3b4c0 | ||
|
|
467bfa1cff | ||
|
|
1d5eed8d40 | ||
|
|
96fa24c6ba | ||
|
|
f1752b0b55 | ||
|
|
7efe1c9625 | ||
|
|
0dd2eafff0 | ||
|
|
ddccb87388 | ||
|
|
d8cb5a2a0f | ||
|
|
378bbcd274 | ||
|
|
27cb1e1de5 | ||
|
|
4818fdd8ec | ||
|
|
e548601be3 | ||
|
|
cc6542087a | ||
|
|
c95737bb43 | ||
|
|
41d2ffad87 | ||
|
|
650a85ef6d | ||
|
|
0de36d4594 | ||
|
|
0dfaf4ef65 | ||
|
|
d1a917f445 | ||
|
|
431174f620 | ||
|
|
3078f51bf0 | ||
|
|
d0c18ba23e | ||
|
|
724d64319a | ||
|
|
49aaa9a420 | ||
|
|
c21e1dd0da | ||
|
|
53bed11e0b | ||
|
|
ab8159054c | ||
|
|
765807bee7 | ||
|
|
bf2187592f | ||
|
|
c4c06786f2 | ||
|
|
59aaff8718 | ||
|
|
5897cf73c4 | ||
|
|
d467036438 | ||
|
|
8e0b1c74b1 | ||
|
|
01b8760f90 | ||
|
|
74e25cdac8 | ||
|
|
eac8f8cd93 | ||
|
|
6a28655e3d | ||
|
|
2ca983a793 | ||
|
|
dd1128f4f1 | ||
|
|
f3a128e0fe | ||
|
|
6846be007d | ||
|
|
0e74cd1660 | ||
|
|
379f89dc53 | ||
|
|
253d9cf358 | ||
|
|
4254f3a4c1 | ||
|
|
9bfb9ba527 | ||
|
|
d4c26876d3 | ||
|
|
d6f9faae0d | ||
|
|
c459726691 | ||
|
|
a087b01cdd | ||
|
|
f3051ed54e | ||
|
|
860e98cc4a | ||
|
|
3ffd6c071a | ||
|
|
2d646a3990 | ||
|
|
a9313c9016 | ||
|
|
5f18c9ab80 | ||
|
|
2c22b37a68 | ||
|
|
c07fd68e12 | ||
|
|
c33f0b4fc7 | ||
|
|
04daf014b5 | ||
|
|
bb3bc25861 | ||
|
|
ac4145f467 | ||
|
|
87a64c9c4c | ||
|
|
897ddf2662 | ||
|
|
74714a34ca | ||
|
|
e982de4fb4 | ||
|
|
19c02a4d16 | ||
|
|
71c7e82837 | ||
|
|
8b733e71a6 | ||
|
|
c6c77c8c2d | ||
|
|
8efd40b126 | ||
|
|
77a54b68d4 | ||
|
|
f664957aa4 | ||
|
|
70c4c0fc21 | ||
|
|
701f152f28 | ||
|
|
1b6299040a | ||
|
|
5462f69153 | ||
|
|
6a6a824702 | ||
|
|
88c7a5c4cc | ||
|
|
da65035498 |
2
.github/actions/check-sarif/action.yml
vendored
2
.github/actions/check-sarif/action.yml
vendored
@@ -16,5 +16,5 @@ inputs:
|
||||
Comma separated list of query ids that should NOT be included in this SARIF file.
|
||||
|
||||
runs:
|
||||
using: node16
|
||||
using: node20
|
||||
main: index.js
|
||||
|
||||
25
.github/actions/release-branches/action.yml
vendored
Normal file
25
.github/actions/release-branches/action.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: 'Release branches'
|
||||
description: 'Determine branches for release & backport'
|
||||
inputs:
|
||||
major_version:
|
||||
description: 'The version as extracted from the package.json file'
|
||||
required: true
|
||||
latest_tag:
|
||||
description: 'The most recent tag published to the repository'
|
||||
required: true
|
||||
outputs:
|
||||
backport_source_branch:
|
||||
description: "The release branch for the given tag"
|
||||
value: ${{ steps.branches.outputs.backport_source_branch }}
|
||||
backport_target_branches:
|
||||
description: "JSON encoded list of branches to target with backports"
|
||||
value: ${{ steps.branches.outputs.backport_target_branches }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- id: branches
|
||||
run: |
|
||||
python ${{ github.action_path }}/release-branches.py \
|
||||
--major-version ${{ inputs.major_version }} \
|
||||
--latest-tag ${{ inputs.latest_tag }}
|
||||
shell: bash
|
||||
48
.github/actions/release-branches/release-branches.py
vendored
Normal file
48
.github/actions/release-branches/release-branches.py
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
# Name of the remote
|
||||
ORIGIN = 'origin'
|
||||
|
||||
OLDEST_SUPPORTED_MAJOR_VERSION = 2
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--major-version", required=True, type=str, help="The major version of the release")
|
||||
parser.add_argument("--latest-tag", required=True, type=str, help="The most recent tag published to the repository")
|
||||
args = parser.parse_args()
|
||||
|
||||
major_version = args.major_version
|
||||
latest_tag = args.latest_tag
|
||||
|
||||
print("major_version: " + major_version)
|
||||
print("latest_tag: " + latest_tag)
|
||||
|
||||
# If this is a primary release, we backport to all supported branches,
|
||||
# so we check whether the major_version taken from the package.json
|
||||
# is greater than or equal to the latest tag pulled from the repo.
|
||||
# For example...
|
||||
# 'v1' >= 'v2' is False # we're operating from an older release branch and should not backport
|
||||
# 'v2' >= 'v2' is True # the normal case where we're updating the current version
|
||||
# 'v3' >= 'v2' is True # in this case we are making the first release of a new major version
|
||||
consider_backports = ( major_version >= latest_tag.split(".")[0] )
|
||||
|
||||
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
||||
|
||||
f.write(f"backport_source_branch=releases/{major_version}\n")
|
||||
|
||||
backport_target_branches = []
|
||||
|
||||
if consider_backports:
|
||||
for i in range(int(major_version.strip("v"))-1, 0, -1):
|
||||
branch_name = f"releases/v{i}"
|
||||
if i >= OLDEST_SUPPORTED_MAJOR_VERSION:
|
||||
backport_target_branches.append(branch_name)
|
||||
|
||||
f.write("backport_target_branches="+json.dumps(backport_target_branches)+"\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
33
.github/actions/release-initialise/action.yml
vendored
Normal file
33
.github/actions/release-initialise/action.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: 'Prepare release job'
|
||||
description: 'Prepare for updating a release branch'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
||||
- name: Dump environment
|
||||
run: env
|
||||
shell: bash
|
||||
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
shell: bash
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install PyGithub==1.55 requests
|
||||
shell: bash
|
||||
|
||||
- name: Update git config
|
||||
run: |
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
shell: bash
|
||||
10
.github/actions/setup-swift/action.yml
vendored
10
.github/actions/setup-swift/action.yml
vendored
@@ -24,14 +24,16 @@ runs:
|
||||
VERSION="5.7.0"
|
||||
elif [ $VERSION = "5.8" ]; then
|
||||
VERSION="5.8.0"
|
||||
# setup-swift does not yet support v5.8.1 Remove this when it does.
|
||||
elif [ $VERSION = "5.8.1" ]; then
|
||||
VERSION="5.8.0"
|
||||
elif [ $VERSION = "5.9" ]; then
|
||||
VERSION="5.9.0"
|
||||
# setup-swift does not yet support v5.9.1 Remove this when it does.
|
||||
elif [ $VERSION = "5.9.1" ]; then
|
||||
VERSION="5.9.0"
|
||||
fi
|
||||
fi
|
||||
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
||||
|
||||
- uses: swift-actions/setup-swift@cdcbe8e35d3801acd82d7109285e6ab22c9212c2 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
||||
- uses: swift-actions/setup-swift@f51889efb55dccf13be0ee727e3d6c89a096fb4c # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
||||
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
|
||||
with:
|
||||
swift-version: "${{ steps.get_swift_version.outputs.version }}"
|
||||
|
||||
225
.github/update-release-branch.py
vendored
225
.github/update-release-branch.py
vendored
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import datetime
|
||||
import re
|
||||
from github import Github
|
||||
import json
|
||||
import os
|
||||
@@ -13,8 +14,9 @@ No user facing changes.
|
||||
|
||||
"""
|
||||
|
||||
SOURCE_BRANCH = 'main'
|
||||
TARGET_BRANCH = 'releases/v2'
|
||||
# NB: This exact commit message is used to find commits for reverting during backports.
|
||||
# Changing it requires a transition period where both old and new versions are supported.
|
||||
BACKPORT_COMMIT_MESSAGE = 'Update version and changelog for v'
|
||||
|
||||
# Name of the remote
|
||||
ORIGIN = 'origin'
|
||||
@@ -34,7 +36,9 @@ def branch_exists_on_remote(branch_name):
|
||||
return run_git('ls-remote', '--heads', ORIGIN, branch_name).strip() != ''
|
||||
|
||||
# Opens a PR from the given branch to the target branch
|
||||
def open_pr(repo, all_commits, source_branch_short_sha, new_branch_name, conductor):
|
||||
def open_pr(
|
||||
repo, all_commits, source_branch_short_sha, new_branch_name, source_branch, target_branch,
|
||||
conductor, is_primary_release, conflicted_files):
|
||||
# Sort the commits into the pull requests that introduced them,
|
||||
# and any commits that don't have a pull request
|
||||
pull_requests = []
|
||||
@@ -56,7 +60,7 @@ def open_pr(repo, all_commits, source_branch_short_sha, new_branch_name, conduct
|
||||
|
||||
# Start constructing the body text
|
||||
body = []
|
||||
body.append(f'Merging {source_branch_short_sha} into {TARGET_BRANCH}.')
|
||||
body.append(f'Merging {source_branch_short_sha} into {target_branch}.')
|
||||
|
||||
body.append('')
|
||||
body.append(f'Conductor for this PR is @{conductor}.')
|
||||
@@ -79,20 +83,38 @@ def open_pr(repo, all_commits, source_branch_short_sha, new_branch_name, conduct
|
||||
|
||||
body.append('')
|
||||
body.append('Please do the following:')
|
||||
if len(conflicted_files) > 0:
|
||||
body.append(' - [ ] Ensure `package.json` file contains the correct version.')
|
||||
body.append(' - [ ] Add commits to this branch to resolve the merge conflicts ' +
|
||||
'in the following files:')
|
||||
body.extend([f' - [ ] `{file}`' for file in conflicted_files])
|
||||
body.append(' - [ ] Ensure another maintainer has reviewed the additional commits you added to this ' +
|
||||
'branch to resolve the merge conflicts.')
|
||||
body.append(' - [ ] Ensure the CHANGELOG displays the correct version and date.')
|
||||
body.append(' - [ ] Ensure the CHANGELOG includes all relevant, user-facing changes since the last release.')
|
||||
body.append(f' - [ ] Check that there are not any unexpected commits being merged into the {TARGET_BRANCH} branch.')
|
||||
body.append(f' - [ ] Check that there are not any unexpected commits being merged into the {target_branch} branch.')
|
||||
body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.')
|
||||
body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.')
|
||||
body.append(' - [ ] Merge the mergeback PR that will automatically be created once this PR is merged.')
|
||||
|
||||
title = f'Merge {SOURCE_BRANCH} into {TARGET_BRANCH}'
|
||||
if not is_primary_release:
|
||||
body.append(' - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.')
|
||||
body.append(' - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.')
|
||||
|
||||
body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.')
|
||||
body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.')
|
||||
|
||||
if is_primary_release:
|
||||
body.append(' - [ ] Merge the mergeback PR that will automatically be created once this PR is merged.')
|
||||
body.append(' - [ ] Merge all backport PRs to older release branches, that will automatically be created once this PR is merged.')
|
||||
|
||||
title = f'Merge {source_branch} into {target_branch}'
|
||||
labels = ['Update dependencies'] if not is_primary_release else []
|
||||
|
||||
# Create the pull request
|
||||
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that
|
||||
# a maintainer can take the PR out of draft, thereby triggering the PR checks.
|
||||
pr = repo.create_pull(title=title, body='\n'.join(body), head=new_branch_name, base=TARGET_BRANCH, draft=True)
|
||||
print(f'Created PR #{pr.number}')
|
||||
pr = repo.create_pull(title=title, body='\n'.join(body), head=new_branch_name, base=target_branch, draft=True)
|
||||
pr.add_to_labels(*labels)
|
||||
print(f'Created PR #{str(pr.number)}')
|
||||
|
||||
# Assign the conductor
|
||||
pr.add_to_assignees(conductor)
|
||||
@@ -102,10 +124,10 @@ def open_pr(repo, all_commits, source_branch_short_sha, new_branch_name, conduct
|
||||
# since the last release to the target branch.
|
||||
# This will not include any commits that exist on the target branch
|
||||
# that aren't on the source branch.
|
||||
def get_commit_difference(repo):
|
||||
def get_commit_difference(repo, source_branch, target_branch):
|
||||
# Passing split nothing means that the empty string splits to nothing: compare `''.split() == []`
|
||||
# to `''.split('\n') == ['']`.
|
||||
commits = run_git('log', '--pretty=format:%H', f'{ORIGIN}/{TARGET_BRANCH}..{ORIGIN}/{SOURCE_BRANCH}').strip().split()
|
||||
commits = run_git('log', '--pretty=format:%H', f'{ORIGIN}/{target_branch}..{ORIGIN}/{source_branch}').strip().split()
|
||||
|
||||
# Convert to full-fledged commit objects
|
||||
commits = [repo.get_commit(c) for c in commits]
|
||||
@@ -153,6 +175,60 @@ def get_today_string():
|
||||
today = datetime.datetime.today()
|
||||
return '{:%d %b %Y}'.format(today)
|
||||
|
||||
def process_changelog_for_backports(source_branch_major_version, target_branch_major_version):
|
||||
|
||||
# changelog entries can use the following format to indicate
|
||||
# that they only apply to newer versions
|
||||
some_versions_only_regex = re.compile(r'\[v(\d+)\+ only\]')
|
||||
|
||||
output = ''
|
||||
|
||||
with open('CHANGELOG.md', 'r') as f:
|
||||
|
||||
# until we find the first section, just duplicate all lines
|
||||
while True:
|
||||
line = f.readline()
|
||||
if not line:
|
||||
raise Exception('Could not find any change sections in CHANGELOG.md') # EOF
|
||||
|
||||
output += line
|
||||
if line.startswith('## '):
|
||||
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
|
||||
# we have found the first section, so now handle things differently
|
||||
break
|
||||
|
||||
# found_content tracks whether we hit two headings in a row
|
||||
found_content = False
|
||||
output += '\n'
|
||||
while True:
|
||||
line = f.readline()
|
||||
if not line:
|
||||
break # EOF
|
||||
line = line.rstrip('\n')
|
||||
|
||||
# filter out changenote entries that apply only to newer versions
|
||||
match = some_versions_only_regex.search(line)
|
||||
if match:
|
||||
if int(target_branch_major_version) < int(match.group(1)):
|
||||
continue
|
||||
|
||||
if line.startswith('## '):
|
||||
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
|
||||
if found_content == False:
|
||||
# we have found two headings in a row, so we need to add the placeholder message.
|
||||
output += 'No user facing changes.\n'
|
||||
found_content = False
|
||||
output += f'\n{line}\n\n'
|
||||
else:
|
||||
if line.strip() != '':
|
||||
found_content = True
|
||||
# we use the original line here, rather than the stripped version
|
||||
# so that we preserve indentation
|
||||
output += line + '\n'
|
||||
|
||||
with open('CHANGELOG.md', 'w') as f:
|
||||
f.write(output)
|
||||
|
||||
def update_changelog(version):
|
||||
if (os.path.exists('CHANGELOG.md')):
|
||||
content = ''
|
||||
@@ -182,6 +258,24 @@ def main():
|
||||
required=True,
|
||||
help='The nwo of the repository, for example github/codeql-action.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--source-branch',
|
||||
type=str,
|
||||
required=True,
|
||||
help='Source branch for release branch update.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--target-branch',
|
||||
type=str,
|
||||
required=True,
|
||||
help='Target branch for release branch update.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--is-primary-release',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Whether this update is the primary release for the current major version.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--conductor',
|
||||
type=str,
|
||||
@@ -191,24 +285,38 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
source_branch = args.source_branch
|
||||
target_branch = args.target_branch
|
||||
is_primary_release = args.is_primary_release
|
||||
|
||||
repo = Github(args.github_token).get_repo(args.repository_nwo)
|
||||
version = get_current_version()
|
||||
|
||||
# the target branch will be of the form releases/vN, where N is the major version number
|
||||
target_branch_major_version = target_branch.strip('releases/v')
|
||||
|
||||
# split version into major, minor, patch
|
||||
_, v_minor, v_patch = get_current_version().split('.')
|
||||
|
||||
version = f"{target_branch_major_version}.{v_minor}.{v_patch}"
|
||||
|
||||
# Print what we intend to go
|
||||
print(f'Considering difference between {SOURCE_BRANCH} and {TARGET_BRANCH}...')
|
||||
source_branch_short_sha = run_git('rev-parse', '--short', f'{ORIGIN}/{SOURCE_BRANCH}').strip()
|
||||
print(f'Current head of {SOURCE_BRANCH} is {source_branch_short_sha}.')
|
||||
print(f'Considering difference between {source_branch} and {target_branch}...')
|
||||
source_branch_short_sha = run_git('rev-parse', '--short', f'{ORIGIN}/{source_branch}').strip()
|
||||
print(f'Current head of {source_branch} is {source_branch_short_sha}.')
|
||||
|
||||
# See if there are any commits to merge in
|
||||
commits = get_commit_difference(repo=repo)
|
||||
commits = get_commit_difference(repo=repo, source_branch=source_branch, target_branch=target_branch)
|
||||
if len(commits) == 0:
|
||||
print(f'No commits to merge from {SOURCE_BRANCH} to {TARGET_BRANCH}.')
|
||||
print(f'No commits to merge from {source_branch} to {target_branch}.')
|
||||
return
|
||||
|
||||
# define distinct prefix in order to support specific pr checks on backports
|
||||
branch_prefix = 'update' if is_primary_release else 'backport'
|
||||
|
||||
# The branch name is based off of the name of branch being merged into
|
||||
# and the SHA of the branch being merged from. Thus if the branch already
|
||||
# exists we can assume we don't need to recreate it.
|
||||
new_branch_name = f'update-v{version}-{source_branch_short_sha}'
|
||||
new_branch_name = f'{branch_prefix}-v{version}-{source_branch_short_sha}'
|
||||
print(f'Branch name is {new_branch_name}.')
|
||||
|
||||
# Check if the branch already exists. If so we can abort as this script
|
||||
@@ -220,17 +328,74 @@ def main():
|
||||
# Create the new branch and push it to the remote
|
||||
print(f'Creating branch {new_branch_name}.')
|
||||
|
||||
# If we're performing a standard release, there won't be any new commits on the target branch,
|
||||
# as these will have already been merged back into the source branch. Therefore we can just
|
||||
# start from the source branch.
|
||||
run_git('checkout', '-b', new_branch_name, f'{ORIGIN}/{SOURCE_BRANCH}')
|
||||
# The process of creating the v{Older} release can run into merge conflicts. We commit the unresolved
|
||||
# conflicts so a maintainer can easily resolve them (vs erroring and requiring maintainers to
|
||||
# reconstruct the release manually)
|
||||
conflicted_files = []
|
||||
|
||||
print('Updating changelog')
|
||||
update_changelog(version)
|
||||
if not is_primary_release:
|
||||
|
||||
# Create a commit that updates the CHANGELOG
|
||||
run_git('add', 'CHANGELOG.md')
|
||||
run_git('commit', '-m', f'Update changelog for v{version}')
|
||||
# the source branch will be of the form releases/vN, where N is the major version number
|
||||
source_branch_major_version = source_branch.strip('releases/v')
|
||||
|
||||
# If we're performing a backport, start from the target branch
|
||||
print(f'Creating {new_branch_name} from the {ORIGIN}/{target_branch} branch')
|
||||
run_git('checkout', '-b', new_branch_name, f'{ORIGIN}/{target_branch}')
|
||||
|
||||
# Revert the commit that we made as part of the last release that updated the version number and
|
||||
# changelog to refer to {older}.x.x variants. This avoids merge conflicts in the changelog and
|
||||
# package.json files when we merge in the v{latest} branch.
|
||||
# This commit will not exist the first time we release the v{N-1} branch from the v{N} branch, so we
|
||||
# use `git log --grep` to conditionally revert the commit.
|
||||
print('Reverting the version number and changelog updates from the last release to avoid conflicts')
|
||||
vOlder_update_commits = run_git('log', '--grep', f'^{BACKPORT_COMMIT_MESSAGE}', '--format=%H').split()
|
||||
|
||||
if len(vOlder_update_commits) > 0:
|
||||
print(f' Reverting {vOlder_update_commits[0]}')
|
||||
# Only revert the newest commit as older ones will already have been reverted in previous
|
||||
# releases.
|
||||
run_git('revert', vOlder_update_commits[0], '--no-edit')
|
||||
|
||||
# Also revert the "Update checked-in dependencies" commit created by Actions.
|
||||
update_dependencies_commit = run_git('log', '--grep', '^Update checked-in dependencies', '--format=%H').split()[0]
|
||||
print(f' Reverting {update_dependencies_commit}')
|
||||
run_git('revert', update_dependencies_commit, '--no-edit')
|
||||
|
||||
else:
|
||||
print(' Nothing to revert.')
|
||||
|
||||
print(f'Merging {ORIGIN}/{source_branch} into the release prep branch')
|
||||
# Commit any conflicts (see the comment for `conflicted_files`)
|
||||
run_git('merge', f'{ORIGIN}/{source_branch}', allow_non_zero_exit_code=True)
|
||||
conflicted_files = run_git('diff', '--name-only', '--diff-filter', 'U').splitlines()
|
||||
if len(conflicted_files) > 0:
|
||||
run_git('add', '.')
|
||||
run_git('commit', '--no-edit')
|
||||
|
||||
# Migrate the package version number from a vLatest version number to a vOlder version number
|
||||
print(f'Setting version number to {version}')
|
||||
subprocess.check_output(['npm', 'version', version, '--no-git-tag-version'])
|
||||
run_git('add', 'package.json', 'package-lock.json')
|
||||
|
||||
# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
|
||||
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')
|
||||
process_changelog_for_backports(source_branch_major_version, target_branch_major_version)
|
||||
|
||||
# Amend the commit generated by `npm version` to update the CHANGELOG
|
||||
run_git('add', 'CHANGELOG.md')
|
||||
run_git('commit', '-m', f'{BACKPORT_COMMIT_MESSAGE}{version}')
|
||||
else:
|
||||
# If we're performing a standard release, there won't be any new commits on the target branch,
|
||||
# as these will have already been merged back into the source branch. Therefore we can just
|
||||
# start from the source branch.
|
||||
run_git('checkout', '-b', new_branch_name, f'{ORIGIN}/{source_branch}')
|
||||
|
||||
print('Updating changelog')
|
||||
update_changelog(version)
|
||||
|
||||
# Create a commit that updates the CHANGELOG
|
||||
run_git('add', 'CHANGELOG.md')
|
||||
run_git('commit', '-m', f'Update changelog for v{version}')
|
||||
|
||||
run_git('push', ORIGIN, new_branch_name)
|
||||
|
||||
@@ -240,7 +405,11 @@ def main():
|
||||
commits,
|
||||
source_branch_short_sha,
|
||||
new_branch_name,
|
||||
source_branch=source_branch,
|
||||
target_branch=target_branch,
|
||||
conductor=args.conductor,
|
||||
is_primary_release=is_primary_release,
|
||||
conflicted_files=conflicted_files
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
18
.github/workflows/__all-platform-bundle.yml
generated
vendored
18
.github/workflows/__all-platform-bundle.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,6 +34,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
54
.github/workflows/__analyze-ref-input.yml
generated
vendored
54
.github/workflows/__analyze-ref-input.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,48 +25,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: windows-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
version: stable-20220908
|
||||
- os: windows-latest
|
||||
version: stable-20220908
|
||||
- os: ubuntu-latest
|
||||
version: stable-20221211
|
||||
- os: macos-latest
|
||||
version: stable-20221211
|
||||
- os: windows-latest
|
||||
version: stable-20221211
|
||||
- os: ubuntu-latest
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: "Analyze: 'ref' and 'sha' from inputs"
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -74,6 +38,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__autobuild-action.yml
generated
vendored
18
.github/workflows/__autobuild-action.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -38,6 +38,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
20
.github/workflows/__config-export.yml
generated
vendored
20
.github/workflows/__config-export.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -44,6 +44,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -76,7 +92,7 @@ jobs:
|
||||
path: ${{ runner.temp }}/results/javascript.sarif
|
||||
retention-days: 7
|
||||
- name: Check config properties appear in SARIF
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
|
||||
with:
|
||||
|
||||
94
.github/workflows/__cpp-deptrace-disabled.yml
generated
vendored
Normal file
94
.github/workflows/__cpp-deptrace-disabled.yml
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# 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 - C/C++: disabling autoinstalling dependencies (Linux)'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
cpp-deptrace-disabled:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
name: 'C/C++: disabling autoinstalling dependencies (Linux)'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- name: Test setup
|
||||
shell: bash
|
||||
run: |
|
||||
cp -a ../action/tests/cpp-autobuild autobuild-dir
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: cpp
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
with:
|
||||
working-directory: autobuild-dir
|
||||
env:
|
||||
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
|
||||
- shell: bash
|
||||
run: |
|
||||
if ls /usr/bin/errno; then
|
||||
echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled."
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
92
.github/workflows/__cpp-deptrace-enabled-on-macos.yml
generated
vendored
Normal file
92
.github/workflows/__cpp-deptrace-enabled-on-macos.yml
generated
vendored
Normal 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 - C/C++: autoinstalling dependencies is skipped (macOS)'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
cpp-deptrace-enabled-on-macos:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
name: 'C/C++: autoinstalling dependencies is skipped (macOS)'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- name: Test setup
|
||||
shell: bash
|
||||
run: |
|
||||
cp -a ../action/tests/cpp-autobuild autobuild-dir
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: cpp
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
with:
|
||||
working-directory: autobuild-dir
|
||||
env:
|
||||
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
|
||||
- shell: bash
|
||||
run: |
|
||||
if ! ls /usr/bin/errno; then
|
||||
echo "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:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
94
.github/workflows/__cpp-deptrace-enabled.yml
generated
vendored
Normal file
94
.github/workflows/__cpp-deptrace-enabled.yml
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# 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 - C/C++: autoinstalling dependencies (Linux)'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
cpp-deptrace-enabled:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
name: 'C/C++: autoinstalling dependencies (Linux)'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- name: Test setup
|
||||
shell: bash
|
||||
run: |
|
||||
cp -a ../action/tests/cpp-autobuild autobuild-dir
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: cpp
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
with:
|
||||
working-directory: autobuild-dir
|
||||
env:
|
||||
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
|
||||
- shell: bash
|
||||
run: |
|
||||
if ! ls /usr/bin/errno; then
|
||||
echo "Did not autoinstall errno"
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
20
.github/workflows/__diagnostics-export.yml
generated
vendored
20
.github/workflows/__diagnostics-export.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -50,6 +50,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -98,7 +114,7 @@ jobs:
|
||||
path: ${{ runner.temp }}/results/javascript.sarif
|
||||
retention-days: 7
|
||||
- name: Check diagnostics appear in SARIF
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
|
||||
with:
|
||||
|
||||
27
.github/workflows/__export-file-baseline-information.yml
generated
vendored
27
.github/workflows/__export-file-baseline-information.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -38,6 +38,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -59,8 +75,6 @@ jobs:
|
||||
with:
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
env:
|
||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||
- uses: ./../action/.github/actions/setup-swift
|
||||
with:
|
||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||
@@ -70,8 +84,6 @@ jobs:
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||
- name: Upload SARIF
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
@@ -82,13 +94,13 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
expected_baseline_languages="cpp cs go java js py rb"
|
||||
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="${lang}/baseline/expected-extracted-files"
|
||||
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
|
||||
@@ -99,4 +111,5 @@ jobs:
|
||||
fi
|
||||
done
|
||||
env:
|
||||
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
18
.github/workflows/__extractor-ram-threads.yml
generated
vendored
18
.github/workflows/__extractor-ram-threads.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,6 +34,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
36
.github/workflows/__go-custom-queries.yml
generated
vendored
36
.github/workflows/__go-custom-queries.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,12 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: windows-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -49,6 +43,18 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -74,6 +80,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
112
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
generated
vendored
Normal file
112
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
# 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 Go is changed after init step'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-indirect-tracing-workaround-diagnostic:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
name: 'Go: diagnostic when Go is changed after init step'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# We need a Go version that ships with statically linked binaries on Linux
|
||||
go-version: '>=1.21.0'
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
# Deliberately change Go after the `init` step
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20'
|
||||
- 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/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)}.`
|
||||
);
|
||||
}
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
110
.github/workflows/__go-indirect-tracing-workaround.yml
generated
vendored
Normal file
110
.github/workflows/__go-indirect-tracing-workaround.yml
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Go: workaround for indirect 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
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-indirect-tracing-workaround:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
name: 'Go: workaround for indirect tracing'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# We need a Go version that ships with statically linked binaries on Linux
|
||||
go-version: '>=1.21.0'
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
|
||||
"CODEQL_ACTION_GO_BINARY environment variable is not set."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||
# `! -z` flag with the more elegant `-v` which confirms that the variable
|
||||
# is actually unset and not potentially set to a blank value.
|
||||
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
|
||||
echo "Expected the Go autobuilder not to be run, but the" \
|
||||
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
|
||||
exit 1
|
||||
fi
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d go ]]; then
|
||||
echo "Did not find a Go database"
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
33
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
33
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,10 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -41,6 +37,14 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -60,6 +64,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -76,6 +96,9 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ~1.21.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
33
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
33
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,10 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -41,6 +37,14 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -60,6 +64,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -76,6 +96,9 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ~1.21.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
33
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
33
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,10 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -41,6 +37,14 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -60,6 +64,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -76,6 +96,9 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ~1.21.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
18
.github/workflows/__init-with-registries.yml
generated
vendored
18
.github/workflows/__init-with-registries.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -51,6 +51,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__javascript-source-root.yml
generated
vendored
18
.github/workflows/__javascript-source-root.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -38,6 +38,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
85
.github/workflows/__language-aliases.yml
generated
vendored
Normal file
85
.github/workflows/__language-aliases.yml
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
# 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 - Language aliases
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
language-aliases:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
name: Language aliases
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: C#,java-kotlin,swift,typescript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: Check languages
|
||||
run: |
|
||||
expected_languages="csharp,java,swift,javascript"
|
||||
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
|
||||
|
||||
if [ "$expected_languages" != "$actual_languages" ]; then
|
||||
echo "Resolved languages did not match expected list. " \
|
||||
"Expected languages: $expected_languages. Actual languages: $actual_languages."
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
147
.github/workflows/__ml-powered-queries.yml
generated
vendored
147
.github/workflows/__ml-powered-queries.yml
generated
vendored
@@ -1,147 +0,0 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - ML-powered queries
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
ml-powered-queries:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: windows-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
version: stable-20220908
|
||||
- os: windows-latest
|
||||
version: stable-20220908
|
||||
- os: ubuntu-latest
|
||||
version: stable-20221211
|
||||
- os: macos-latest
|
||||
version: stable-20221211
|
||||
- os: windows-latest
|
||||
version: stable-20221211
|
||||
- os: ubuntu-latest
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: ML-powered queries
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
queries: security-extended
|
||||
source-root: ./../action/tests/ml-powered-queries-repo
|
||||
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: ml-powered-queries-${{ matrix.os }}-${{ matrix.version }}.sarif.json
|
||||
path: ${{ runner.temp }}/results/javascript.sarif
|
||||
retention-days: 7
|
||||
|
||||
- name: Check sarif
|
||||
uses: ./../action/.github/actions/check-sarif
|
||||
with:
|
||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||
queries-run:
|
||||
js/ml-powered/nosql-injection,js/ml-powered/path-injection,js/ml-powered/sql-injection,js/ml-powered/xss
|
||||
queries-not-run: foo,bar
|
||||
|
||||
- name: Check results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should run at least the ML-powered queries in `expected_rules`.
|
||||
expected_rules="js/ml-powered/nosql-injection js/ml-powered/path-injection js/ml-powered/sql-injection js/ml-powered/xss"
|
||||
|
||||
for rule in ${expected_rules}; do
|
||||
found_rule=$(jq --arg rule "${rule}" '[.runs[0].tool.extensions[].rules | select(. != null) |
|
||||
flatten | .[].id] | any(. == $rule)' javascript.sarif)
|
||||
echo "Did find rule '${rule}': ${found_rule}"
|
||||
if [[ "${found_rule}" != "true" ]]; then
|
||||
echo "Expected SARIF output to contain rule '${rule}', but found no such rule."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# We should have at least one alert from an ML-powered query.
|
||||
num_alerts=$(jq '[.runs[0].results[] |
|
||||
select(.properties.score != null and (.rule.id | startswith("js/ml-powered/")))] | length' \
|
||||
javascript.sarif)
|
||||
echo "Found ${num_alerts} alerts from ML-powered queries.";
|
||||
if [[ "${num_alerts}" -eq 0 ]]; then
|
||||
echo "Expected to find at least one alert from an ML-powered query but found ${num_alerts}."
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
30
.github/workflows/__multi-language-autodetect.yml
generated
vendored
30
.github/workflows/__multi-language-autodetect.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,10 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -41,6 +37,14 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -60,6 +64,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
18
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -50,6 +50,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
18
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -50,6 +50,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__packaging-config-js.yml
generated
vendored
18
.github/workflows/__packaging-config-js.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -50,6 +50,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__packaging-inputs-js.yml
generated
vendored
18
.github/workflows/__packaging-inputs-js.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -50,6 +50,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
36
.github/workflows/__remote-config.yml
generated
vendored
36
.github/workflows/__remote-config.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,12 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: windows-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -49,6 +43,18 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -74,6 +80,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
60
.github/workflows/__resolve-environment-action.yml
generated
vendored
60
.github/workflows/__resolve-environment-action.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -31,6 +31,24 @@ jobs:
|
||||
version: stable-v2.13.4
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.4
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: Resolve environment
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -38,6 +56,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -56,16 +90,30 @@ jobs:
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
|
||||
}}
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- uses: ./../action/resolve-environment
|
||||
id: resolve-environment
|
||||
- name: Resolve environment for Go
|
||||
uses: ./../action/resolve-environment
|
||||
id: resolve-environment-go
|
||||
with:
|
||||
language: go
|
||||
|
||||
- name: Fail if no Go configuration was returned
|
||||
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
|
||||
- name: Fail if Go configuration missing
|
||||
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
|
||||
run: exit 1
|
||||
|
||||
- name: Resolve environment for JavaScript/TypeScript
|
||||
if: matrix.version != 'stable-v2.13.4'
|
||||
uses: ./../action/resolve-environment
|
||||
id: resolve-environment-js
|
||||
with:
|
||||
language: javascript-typescript
|
||||
|
||||
- name: Fail if JavaScript/TypeScript configuration present
|
||||
if: matrix.version != 'stable-v2.13.4' &&
|
||||
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
|
||||
run: exit 1
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
18
.github/workflows/__rubocop-multi-language.yml
generated
vendored
18
.github/workflows/__rubocop-multi-language.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,6 +34,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__ruby.yml
generated
vendored
18
.github/workflows/__ruby.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -44,6 +44,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
30
.github/workflows/__scaling-reserved-ram.yml
generated
vendored
30
.github/workflows/__scaling-reserved-ram.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,10 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -41,6 +37,14 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -60,6 +64,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__split-workflow.yml
generated
vendored
18
.github/workflows/__split-workflow.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -44,6 +44,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__submit-sarif-failure.yml
generated
vendored
18
.github/workflows/__submit-sarif-failure.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -38,6 +38,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__swift-custom-build.yml
generated
vendored
18
.github/workflows/__swift-custom-build.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -44,6 +44,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
18
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,6 +34,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__test-local-codeql.yml
generated
vendored
18
.github/workflows/__test-local-codeql.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,6 +34,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
18
.github/workflows/__test-proxy.yml
generated
vendored
18
.github/workflows/__test-proxy.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -34,6 +34,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
24
.github/workflows/__unset-environment.yml
generated
vendored
24
.github/workflows/__unset-environment.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,14 +25,16 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: ubuntu-latest
|
||||
version: stable-20221211
|
||||
- os: ubuntu-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
@@ -46,6 +48,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
54
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
54
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,48 +25,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: windows-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
version: stable-20220908
|
||||
- os: windows-latest
|
||||
version: stable-20220908
|
||||
- os: ubuntu-latest
|
||||
version: stable-20221211
|
||||
- os: macos-latest
|
||||
version: stable-20221211
|
||||
- os: windows-latest
|
||||
version: stable-20221211
|
||||
- os: ubuntu-latest
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: "Upload-sarif: 'ref' and 'sha' from inputs"
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -74,6 +38,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
|
||||
61
.github/workflows/__with-checkout-path.yml
generated
vendored
61
.github/workflows/__with-checkout-path.yml
generated
vendored
@@ -12,7 +12,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,12 +25,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220615
|
||||
- os: macos-latest
|
||||
version: stable-20220615
|
||||
- os: windows-latest
|
||||
version: stable-20220615
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
@@ -49,6 +43,18 @@ jobs:
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
@@ -74,6 +80,22 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v4
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20220908' ||
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
@@ -90,27 +112,34 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- name: Delete original checkout
|
||||
shell: bash
|
||||
run: |
|
||||
# delete the original checkout so we don't accidentally use it.
|
||||
# Actions does not support deleting the current working directory, so we
|
||||
# delete the contents of the directory instead.
|
||||
rm -rf ./* .github .git
|
||||
# Check out the actions repo again, but at a different location.
|
||||
# choose an arbitrary SHA so that we can later test that the commit_oid is not from main
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||
path: x/y/z/some-path
|
||||
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
# it's enough to test one compiled language and one interpreted language
|
||||
languages: csharp,javascript
|
||||
source-path: x/y/z/some-path/tests/multi-language-repo
|
||||
source-root: x/y/z/some-path/tests/multi-language-repo
|
||||
debug: true
|
||||
- name: Build code (non-windows)
|
||||
|
||||
- name: Build code
|
||||
shell: bash
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
working-directory: x/y/z/some-path/tests/multi-language-repo
|
||||
run: |
|
||||
$CODEQL_RUNNER x/y/z/some-path/tests/multi-language-repo/build.sh
|
||||
- name: Build code (windows)
|
||||
shell: bash
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
run: |
|
||||
x/y/z/some-path/tests/multi-language-repo/build.sh
|
||||
./build.sh
|
||||
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
checkout_path: x/y/z/some-path/tests/multi-language-repo
|
||||
|
||||
7
.github/workflows/codeql.yml
vendored
7
.github/workflows/codeql.yml
vendored
@@ -2,15 +2,16 @@ name: "CodeQL action"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, releases/v2]
|
||||
branches: [main, releases/v*]
|
||||
pull_request:
|
||||
branches: [main, releases/v2]
|
||||
branches: [main, releases/v*]
|
||||
# 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]
|
||||
schedule:
|
||||
# Weekly on Sunday.
|
||||
- cron: '30 1 * * 0'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
|
||||
@@ -73,7 +74,7 @@ jobs:
|
||||
needs: [check-codeql-versions]
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest,windows-latest,macos-latest]
|
||||
os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-11,macos-12,macos-13]
|
||||
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
|
||||
17
.github/workflows/debug-artifacts-failure.yml
vendored
17
.github/workflows/debug-artifacts-failure.yml
vendored
@@ -10,7 +10,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -39,9 +39,20 @@ jobs:
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: latest
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ^1.13.1
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v5
|
||||
if: |
|
||||
matrix.os == 'macos-latest' && (
|
||||
matrix.version == 'stable-20220908' ||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
@@ -52,7 +63,7 @@ jobs:
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
id: analysis
|
||||
with:
|
||||
expect-error: true
|
||||
ram: 1
|
||||
|
||||
24
.github/workflows/debug-artifacts.yml
vendored
24
.github/workflows/debug-artifacts.yml
vendored
@@ -9,7 +9,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -25,10 +25,11 @@ jobs:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
version:
|
||||
- stable-20220615
|
||||
- stable-20220908
|
||||
- stable-20221211
|
||||
- stable-20230418
|
||||
- stable-v2.13.5
|
||||
- stable-v2.14.6
|
||||
- default
|
||||
- latest
|
||||
- nightly-latest
|
||||
@@ -45,9 +46,20 @@ jobs:
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ^1.13.1
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v5
|
||||
if: |
|
||||
matrix.os == 'macos-latest' && (
|
||||
matrix.version == 'stable-20220908' ||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- uses: ./../action/init
|
||||
id: init
|
||||
with:
|
||||
@@ -62,7 +74,7 @@ jobs:
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
id: analysis
|
||||
download-and-check-artifacts:
|
||||
name: Download and check debug artifacts
|
||||
needs: upload-artifacts
|
||||
@@ -74,11 +86,11 @@ jobs:
|
||||
- name: Check expected artifacts exist
|
||||
shell: bash
|
||||
run: |
|
||||
VERSIONS="stable-20220615 stable-20220908 stable-20221211 stable-20230418 default latest nightly-latest"
|
||||
VERSIONS="stable-20220908 stable-20221211 stable-20230418 stable-v2.13.5 stable-v2.14.6 default latest nightly-latest"
|
||||
LANGUAGES="cpp csharp go java javascript python"
|
||||
for version in $VERSIONS; do
|
||||
for os in ubuntu-latest macos-latest; do
|
||||
pushd "./my-debug-artifacts-$os-$version"
|
||||
pushd "./my-debug-artifacts-$os-${version//./}"
|
||||
echo "Artifacts from version $version on $os:"
|
||||
for language in $LANGUAGES; do
|
||||
echo "- Checking $language"
|
||||
|
||||
2
.github/workflows/expected-queries-runs.yml
vendored
2
.github/workflows/expected-queries-runs.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
|
||||
34
.github/workflows/post-release-mergeback.yml
vendored
34
.github/workflows/post-release-mergeback.yml
vendored
@@ -1,9 +1,9 @@
|
||||
# This workflow runs after a release of the action. It:
|
||||
# 1. Merges any changes from the release back into the main branch. Typically, this is just a single
|
||||
# commit that updates the changelog.
|
||||
# 2. Tags the merge commit on the release branch that represents the new release with an `v2.x.y`
|
||||
# This workflow runs after a merge to any release branch of the action. It:
|
||||
# 1. Tags the merge commit on the release branch that represents the new release with an `vN.x.y`
|
||||
# tag
|
||||
# 3. Updates the `v2` tag to refer to this merge commit.
|
||||
# 2. Updates the `vN` tag to refer to this merge commit.
|
||||
# 3. Iff vN == vLatest, merges any changes from the release back into the main branch.
|
||||
# Typically, this is two commits – one to update the version number and one to update dependencies.
|
||||
name: Tag release and merge back
|
||||
|
||||
on:
|
||||
@@ -16,7 +16,7 @@ on:
|
||||
|
||||
push:
|
||||
branches:
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
|
||||
jobs:
|
||||
merge-back:
|
||||
@@ -36,7 +36,9 @@ jobs:
|
||||
run: echo "${GITHUB_CONTEXT}"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
fetch-depth: 0 # ensure we have all tags and can push commits
|
||||
- uses: actions/setup-node@v4
|
||||
|
||||
- name: Update git config
|
||||
run: |
|
||||
@@ -51,6 +53,8 @@ jobs:
|
||||
short_sha="${GITHUB_SHA:0:8}"
|
||||
NEW_BRANCH="mergeback/${VERSION}-to-${BASE_BRANCH}-${short_sha}"
|
||||
echo "newBranch=${NEW_BRANCH}" >> $GITHUB_OUTPUT
|
||||
LATEST_RELEASE_BRANCH=$(git branch -r | grep -E "origin/releases/v[0-9]+$" | sed 's/origin\///g' | sort -V | tail -1 | xargs)
|
||||
echo "latest_release_branch=${LATEST_RELEASE_BRANCH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Dump branches
|
||||
env:
|
||||
@@ -59,6 +63,8 @@ jobs:
|
||||
echo "BASE_BRANCH ${BASE_BRANCH}"
|
||||
echo "HEAD_BRANCH ${HEAD_BRANCH}"
|
||||
echo "NEW_BRANCH ${NEW_BRANCH}"
|
||||
echo "LATEST_RELEASE_BRANCH ${LATEST_RELEASE_BRANCH}"
|
||||
echo "GITHUB_REF ${GITHUB_REF}"
|
||||
|
||||
- name: Create mergeback branch
|
||||
env:
|
||||
@@ -89,8 +95,6 @@ jobs:
|
||||
env:
|
||||
VERSION: ${{ steps.getVersion.outputs.version }}
|
||||
run: |
|
||||
# Unshallow the repo in order to allow pushes
|
||||
git fetch --unshallow
|
||||
# Create the `vx.y.z` tag
|
||||
git tag --annotate "${VERSION}" --message "${VERSION}"
|
||||
# Update the `vx` tag
|
||||
@@ -99,13 +103,13 @@ jobs:
|
||||
git tag --annotate "${major_version_tag}" --message "${major_version_tag}" --force
|
||||
# Push the tags, using:
|
||||
# - `--atomic` to make sure we either update both tags or neither (an intermediate state,
|
||||
# e.g. where we update the v2.x.y tag on the remote but not the v2 tag, could result in
|
||||
# unwanted Dependabot updates, e.g. from v2 to v2.x.y)
|
||||
# - `--force` since we're overwriting the `vx` tag
|
||||
# e.g. where we update the vN.x.y tag on the remote but not the vN tag, could result in
|
||||
# unwanted Dependabot updates, e.g. from vN to vN.x.y)
|
||||
# - `--force` since we're overwriting the `vN` tag
|
||||
git push origin --atomic --force refs/tags/"${VERSION}" refs/tags/"${major_version_tag}"
|
||||
|
||||
- name: Create mergeback branch
|
||||
if: steps.check.outputs.exists != 'true'
|
||||
if: ${{ steps.check.outputs.exists != 'true' && endsWith(github.ref_name, steps.getVersion.outputs.latest_release_branch) }}
|
||||
env:
|
||||
VERSION: "${{ steps.getVersion.outputs.version }}"
|
||||
NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}"
|
||||
@@ -129,8 +133,8 @@ jobs:
|
||||
# Update the version number ready for the next release
|
||||
npm version patch --no-git-tag-version
|
||||
|
||||
# Update the changelog
|
||||
perl -i -pe 's/^/## \[UNRELEASED\]\n\nNo user facing changes.\n\n/ if($.==5)' CHANGELOG.md
|
||||
# Update the changelog, adding a new version heading directly above the most recent existing one
|
||||
awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md
|
||||
git add .
|
||||
git commit -m "Update changelog and version after ${VERSION}"
|
||||
|
||||
|
||||
83
.github/workflows/pr-checks.yml
vendored
83
.github/workflows/pr-checks.yml
vendored
@@ -2,7 +2,7 @@ name: PR Checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, releases/v2]
|
||||
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.
|
||||
@@ -15,6 +15,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-types-version: [16.11, current] # run tests on 16.11 while CodeQL Action v2 is still supported
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -22,6 +26,28 @@ jobs:
|
||||
- name: Lint
|
||||
run: npm run-script lint
|
||||
|
||||
- name: Update version of @types/node
|
||||
if: matrix.node-types-version != 'current'
|
||||
env:
|
||||
NODE_TYPES_VERSION: ${{ matrix.node-types-version }}
|
||||
run: |
|
||||
# Export `NODE_TYPES_VERSION` so it's available to jq
|
||||
export NODE_TYPES_VERSION="${NODE_TYPES_VERSION}"
|
||||
contents=$(jq '.devDependencies."@types/node" = env.NODE_TYPES_VERSION' package.json)
|
||||
echo "${contents}" > package.json
|
||||
# Usually we run `npm install` on macOS to ensure that we pick up macOS-only dependencies.
|
||||
# However we're not checking in the updated lockfile here, so it's fine to run
|
||||
# `npm install` on Linux.
|
||||
npm install
|
||||
|
||||
if [ ! -z "$(git status --porcelain)" ]; then
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
# The period in `git add --all .` ensures that we stage deleted files too.
|
||||
git add --all .
|
||||
git commit -m "Use @types/node=${NODE_TYPES_VERSION}"
|
||||
fi
|
||||
|
||||
- name: Check generated JS
|
||||
run: .github/workflows/script/check-js.sh
|
||||
|
||||
@@ -45,7 +71,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.11
|
||||
|
||||
@@ -69,6 +95,18 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v5
|
||||
if: |
|
||||
matrix.os == 'macos-latest' && (
|
||||
matrix.version == 'stable-20220908' ||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: npm test
|
||||
run: |
|
||||
@@ -76,3 +114,44 @@ jobs:
|
||||
# we won't be able to find them on Windows.
|
||||
npm config set script-shell bash
|
||||
npm test
|
||||
|
||||
check-node-version:
|
||||
if: ${{ github.event.pull_request }}
|
||||
name: Check Action Node versions
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
BASE_REF: ${{ github.base_ref }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: head-version
|
||||
name: Verify all Actions use the same Node version
|
||||
run: |
|
||||
NODE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq)
|
||||
echo "NODE_VERSION: ${NODE_VERSION}"
|
||||
if [[ $(echo "$NODE_VERSION" | wc -l) -gt 1 ]]; then
|
||||
echo "::error::More than one node version used in 'action.yml' files."
|
||||
exit 1
|
||||
fi
|
||||
echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- id: checkout-base
|
||||
name: 'Backport: Check out base ref'
|
||||
if: ${{ startsWith(github.head_ref, 'backport-') }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ env.BASE_REF }}
|
||||
|
||||
- name: 'Backport: Verify Node versions unchanged'
|
||||
if: steps.checkout-base.outcome == 'success'
|
||||
env:
|
||||
HEAD_VERSION: ${{ steps.head-version.outputs.node_version }}
|
||||
run: |
|
||||
BASE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq)
|
||||
echo "HEAD_VERSION: ${HEAD_VERSION}"
|
||||
echo "BASE_VERSION: ${BASE_VERSION}"
|
||||
if [[ "$BASE_VERSION" != "$HEAD_VERSION" ]]; then
|
||||
echo "::error::Cannot change the Node version of an Action in a backport PR."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
16
.github/workflows/python-deps.yml
vendored
16
.github/workflows/python-deps.yml
vendored
@@ -2,7 +2,7 @@ name: Test Python Package Installation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, releases/v2]
|
||||
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.
|
||||
@@ -36,6 +36,18 @@ jobs:
|
||||
PYTHON_VERSION: ${{ matrix.python_version }}
|
||||
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v5
|
||||
if: |
|
||||
matrix.os == 'macos-latest' && (
|
||||
matrix.version == 'stable-20220908' ||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -139,7 +151,7 @@ jobs:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python_version }}
|
||||
|
||||
|
||||
42
.github/workflows/python312-windows.yml
vendored
Normal file
42
.github/workflows/python312-windows.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Test that the workaround for python 3.12 on windows works
|
||||
|
||||
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]
|
||||
schedule:
|
||||
# Weekly on Monday.
|
||||
- cron: '0 0 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test-setup-python-scripts:
|
||||
timeout-minutes: 45
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.12
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: default
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: ./../action/init
|
||||
with:
|
||||
tools: latest
|
||||
languages: python
|
||||
|
||||
- name: Analyze
|
||||
uses: ./../action/analyze
|
||||
with:
|
||||
upload: false
|
||||
upload-database: false
|
||||
2
.github/workflows/query-filters.yml
vendored
2
.github/workflows/query-filters.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
|
||||
60
.github/workflows/rebuild.yml
vendored
Normal file
60
.github/workflows/rebuild.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Rebuild Action
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [labeled]
|
||||
|
||||
jobs:
|
||||
rebuild:
|
||||
name: Rebuild Action
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.label.name == 'Rebuild'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Remove label
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr edit --repo github/codeql-action "$PR_NUMBER" \
|
||||
--remove-label "Rebuild"
|
||||
|
||||
- name: Compile TypeScript
|
||||
run: |
|
||||
npm install
|
||||
npm run lint -- --fix
|
||||
npm run build
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.11
|
||||
|
||||
- name: Generate workflows
|
||||
run: |
|
||||
cd pr-checks
|
||||
python -m pip install --upgrade pip
|
||||
pip install ruamel.yaml==0.17.31
|
||||
python3 sync.py
|
||||
|
||||
- name: Check for changes and push
|
||||
env:
|
||||
BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
if [ ! -z "$(git status --porcelain)" ]; then
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git commit -am "Rebuild"
|
||||
git push origin "HEAD:$BRANCH"
|
||||
echo "Pushed a commit to rebuild the Action." \
|
||||
"Please mark the PR as ready for review to trigger PR checks." |
|
||||
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER"
|
||||
gh pr ready --undo --repo github/codeql-action "$PR_NUMBER"
|
||||
fi
|
||||
@@ -23,15 +23,22 @@ fi
|
||||
echo "Getting checks for $GITHUB_SHA"
|
||||
|
||||
# Ignore any checks with "https://", CodeQL, LGTM, and Update checks.
|
||||
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "LGTM.com" or . == "check-expected-release-files" or contains("Update") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
|
||||
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
|
||||
|
||||
echo "$CHECKS" | jq
|
||||
|
||||
echo "{\"contexts\": ${CHECKS}}" > checks.json
|
||||
|
||||
for BRANCH in main releases/v2; do
|
||||
for BRANCH in main releases/v2 releases/v3; do
|
||||
echo "Updating $BRANCH"
|
||||
echo "{\"contexts\": ${CHECKS}}" > checks.json
|
||||
|
||||
# we need to special case the JS checks for releases/v2
|
||||
if [ "$BRANCH" == "releases/v2" ]; then
|
||||
# we remove entries matching "Check JS (*" and add "Check JS" to the list
|
||||
PROCESSED_CHECKS="$(echo "$CHECKS" | jq --compact-output --raw-output 'map(select(. | contains("Check JS (") | not)) + ["Check JS"] | unique | sort' )"
|
||||
echo "{\"contexts\": ${PROCESSED_CHECKS}}" > checks.json
|
||||
fi
|
||||
gh api --silent -X "PATCH" "repos/github/codeql-action/branches/$BRANCH/protection/required_status_checks" --input checks.json
|
||||
# cat checks.json | jq > checks-"${BRANCH//\//-}".json
|
||||
done
|
||||
|
||||
rm checks.json
|
||||
|
||||
4
.github/workflows/test-codeql-bundle-all.yml
vendored
4
.github/workflows/test-codeql-bundle-all.yml
vendored
@@ -9,7 +9,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
@@ -53,4 +53,4 @@ jobs:
|
||||
with:
|
||||
upload-database: false
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
7
.github/workflows/update-dependencies.yml
vendored
7
.github/workflows/update-dependencies.yml
vendored
@@ -15,15 +15,16 @@ jobs:
|
||||
|
||||
- name: Remove PR label
|
||||
env:
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
REPOSITORY: '${{ github.repository }}'
|
||||
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
run: |
|
||||
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
|
||||
|
||||
- name: Push updated dependencies
|
||||
env:
|
||||
BRANCH: '${{ github.head_ref }}'
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
run: |
|
||||
git fetch origin "$BRANCH" --depth=1
|
||||
git checkout "origin/$BRANCH"
|
||||
@@ -36,6 +37,6 @@ jobs:
|
||||
git push origin "HEAD:$BRANCH"
|
||||
echo "Pushed a commit to update the checked-in dependencies." \
|
||||
"Please mark the PR as ready for review to trigger PR checks." |
|
||||
gh pr comment --body-file - --repo github/codeql-action --pr "${{ github.event.pull_request.number }}"
|
||||
gh pr ready --undo --repo github/codeql-action --pr "${{ github.event.pull_request.number }}"
|
||||
gh pr comment --body-file - --repo github/codeql-action "${{ github.event.pull_request.number }}"
|
||||
gh pr ready --undo --repo github/codeql-action "${{ github.event.pull_request.number }}"
|
||||
fi
|
||||
|
||||
137
.github/workflows/update-release-branch.yml
vendored
137
.github/workflows/update-release-branch.yml
vendored
@@ -1,46 +1,131 @@
|
||||
name: Update release branch
|
||||
on:
|
||||
# You can trigger this workflow via workflow dispatch to start a release.
|
||||
# This will open a PR to update the v2 release branch.
|
||||
# This will open a PR to update the latest release branch.
|
||||
workflow_dispatch:
|
||||
|
||||
# When a release is complete this workflow will open up backport PRs to older release branches.
|
||||
# NB while it will trigger on any release branch update, the backport job will not proceed for
|
||||
# anything other than than releases/v{latest}
|
||||
push:
|
||||
branches:
|
||||
- releases/*
|
||||
|
||||
jobs:
|
||||
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'github/codeql-action'
|
||||
outputs:
|
||||
version: ${{ steps.versions.outputs.version }}
|
||||
major_version: ${{ steps.versions.outputs.major_version }}
|
||||
latest_tag: ${{ steps.versions.outputs.latest_tag }}
|
||||
backport_source_branch: ${{ steps.branches.outputs.backport_source_branch }}
|
||||
backport_target_branches: ${{ steps.branches.outputs.backport_target_branches }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Need full history for calculation of diffs
|
||||
- uses: ./.github/actions/release-initialise
|
||||
|
||||
- name: Get version tags
|
||||
id: versions
|
||||
run: |
|
||||
VERSION="v$(jq '.version' -r 'package.json')"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
MAJOR_VERSION=$(cut -d '.' -f1 <<< "${VERSION}")
|
||||
echo "major_version=${MAJOR_VERSION}" >> $GITHUB_OUTPUT
|
||||
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
||||
echo "latest_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
|
||||
|
||||
- id: branches
|
||||
name: Determine older release branches
|
||||
uses: ./.github/actions/release-branches
|
||||
with:
|
||||
major_version: ${{ steps.versions.outputs.major_version }}
|
||||
latest_tag: ${{ steps.versions.outputs.latest_tag }}
|
||||
|
||||
- name: debug logging
|
||||
run: |
|
||||
echo 'version: ${{ steps.versions.outputs.version }}'
|
||||
echo 'major_version: ${{ steps.versions.outputs.major_version }}'
|
||||
echo 'latest_tag: ${{ steps.versions.outputs.latest_tag }}'
|
||||
echo 'backport_source_branch: ${{ steps.branches.outputs.backport_source_branch }}'
|
||||
echo 'backport_target_branches: ${{ steps.branches.outputs.backport_target_branches }}'
|
||||
|
||||
update:
|
||||
timeout-minutes: 45
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'github/codeql-action'
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
needs: [prepare]
|
||||
env:
|
||||
REF_NAME: "${{ github.ref_name }}"
|
||||
REPOSITORY: "${{ github.repository }}"
|
||||
MAJOR_VERSION: "${{ needs.prepare.outputs.major_version }}"
|
||||
LATEST_TAG: "${{ needs.prepare.outputs.latest_tag }}"
|
||||
steps:
|
||||
- name: Dump environment
|
||||
run: env
|
||||
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Need full history so we calculate diffs
|
||||
fetch-depth: 0
|
||||
fetch-depth: 0 # Need full history for calculation of diffs
|
||||
- uses: ./.github/actions/release-initialise
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install dependencies
|
||||
# when the workflow has been manually triggered on main,
|
||||
# we know that we definitely want the release branch to exist
|
||||
- name: Ensure release branch exists
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install PyGithub==1.55 requests
|
||||
echo "MAJOR_VERSION ${MAJOR_VERSION}"
|
||||
RELEASE_BRANCH=releases/${MAJOR_VERSION}
|
||||
if git checkout $RELEASE_BRANCH > /dev/null 2>&1; then
|
||||
echo "Branch $RELEASE_BRANCH already exists"
|
||||
echo ""
|
||||
else
|
||||
echo "Creating $RELEASE_BRANCH branch"
|
||||
git checkout -b ${RELEASE_BRANCH} ${LATEST_TAG}
|
||||
git push --set-upstream origin ${RELEASE_BRANCH}
|
||||
git branch --show-current
|
||||
echo ""
|
||||
fi
|
||||
echo "Returning to branch: ${REF_NAME}"
|
||||
git checkout ${REF_NAME}
|
||||
|
||||
- name: Update git config
|
||||
run: |
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
|
||||
- name: Update release branch
|
||||
- name: Update current release branch
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo SOURCE_BRANCH=${REF_NAME}
|
||||
echo TARGET_BRANCH=releases/${MAJOR_VERSION}
|
||||
python .github/update-release-branch.py \
|
||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
||||
--repository-nwo ${{ github.repository }} \
|
||||
--source-branch '${{ env.REF_NAME }}' \
|
||||
--target-branch 'releases/${{ env.MAJOR_VERSION }}' \
|
||||
--is-primary-release \
|
||||
--conductor ${GITHUB_ACTOR}
|
||||
|
||||
backport:
|
||||
timeout-minutes: 45
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prepare]
|
||||
if: ${{ (github.event_name == 'push') && needs.prepare.outputs.backport_target_branches != '[]' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target_branch: ${{ fromJson(needs.prepare.outputs.backport_target_branches) }}
|
||||
env:
|
||||
SOURCE_BRANCH: ${{ needs.prepare.outputs.backport_source_branch }}
|
||||
TARGET_BRANCH: ${{ matrix.target_branch }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Need full history for calculation of diffs
|
||||
- uses: ./.github/actions/release-initialise
|
||||
|
||||
- name: Update older release branch
|
||||
run: |
|
||||
echo SOURCE_BRANCH=${SOURCE_BRANCH}
|
||||
echo TARGET_BRANCH=${TARGET_BRANCH}
|
||||
python .github/update-release-branch.py \
|
||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
||||
--repository-nwo ${{ github.repository }} \
|
||||
--source-branch ${SOURCE_BRANCH} \
|
||||
--target-branch ${TARGET_BRANCH} \
|
||||
--conductor ${GITHUB_ACTOR}
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.7"
|
||||
- name: Checkout CodeQL Action
|
||||
@@ -52,5 +52,13 @@ jobs:
|
||||
git add .
|
||||
git commit --message "Update supported GitHub Enterprise Server versions"
|
||||
git push origin update-supported-enterprise-server-versions
|
||||
gh pr create --fill --draft
|
||||
|
||||
body="This PR updates the list of supported GitHub Enterprise Server versions, either because a new "
|
||||
body+="version is about to be feature frozen, or because an old release has been deprecated.\n\n"
|
||||
body+="If an old release has been deprecated, please follow the instructions in CONTRIBUTING.md to "
|
||||
body+="deprecate the corresponding version of CodeQL."
|
||||
|
||||
gh pr create --draft \
|
||||
--title "Update supported GitHub Enterprise Server versions" \
|
||||
--body "$body"
|
||||
fi
|
||||
|
||||
@@ -17,8 +17,8 @@ def main():
|
||||
releases = json.loads(_RELEASE_FILE_PATH.read_text())
|
||||
|
||||
# Remove GHES version using a previous version numbering scheme.
|
||||
if "11.10.340" in releases:
|
||||
del releases["11.10.340"]
|
||||
if "11.10" in releases:
|
||||
del releases["11.10"]
|
||||
|
||||
oldest_supported_release = None
|
||||
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")
|
||||
|
||||
20
.pre-commit-config.yaml
Normal file
20
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: compile-ts
|
||||
name: Compile typescript
|
||||
files: \.[tj]s$
|
||||
language: system
|
||||
entry: npm run build
|
||||
pass_filenames: false
|
||||
- id: lint-ts
|
||||
name: Lint typescript code
|
||||
files: \.ts$
|
||||
language: system
|
||||
entry: npm run lint -- --fix
|
||||
- id: pr-checks-sync
|
||||
name: Synchronize PR check workflows
|
||||
files: ^.github/workflows/__.*\.yml$|^pr-checks
|
||||
language: system
|
||||
entry: python3 pr-checks/sync.py
|
||||
pass_filenames: false
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -12,5 +12,8 @@
|
||||
"git.ignoreLimitWarning": true,
|
||||
// Use the vendored TypeScript version to have a consistent development experience across
|
||||
// machines.
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
}
|
||||
|
||||
85
CHANGELOG.md
85
CHANGELOG.md
@@ -2,17 +2,100 @@
|
||||
|
||||
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
||||
|
||||
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]
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 3.22.11 - 13 Dec 2023
|
||||
|
||||
- [v3+ only] The CodeQL Action now runs on Node.js v20. [#2006](https://github.com/github/codeql-action/pull/2006)
|
||||
|
||||
## 2.22.10 - 12 Dec 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.15.4. [#2016](https://github.com/github/codeql-action/pull/2016)
|
||||
|
||||
## 2.22.9 - 07 Dec 2023
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 2.22.8 - 23 Nov 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.15.3. [#2001](https://github.com/github/codeql-action/pull/2001)
|
||||
|
||||
## 2.22.7 - 16 Nov 2023
|
||||
|
||||
- Add a deprecation warning for customers using CodeQL version 2.11.5 and earlier. These versions of CodeQL were discontinued on 8 November 2023 alongside GitHub Enterprise Server 3.7, and will be unsupported by CodeQL Action v2.23.0 and later. [#1993](https://github.com/github/codeql-action/pull/1993)
|
||||
- If you are using one of these versions, please update to CodeQL CLI version 2.11.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.10.5 and 2.11.5, you can replace `github/codeql-action/*@v2` by `github/codeql-action/*@v2.22.7` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
|
||||
|
||||
## 2.22.6 - 14 Nov 2023
|
||||
|
||||
- Customers running Python analysis on macOS using version 2.14.6 or earlier of the CodeQL CLI should upgrade to CodeQL CLI version 2.15.0 or later. If you do not wish to upgrade the CodeQL CLI, ensure that you are using Python version 3.11 or earlier, as CodeQL version 2.14.6 and earlier do not support Python 3.12. You can achieve this by adding a [`setup-python`](https://github.com/actions/setup-python) step to your code scanning workflow before the step that invokes `github/codeql-action/init`.
|
||||
- Update default CodeQL bundle version to 2.15.2. [#1978](https://github.com/github/codeql-action/pull/1978)
|
||||
|
||||
## 2.22.5 - 27 Oct 2023
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 2.22.4 - 20 Oct 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.15.1. [#1953](https://github.com/github/codeql-action/pull/1953)
|
||||
- Users will begin to see warnings on Node.js 16 deprecation in their Actions logs on code scanning runs starting October 23, 2023.
|
||||
- All code scanning workflows should continue to succeed regardless of the warning.
|
||||
- The team at GitHub maintaining the CodeQL Action is aware of the deprecation timeline and actively working on creating another version of the CodeQL Action, v3, that will bump us to Node 20.
|
||||
- For more information, and to communicate with the maintaining team, please use [this issue](https://github.com/github/codeql-action/issues/1959).
|
||||
|
||||
## 2.22.3 - 13 Oct 2023
|
||||
|
||||
- Provide an authentication token when downloading the CodeQL Bundle from the API of a GitHub Enterprise Server instance. [#1945](https://github.com/github/codeql-action/pull/1945)
|
||||
|
||||
## 2.22.2 - 12 Oct 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.15.0. [#1938](https://github.com/github/codeql-action/pull/1938)
|
||||
- Improve the log output when an error occurs in an invocation of the CodeQL CLI. [#1927](https://github.com/github/codeql-action/pull/1927)
|
||||
|
||||
## 2.22.1 - 09 Oct 2023
|
||||
|
||||
- Add a workaround for Python 3.12, which is not supported in CodeQL CLI version 2.14.6 or earlier. If you are running an analysis on Windows and using Python 3.12 or later, the CodeQL Action will switch to running Python 3.11. In this case, if Python 3.11 is not found, then the workflow will fail. [#1928](https://github.com/github/codeql-action/pull/1928)
|
||||
|
||||
## 2.22.0 - 06 Oct 2023
|
||||
|
||||
- The CodeQL Action now requires CodeQL version 2.10.5 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.21.8. [#1907](https://github.com/github/codeql-action/pull/1907)
|
||||
- The CodeQL Action no longer runs ML-powered queries. For more information, including details on our investment in AI-powered security technology, see ["CodeQL code scanning deprecates ML-powered alerts."](https://github.blog/changelog/2023-09-29-codeql-code-scanning-deprecates-ml-powered-alerts/) [#1910](https://github.com/github/codeql-action/pull/1910)
|
||||
- Fix a bug which prevented tracing of projects using Go 1.21 and above on Linux. [#1909](https://github.com/github/codeql-action/pull/1909)
|
||||
|
||||
## 2.21.9 - 27 Sep 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.14.6. [#1897](https://github.com/github/codeql-action/pull/1897)
|
||||
- We are rolling out a feature in October 2023 that will improve the success rate of C/C++ autobuild. [#1889](https://github.com/github/codeql-action/pull/1889)
|
||||
- We are rolling out a feature in October 2023 that will provide specific file coverage information for C and C++, Java and Kotlin, and JavaScript and TypeScript. Currently file coverage information for each of these pairs of languages is grouped together. [#1903](https://github.com/github/codeql-action/pull/1903)
|
||||
- Add a warning to help customers avoid inadvertently analyzing the same CodeQL language in multiple matrix jobs. [#1901](https://github.com/github/codeql-action/pull/1901)
|
||||
|
||||
## 2.21.8 - 19 Sep 2023
|
||||
|
||||
- Add a deprecation warning for customers using CodeQL version 2.10.4 and earlier. These versions of CodeQL were discontinued on 12 September 2023 alongside GitHub Enterprise Server 3.6, and will be unsupported by the next minor release of the CodeQL Action. [#1884](https://github.com/github/codeql-action/pull/1884)
|
||||
- If you are using one of these versions, please update to CodeQL CLI version 2.10.5 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.9.5 and 2.10.4, you can replace `github/codeql-action/*@v2` by `github/codeql-action/*@v2.21.7` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
|
||||
- Enable the following language aliases when using CodeQL 2.14.4 and later: `c-cpp` for C/C++ analysis, `java-kotlin` for Java/Kotlin analysis, and `javascript-typescript` for JavaScript/TypeScript analysis. [#1883](https://github.com/github/codeql-action/pull/1883)
|
||||
|
||||
## 2.21.7 - 14 Sep 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.14.5. [#1882](https://github.com/github/codeql-action/pull/1882)
|
||||
|
||||
## 2.21.6 - 13 Sep 2023
|
||||
|
||||
- Better error message when there is a failure to determine the merge base of the code to analysis. [#1860](https://github.com/github/codeql-action/pull/1860)
|
||||
- Improve the calculation of default amount of RAM used for query execution on GitHub Enterprise Server. This now reduces in proportion to the runner's total memory to better account for system memory usage, helping to avoid out-of-memory failures on larger runners. This feature is already available to GitHub.com users. [#1866](https://github.com/github/codeql-action/pull/1866)
|
||||
- Enable improved file coverage information for GitHub Enterprise Server users. This feature is already available to GitHub.com users. [#1867](https://github.com/github/codeql-action/pull/1867)
|
||||
- Update default CodeQL bundle version to 2.14.4. [#1873](https://github.com/github/codeql-action/pull/1873)
|
||||
|
||||
## 2.21.5 - 28 Aug 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.14.3. [#1845](https://github.com/github/codeql-action/pull/1845)
|
||||
- Fixed a bug in CodeQL Action 2.21.3 onwards that affected beta support for [Project Lombok](https://projectlombok.org/) when analyzing Java. The environment variable `CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS` will now be respected if it was manually configured in the workflow. [#1844](https://github.com/github/codeql-action/pull/1844)
|
||||
- Enable support for Kotlin 1.9.20 when running with CodeQL CLI v2.13.4 through v2.14.3. [#1853](https://github.com/github/codeql-action/pull/1853)
|
||||
- Better error message when there is a failure to determine the merge base of the code to analysis. [#1860](https://github.com/github/codeql-action/pull/1860)
|
||||
|
||||
## 2.21.4 - 14 Aug 2023
|
||||
|
||||
|
||||
@@ -72,11 +72,49 @@ Once the mergeback has been merged to `main`, the release is complete.
|
||||
|
||||
## Keeping the PR checks up to date (admin access required)
|
||||
|
||||
Since the `codeql-action` runs most of its testing through individual Actions workflows, there are over two hundred jobs that need to pass in order for a PR to turn green. You can regenerate the checks automatically by running the [update-required-checks.sh](.github/workflows/script/update-required-checks.sh) script:
|
||||
Since the `codeql-action` runs most of its testing through individual Actions workflows, there are over two hundred jobs that need to pass in order for a PR to turn green. You can regenerate the required checks automatically by running the [update-required-checks.sh](.github/workflows/script/update-required-checks.sh) script:
|
||||
|
||||
1. By default, this script retrieves the checks from the latest SHA on `main`, so make sure that your `main` branch is up to date.
|
||||
2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument.
|
||||
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated.
|
||||
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v2`, and `v2` have been updated.
|
||||
|
||||
Note that the `update-required-checks.sh` script should be updated when there are new diversions between the checks on different release branches.
|
||||
|
||||
## Deprecating a CodeQL version (write access required)
|
||||
|
||||
We typically deprecate a version of CodeQL when the GitHub Enterprise Server (GHES) version that it first shipped in is deprecated.
|
||||
|
||||
1. Work out the next minimum version of CodeQL. This is the version that shipped in the version of GHES after the one that has just been deprecated.
|
||||
1. Notify users using the old version of CodeQL about the deprecation.
|
||||
- Update `CODEQL_NEXT_MINIMUM_VERSION`, `GHES_VERSION_MOST_RECENTLY_DEPRECATED`, and `GHES_MOST_RECENT_DEPRECATION_DATE` in `src/codeql.ts` to reflect the new minimum version of CodeQL and the GHES version that has just been deprecated.
|
||||
- Add a changelog note announcing the deprecation.
|
||||
- Example PR: https://github.com/github/codeql-action/pull/1884
|
||||
1. Release the Action, or wait for the next scheduled release of the Action, then wait at least a week so users have time to see and act on the deprecation warning.
|
||||
1. Remove support for the old version of CodeQL.
|
||||
- Bump `CODEQL_MINIMUM_VERSION` in `src/codeql.ts` to the new minimum version of CodeQL.
|
||||
- Remove any code that is only needed to support the old version of CodeQL. This is often behind a version guard, so look for instances of version numbers between the old minimum version and the new minimum version in the codebase. A good place to start is the list of version numbers in `src/codeql.ts`.
|
||||
- Update the default set of CodeQL test versions in `pr-checks/sync.py`.
|
||||
- Remove the old minimum version of CodeQL.
|
||||
- Add the latest patch release for any new CodeQL minor version series that have shipped in GHES.
|
||||
- Run the script to update the generated PR checks.
|
||||
- Do the same for PR checks that aren't auto-generated.
|
||||
- Add a changelog note announcing the new minimum version of CodeQL that is now required.
|
||||
- Example PR: https://github.com/github/codeql-action/pull/1907
|
||||
|
||||
## Deprecating a CodeQL Action version (write access required)
|
||||
|
||||
We sometimes maintain multiple versions of the CodeQL Action to enable customers on older but still supported versions of GitHub Enterprise Server (GHES) to continue to benefit from the latest CodeQL improvements. To accomplish this, the release process automation listens to updates to the release branch for the newest supported version. When this branch is updated, the release process automatically opens backport PRs to update the release branches for older versions.
|
||||
|
||||
We typically deprecate older versions of the Action once all supported GHES versions are compatible with the version of Node.js we are using on `main`.
|
||||
|
||||
To deprecate an older version of the Action:
|
||||
|
||||
1. Notify any users who are still pinned to the `vN` tag of the deprecated version of the Action, giving as much notice as is practical.
|
||||
- Add a changelog note announcing the deprecation.
|
||||
- Implement an Actions warning for customers using the deprecated version.
|
||||
1. Wait for the deprecation period to pass.
|
||||
1. Upgrade the Actions warning for customers using the deprecated version to a non-fatal error, and mention that this version of the Action is no longer supported.
|
||||
1. Make a PR to bump the `OLDEST_SUPPORTED_MAJOR_VERSION` in [release-branches.py](.github/actions/release-branches/release-branches.py). Once this PR is merged, the release process will no longer backport changes to the deprecated release version.
|
||||
|
||||
## Resources
|
||||
|
||||
|
||||
@@ -4,6 +4,15 @@ This action runs GitHub's industry-leading semantic code analysis engine, [CodeQ
|
||||
|
||||
For a list of recent changes, see the CodeQL Action's [changelog](CHANGELOG.md).
|
||||
|
||||
## :loudspeaker: Node 16 deprecation, upcoming CodeQL Action v3 :loudspeaker:
|
||||
Announcement for users of this Action and code scanning workflows on GitHub.com:
|
||||
|
||||
- You will begin to see these warnings about Node.js 16 deprecation in your Actions logs on code scanning runs starting October 23, 2023.
|
||||
- All code scanning workflows should continue to succeed regardless of the warning.
|
||||
- The team at GitHub maintaining the CodeQL Action is aware of the deprecation timeline and actively working on creating another version of the CodeQL Action, v3, that will bump us to Node 20.
|
||||
|
||||
For more information, and to communicate with the maintaining team, please use [this issue](https://github.com/github/codeql-action/issues/1959).
|
||||
|
||||
## License
|
||||
|
||||
This project is released under the [MIT License](LICENSE).
|
||||
|
||||
@@ -84,6 +84,6 @@ outputs:
|
||||
sarif-id:
|
||||
description: The ID of the uploaded SARIF file.
|
||||
runs:
|
||||
using: "node16"
|
||||
using: node20
|
||||
main: "../lib/analyze-action.js"
|
||||
post: "../lib/analyze-action-post.js"
|
||||
|
||||
@@ -13,5 +13,5 @@ inputs:
|
||||
$GITHUB_WORKSPACE as its working directory.
|
||||
required: false
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: node20
|
||||
main: '../lib/autobuild-action.js'
|
||||
|
||||
@@ -7,7 +7,8 @@ inputs:
|
||||
required: false
|
||||
# If not specified the Action will check in several places until it finds the CodeQL tools.
|
||||
languages:
|
||||
description: The languages to be analysed
|
||||
description: |
|
||||
A comma-separated value of the languages to be analysed e.g. python,javascript
|
||||
required: false
|
||||
token:
|
||||
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
|
||||
@@ -44,7 +45,7 @@ inputs:
|
||||
db-location:
|
||||
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
|
||||
required: false
|
||||
config:
|
||||
config:
|
||||
description: Configuration passed as a YAML string in the same format as the config-file input. This takes precedence over the config-file input.
|
||||
required: false
|
||||
queries:
|
||||
@@ -108,6 +109,6 @@ outputs:
|
||||
codeql-path:
|
||||
description: The path of the CodeQL binary used for analysis
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: node20
|
||||
main: '../lib/init-action.js'
|
||||
post: '../lib/init-action-post.js'
|
||||
|
||||
34
lib/actions-util.js
generated
34
lib/actions-util.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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.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 path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
@@ -177,7 +177,7 @@ async function getRef() {
|
||||
const hasShaInput = !!shaInput;
|
||||
// If one of 'ref' or 'sha' are provided, both are required
|
||||
if ((hasRefInput || hasShaInput) && !(hasRefInput && hasShaInput)) {
|
||||
throw new Error("Both 'ref' and 'sha' are required if one of them is provided.");
|
||||
throw new util_1.UserError("Both 'ref' and 'sha' are required if one of them is provided.");
|
||||
}
|
||||
const ref = refInput || getRefFromEnv();
|
||||
const sha = shaInput || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||
@@ -380,4 +380,34 @@ function getWorkflowRunAttempt() {
|
||||
return workflowRunAttempt;
|
||||
}
|
||||
exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
const getFileType = async (filePath) => {
|
||||
let stderr = "";
|
||||
let stdout = "";
|
||||
try {
|
||||
// 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.
|
||||
// The `-L` switch instructs the command to follow symbolic links.
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", filePath], {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
stdout += data.toString();
|
||||
},
|
||||
stderr: (data) => {
|
||||
stderr += data.toString();
|
||||
},
|
||||
},
|
||||
}).exec();
|
||||
return stdout.trim();
|
||||
}
|
||||
catch (e) {
|
||||
core.info(`Could not determine type of ${filePath} from ${stdout}. ${stderr}`);
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
exports.getFileType = getFileType;
|
||||
//# sourceMappingURL=actions-util.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":3,"file":"analysis-paths.js","sourceRoot":"","sources":["../src/analysis-paths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAK7B,SAAS,qBAAqB,CAAC,QAAQ;IACrC,OAAO,CACL,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,MAAM,CAC1E,CAAC;AACJ,CAAC;AAED,6FAA6F;AAChF,QAAA,+BAA+B,GAAG,cA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B,GAAE,CAAC;IAElC,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;KACH;IAED,+CAA+C;IAC/C,IAAI,MAAM,EAAE,SAAS,EAAE;QACrB,IAAI,CAAC,IAAI,CACP,oFAAoF,CACrF,CAAC;QACF,MAAM,SAAS,GAAG,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;KACnD;AACH,CAAC;AAlBD,kBAkBC"}
|
||||
{"version":3,"file":"analyze-action-post-helper.js","sourceRoot":"","sources":["../src/analyze-action-post-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,iDAA2C;AAC3C,uCAA6C;AAEtC,KAAK,UAAU,GAAG,CAAC,wBAAkC;IAC1D,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,IAAI,MAAM,EAAE,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CACP,oFAAoF,CACrF,CAAC;QACF,MAAM,SAAS,GAAG,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAlBD,kBAkBC"}
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,sFAAwE;AACxE,kEAAoD;AACpD,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;KAC5E;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;KACH;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,sFAAwE;AACxE,kEAAoD;AACpD,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;IAC7E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
32
lib/analyze-action.js
generated
32
lib/analyze-action.js
generated
@@ -31,6 +31,7 @@ const fs = __importStar(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const analyze_1 = require("./analyze");
|
||||
const api_client_1 = require("./api-client");
|
||||
@@ -38,6 +39,7 @@ const autobuild_1 = require("./autobuild");
|
||||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const database_upload_1 = require("./database-upload");
|
||||
const diagnostics_1 = require("./diagnostics");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
@@ -54,11 +56,6 @@ async function sendStatusReport(startedAt, config, stats, error, trapCacheUpload
|
||||
const statusReportBase = await (0, status_report_1.createStatusReportBase)("finish", status, startedAt, await util.checkDiskUsage(), error?.message, error?.stack);
|
||||
const report = {
|
||||
...statusReportBase,
|
||||
...(config
|
||||
? {
|
||||
ml_powered_javascript_queries: (0, config_utils_1.getMlPoweredJsQueriesStatus)(config),
|
||||
}
|
||||
: {}),
|
||||
...(stats || {}),
|
||||
...(dbCreationTimings || {}),
|
||||
};
|
||||
@@ -163,7 +160,30 @@ async function run() {
|
||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]);
|
||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
|
||||
// Check that `which go` still points at the same path it did when the `init` Action ran to ensure that no steps
|
||||
// in-between performed any setup. We encourage users to perform all setup tasks before initializing CodeQL so that
|
||||
// the setup tasks do not interfere with our analysis.
|
||||
// Furthermore, if we installed a wrapper script in the `init` Action, we need to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes precedence in the PATH,
|
||||
// thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goInitPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
|
||||
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined) {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
core.warning(`Expected \`which go\` to return ${goInitPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
|
||||
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
|
||||
markdownMessage: "To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
}));
|
||||
}
|
||||
}
|
||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
|
||||
File diff suppressed because one or more lines are too long
15
lib/analyze.js
generated
15
lib/analyze.js
generated
@@ -41,6 +41,7 @@ const languages_1 = require("./languages");
|
||||
const tracer_config_1 = require("./tracer-config");
|
||||
const upload_lib_1 = require("./upload-lib");
|
||||
const util = __importStar(require("./util"));
|
||||
const util_1 = require("./util");
|
||||
class CodeQLAnalysisError extends Error {
|
||||
constructor(queriesStatusReport, message) {
|
||||
super(message);
|
||||
@@ -173,7 +174,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
if (!hasBuiltinQueries &&
|
||||
!hasCustomQueries &&
|
||||
!hasPackWithCustomQueries) {
|
||||
throw new Error(`Unable to analyze ${language} as no queries were selected for this language`);
|
||||
throw new util_1.UserError(`Unable to analyze ${language} as no queries were selected for this language`);
|
||||
}
|
||||
const customQueryIndices = [];
|
||||
for (let i = 0; i < queries.custom.length; ++i) {
|
||||
@@ -232,17 +233,13 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
}
|
||||
statusReport["event_reports"].push(perQueryAlertCountEventReport);
|
||||
}
|
||||
if (!(await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, codeql))) {
|
||||
if (!(await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_ANALYSIS_SUMMARY_V2))) {
|
||||
await runPrintLinesOfCode(language);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
logger.info(String(e));
|
||||
if (e instanceof Error) {
|
||||
logger.info(e.stack);
|
||||
}
|
||||
statusReport.analyze_failure_language = language;
|
||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${e}`);
|
||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${util.wrapError(e).message}`);
|
||||
}
|
||||
}
|
||||
return statusReport;
|
||||
@@ -359,7 +356,7 @@ function validateQueryFilters(queryFilters) {
|
||||
return [];
|
||||
}
|
||||
if (!Array.isArray(queryFilters)) {
|
||||
throw new Error(`Query filters must be an array of "include" or "exclude" entries. Found ${typeof queryFilters}`);
|
||||
throw new util_1.UserError(`Query filters must be an array of "include" or "exclude" entries. Found ${typeof queryFilters}`);
|
||||
}
|
||||
const errors = [];
|
||||
for (const qf of queryFilters) {
|
||||
@@ -372,7 +369,7 @@ function validateQueryFilters(queryFilters) {
|
||||
}
|
||||
}
|
||||
if (errors.length) {
|
||||
throw new Error(`Invalid query filter.\n${errors.join("\n")}`);
|
||||
throw new util_1.UserError(`Invalid query filter.\n${errors.join("\n")}`);
|
||||
}
|
||||
return queryFilters;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/analyze.test.js
generated
4
lib/analyze.test.js
generated
@@ -122,7 +122,6 @@ const util = __importStar(require("./util"));
|
||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: {
|
||||
injectedMlQueries: false,
|
||||
packsInputCombines: false,
|
||||
queriesInputCombines: false,
|
||||
},
|
||||
@@ -215,7 +214,7 @@ const util = __importStar(require("./util"));
|
||||
});
|
||||
function mockCodeQL() {
|
||||
return {
|
||||
getVersion: async () => "2.12.2",
|
||||
getVersion: async () => (0, testing_utils_1.makeVersionInfo)("1.0.0"),
|
||||
databaseRunQueries: sinon.spy(),
|
||||
databaseInterpretResults: async () => "",
|
||||
databasePrintBaseline: async () => "",
|
||||
@@ -239,7 +238,6 @@ function createBaseConfig(tmpDir) {
|
||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: {
|
||||
injectedMlQueries: false,
|
||||
packsInputCombines: false,
|
||||
queriesInputCombines: false,
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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,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C;gBAC7C,YAAY,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArBD,kDAqBC"}
|
||||
@@ -1 +1 @@
|
||||
{ "maximumVersion": "3.11", "minimumVersion": "3.6" }
|
||||
{ "maximumVersion": "3.12", "minimumVersion": "3.7" }
|
||||
|
||||
5
lib/autobuild-action.js
generated
5
lib/autobuild-action.js
generated
@@ -28,8 +28,6 @@ const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const autobuild_1 = require("./autobuild");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const environment_1 = require("./environment");
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const status_report_1 = require("./status-report");
|
||||
const util_1 = require("./util");
|
||||
@@ -69,9 +67,6 @@ async function run() {
|
||||
for (const language of languages) {
|
||||
currentLanguage = language;
|
||||
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
||||
if (language === languages_1.Language.go) {
|
||||
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAC9C,+CAAuC;AACvC,2CAAuC;AACvC,uCAAqD;AACrD,mDAKyB;AACzB,iCAKgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,gCAAgB,E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,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"}
|
||||
68
lib/autobuild.js
generated
68
lib/autobuild.js
generated
@@ -1,8 +1,38 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const repository_1 = require("./repository");
|
||||
const util_1 = require("./util");
|
||||
async function determineAutobuildLanguages(config, logger) {
|
||||
// Attempt to find a language to autobuild
|
||||
// We want pick the dominant language in the repo from the ones we're able to build
|
||||
@@ -21,11 +51,11 @@ async function determineAutobuildLanguages(config, logger) {
|
||||
* For example, consider a user with the following workflow file:
|
||||
*
|
||||
* ```yml
|
||||
* - uses: github/codeql-action/init@v2
|
||||
* - uses: github/codeql-action/init@v3
|
||||
* with:
|
||||
* languages: go, java
|
||||
* - uses: github/codeql-action/autobuild@v2
|
||||
* - uses: github/codeql-action/analyze@v2
|
||||
* - uses: github/codeql-action/autobuild@v3
|
||||
* - uses: github/codeql-action/analyze@v3
|
||||
* ```
|
||||
*
|
||||
* - With Go extraction disabled, we will run the Java autobuilder in the
|
||||
@@ -70,10 +100,42 @@ async function determineAutobuildLanguages(config, logger) {
|
||||
return languages;
|
||||
}
|
||||
exports.determineAutobuildLanguages = determineAutobuildLanguages;
|
||||
async function setupCppAutobuild(codeql, logger) {
|
||||
const envVar = feature_flags_1.featureConfig[feature_flags_1.Feature.CppDependencyInstallation].envVar;
|
||||
const featureName = "C++ automatic installation of dependencies";
|
||||
const envDoc = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow";
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
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);
|
||||
if (await features.getValue(feature_flags_1.Feature.CppDependencyInstallation, codeql)) {
|
||||
// disable autoinstall on self-hosted runners unless explicitly requested
|
||||
if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
|
||||
process.env[envVar] !== "true") {
|
||||
logger.info(`Disabling ${featureName} as we are on a self-hosted runner.${(0, actions_util_1.getWorkflowEventName)() !== "dynamic"
|
||||
? ` To override this, set the ${envVar} environment variable to 'true' in your workflow (see ${envDoc}).`
|
||||
: ""}`);
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
else {
|
||||
logger.info(`Enabling ${featureName}. This can be disabled by setting the ${envVar} environment variable to 'false' (see ${envDoc}).`);
|
||||
core.exportVariable(envVar, "true");
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.info(`Disabling ${featureName}.`);
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
}
|
||||
async function runAutobuild(language, config, logger) {
|
||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
if (language === languages_1.Language.cpp) {
|
||||
await setupCppAutobuild(codeQL, logger);
|
||||
}
|
||||
await codeQL.runAutobuild(language);
|
||||
if (language === languages_1.Language.go) {
|
||||
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
||||
}
|
||||
logger.endGroup();
|
||||
}
|
||||
exports.runAutobuild = runAutobuild;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGlD,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACvD,IAAA,4BAAgB,EAAC,CAAC,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,oBAAQ,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8B,MAAM,yDAAyD,MAAM,IAAI;gBACzG,CAAC,CAAC,EACN,EAAE,CACH,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CACT,YAAY,WAAW,yCAAyC,MAAM,yCAAyC,MAAM,IAAI,CAC1H,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,aAAa,WAAW,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,oBAAQ,CAAC,GAAG,EAAE,CAAC;QAC9B,MAAM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,QAAQ,KAAK,oBAAQ,CAAC,EAAE,EAAE,CAAC;QAC7B,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAfD,oCAeC"}
|
||||
179
lib/codeql.js
generated
179
lib/codeql.js
generated
@@ -23,12 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
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_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = 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 = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_EXPORT_FAILED_SARIF = exports.CommandInvocationError = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
@@ -37,15 +38,25 @@ const setupCodeql = __importStar(require("./setup-codeql"));
|
||||
const util = __importStar(require("./util"));
|
||||
const util_1 = require("./util");
|
||||
class CommandInvocationError extends Error {
|
||||
constructor(cmd, args, exitCode, error, output) {
|
||||
constructor(cmd, args, exitCode, stderr, stdout) {
|
||||
const prettyCommand = [cmd, ...args]
|
||||
.map((x) => (x.includes(" ") ? `'${x}'` : x))
|
||||
.join(" ");
|
||||
const fatalErrors = extractFatalErrors(stderr);
|
||||
const lastLine = stderr.trim().split("\n").pop()?.trim();
|
||||
let error = fatalErrors
|
||||
? ` and error was: ${fatalErrors.trim()}`
|
||||
: lastLine
|
||||
? ` and last log line was: ${lastLine}`
|
||||
: "";
|
||||
if (error[error.length - 1] !== ".") {
|
||||
error += ".";
|
||||
}
|
||||
super(`Encountered a fatal error while running "${prettyCommand}". ` +
|
||||
`Exit code was ${exitCode} and error was: ${error.trim()}`);
|
||||
`Exit code was ${exitCode}${error} See the logs for more details.`);
|
||||
this.exitCode = exitCode;
|
||||
this.error = error;
|
||||
this.output = output;
|
||||
this.stderr = stderr;
|
||||
this.stdout = stdout;
|
||||
}
|
||||
}
|
||||
exports.CommandInvocationError = CommandInvocationError;
|
||||
@@ -62,25 +73,30 @@ let cachedCodeQL = undefined;
|
||||
* The version flags below can be used to conditionally enable certain features
|
||||
* on versions newer than this.
|
||||
*/
|
||||
const CODEQL_MINIMUM_VERSION = "2.9.4";
|
||||
const CODEQL_MINIMUM_VERSION = "2.10.5";
|
||||
/**
|
||||
* This version will shortly become the oldest version of CodeQL that the Action will run with.
|
||||
*/
|
||||
const CODEQL_NEXT_MINIMUM_VERSION = "2.9.4";
|
||||
const CODEQL_NEXT_MINIMUM_VERSION = "2.11.6";
|
||||
/**
|
||||
* This is the version of GHES that was most recently deprecated.
|
||||
*/
|
||||
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.7";
|
||||
/**
|
||||
* This is the deprecation date for the version of GHES that was most recently deprecated.
|
||||
*/
|
||||
const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-11-08";
|
||||
/*
|
||||
* Versions of CodeQL that version-flag certain functionality in the Action.
|
||||
* For convenience, please keep these in descending order. Once a version
|
||||
* flag is older than the oldest supported version above, it may be removed.
|
||||
*/
|
||||
const CODEQL_VERSION_LUA_TRACER_CONFIG = "2.10.0";
|
||||
const CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED = "2.10.4";
|
||||
exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = "2.10.4";
|
||||
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
||||
/**
|
||||
* Previous versions had the option already, but were missing the
|
||||
* --extractor-options-verbosity that we need.
|
||||
* Versions 2.11.3+ of the CodeQL CLI support exporting a failed SARIF file via
|
||||
* `codeql database export-diagnostics` or `codeql diagnostics export`.
|
||||
*/
|
||||
exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
|
||||
exports.CODEQL_VERSION_EXPORT_FAILED_SARIF = "2.11.3";
|
||||
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
||||
/**
|
||||
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
|
||||
* each language.
|
||||
@@ -112,6 +128,18 @@ exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
|
||||
* Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration.
|
||||
*/
|
||||
exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2";
|
||||
/**
|
||||
* Versions 2.14.4+ of the CodeQL CLI support language aliasing.
|
||||
*/
|
||||
exports.CODEQL_VERSION_LANGUAGE_ALIASING = "2.14.4";
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support new analysis summaries.
|
||||
*/
|
||||
exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.15.0";
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||
*/
|
||||
exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
|
||||
/**
|
||||
* Set up CodeQL CLI access.
|
||||
*
|
||||
@@ -133,7 +161,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
||||
codeqlCmd += ".exe";
|
||||
}
|
||||
else if (process.platform !== "linux" && process.platform !== "darwin") {
|
||||
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||
throw new util.UserError(`Unsupported platform: ${process.platform}`);
|
||||
}
|
||||
cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
|
||||
return {
|
||||
@@ -179,7 +207,9 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
|
||||
function setCodeQL(partialCodeql) {
|
||||
cachedCodeQL = {
|
||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))),
|
||||
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve({
|
||||
version: "1.0.0",
|
||||
}))),
|
||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||
@@ -241,7 +271,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
async getVersion() {
|
||||
let result = util.getCachedCodeQlVersion();
|
||||
if (result === undefined) {
|
||||
result = (await runTool(cmd, ["version", "--format=terse"])).trim();
|
||||
const output = await runTool(cmd, ["version", "--format=json"]);
|
||||
try {
|
||||
result = JSON.parse(output);
|
||||
}
|
||||
catch (err) {
|
||||
throw Error(`Invalid JSON output from \`version --format=json\`: ${output}`);
|
||||
}
|
||||
util.cacheCodeQlVersion(result);
|
||||
}
|
||||
return result;
|
||||
@@ -255,17 +291,6 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
extraArgs.push("--begin-tracing");
|
||||
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
|
||||
extraArgs.push(`--trace-process-name=${processName}`);
|
||||
if (
|
||||
// There's a bug in Lua tracing for Go on Windows in versions earlier than
|
||||
// `CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED`, so don't use Lua tracing
|
||||
// when tracing Go on Windows on these CodeQL versions.
|
||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)) &&
|
||||
config.languages.includes(languages_1.Language.go) &&
|
||||
(0, languages_1.isTracedLanguage)(languages_1.Language.go) &&
|
||||
process.platform === "win32" &&
|
||||
!(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED))) {
|
||||
extraArgs.push("--no-internal-use-lua-tracing");
|
||||
}
|
||||
}
|
||||
// A code scanning config file is only generated if the CliConfigFileEnabled feature flag is enabled.
|
||||
const codeScanningConfigFile = await generateCodeScanningConfig(codeql, config, features, logger);
|
||||
@@ -285,12 +310,19 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
||||
extraArgs.push("--calculate-language-specific-baseline");
|
||||
}
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
extraArgs.push("--sublanguage-file-coverage");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
extraArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
await runTool(cmd, [
|
||||
"database",
|
||||
"init",
|
||||
"--db-cluster",
|
||||
config.dbLocation,
|
||||
`--source-root=${sourceRoot}`,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...extraArgs,
|
||||
...getExtraOptionsFromEnv(["database", "init"]),
|
||||
], { stdin: externalRepositoryToken });
|
||||
@@ -324,19 +356,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
await runTool(autobuildCmd);
|
||||
},
|
||||
async extractScannedLanguage(config, language) {
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
// Set trace command
|
||||
const ext = process.platform === "win32" ? ".cmd" : ".sh";
|
||||
const traceCommand = path.resolve(await this.resolveExtractor(language), "tools", `autobuild${ext}`);
|
||||
// Run trace command
|
||||
await runTool(cmd, [
|
||||
"database",
|
||||
"trace-command",
|
||||
"--index-traceless-dbs",
|
||||
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
|
||||
...getExtraOptionsFromEnv(["database", "trace-command"]),
|
||||
databasePath,
|
||||
"--",
|
||||
traceCommand,
|
||||
util.getCodeQLDatabasePath(config, language),
|
||||
]);
|
||||
},
|
||||
async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
|
||||
@@ -383,6 +409,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"languages",
|
||||
"--format=betterjson",
|
||||
"--extractor-options-verbosity=4",
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...getExtraOptionsFromEnv(["resolve", "languages"]),
|
||||
];
|
||||
const output = await runTool(cmd, codeqlArgs);
|
||||
@@ -417,6 +444,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"resolve",
|
||||
"build-environment",
|
||||
`--language=${language}`,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
|
||||
];
|
||||
if (workingDir !== undefined) {
|
||||
@@ -436,7 +464,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"run-queries",
|
||||
...flags,
|
||||
databasePath,
|
||||
"--min-disk-free=1024",
|
||||
"--min-disk-free=1024", // Try to leave at least 1GB free
|
||||
"-v",
|
||||
...getExtraOptionsFromEnv(["database", "run-queries"]),
|
||||
];
|
||||
@@ -450,10 +478,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
if (querySuitePath) {
|
||||
codeqlArgs.push(querySuitePath);
|
||||
}
|
||||
if (await features.getValue(feature_flags_1.Feature.EvaluatorIntraLayerParallelismEnabled, this)) {
|
||||
if (await features.getValue(feature_flags_1.Feature.EvaluatorFineGrainedParallelismEnabled, this)) {
|
||||
codeqlArgs.push("--intra-layer-parallelism");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_INTRA_LAYER_PARALLELISM)) {
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_FINE_GRAINED_PARALLELISM)) {
|
||||
codeqlArgs.push("--no-intra-layer-parallelism");
|
||||
}
|
||||
await runTool(cmd, codeqlArgs);
|
||||
@@ -486,16 +514,27 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||
}
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
codeqlArgs.push("--sublanguage-file-coverage");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
codeqlArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
if (shouldExportDiagnostics) {
|
||||
codeqlArgs.push("--sarif-include-diagnostics");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, "2.12.4")) {
|
||||
codeqlArgs.push("--no-sarif-include-diagnostics");
|
||||
}
|
||||
if (await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, this)) {
|
||||
if (
|
||||
// Analysis summary v2 links to the status page, so check the GHES version we're running on
|
||||
// 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");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
|
||||
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
|
||||
codeqlArgs.push("--no-new-analysis-summary");
|
||||
}
|
||||
codeqlArgs.push(databasePath);
|
||||
@@ -595,10 +634,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"database",
|
||||
"export-diagnostics",
|
||||
`${databasePath}`,
|
||||
"--db-cluster",
|
||||
"--db-cluster", // Database is always a cluster for CodeQL versions that support diagnostics.
|
||||
"--format=sarif-latest",
|
||||
`--output=${codeqlOutputFile}`,
|
||||
"--sarif-include-diagnostics",
|
||||
"--sarif-include-diagnostics", // ExportDiagnosticsEnabled is always true if this command is run.
|
||||
"-vvv",
|
||||
...getExtraOptionsFromEnv(["diagnostics", "export"]),
|
||||
];
|
||||
@@ -634,6 +673,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"extractor",
|
||||
"--format=json",
|
||||
`--language=${language}`,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...getExtraOptionsFromEnv(["resolve", "extractor"]),
|
||||
], {
|
||||
silent: true,
|
||||
@@ -659,21 +699,23 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
// CodeQL object is created.
|
||||
if (checkVersion &&
|
||||
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
|
||||
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`);
|
||||
throw new util.UserError(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${(await codeql.getVersion()).version}`);
|
||||
}
|
||||
else if (checkVersion &&
|
||||
process.env[environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING] !== "true" &&
|
||||
!(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))) {
|
||||
core.warning(`CodeQL CLI version ${await codeql.getVersion()} was deprecated on 2023-06-20 alongside ` +
|
||||
"GitHub Enterprise Server 3.5 and will not be supported by the next release of the " +
|
||||
`CodeQL Action. Please update to CodeQL CLI version ${CODEQL_NEXT_MINIMUM_VERSION} 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.\n\n" +
|
||||
const result = await codeql.getVersion();
|
||||
core.warning(`CodeQL CLI version ${result.version} was discontinued on ` +
|
||||
`${GHES_MOST_RECENT_DEPRECATION_DATE} alongside GitHub Enterprise Server ` +
|
||||
`${GHES_VERSION_MOST_RECENTLY_DEPRECATED} and will not be supported by the next minor ` +
|
||||
`release of the CodeQL Action. Please update to CodeQL CLI version ` +
|
||||
`${CODEQL_NEXT_MINIMUM_VERSION} 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.\n\n" +
|
||||
"Alternatively, if you want to continue using CodeQL CLI version " +
|
||||
`${await codeql.getVersion()}, you can replace 'github/codeql-action/*@v2' by ` +
|
||||
"'github/codeql-action/*@v2.20.4' in your code scanning workflow to ensure you continue " +
|
||||
"using this version of the CodeQL Action.");
|
||||
`${result.version}, you can replace 'github/codeql-action/*@v3' by ` +
|
||||
`'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
|
||||
"continue using this version of the CodeQL Action.");
|
||||
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
|
||||
}
|
||||
return codeql;
|
||||
@@ -762,7 +804,6 @@ async function runTool(cmd, args = [], opts = {}) {
|
||||
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
||||
}).exec();
|
||||
if (exitCode !== 0) {
|
||||
error = extractFatalErrors(error) || error;
|
||||
throw new CommandInvocationError(cmd, args, exitCode, error, output);
|
||||
}
|
||||
return output;
|
||||
@@ -879,21 +920,6 @@ async function generateCodeScanningConfig(codeql, config, features, logger) {
|
||||
if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) {
|
||||
delete augmentedConfig.packs;
|
||||
}
|
||||
if (config.augmentationProperties.injectedMlQueries) {
|
||||
// We need to inject the ML queries into the original user input before
|
||||
// we pass this on to the CLI, to make sure these get run.
|
||||
const packString = await util.getMlPoweredJsQueriesPack(codeql);
|
||||
if (augmentedConfig.packs === undefined)
|
||||
augmentedConfig.packs = [];
|
||||
if (Array.isArray(augmentedConfig.packs)) {
|
||||
augmentedConfig.packs.push(packString);
|
||||
}
|
||||
else {
|
||||
if (!augmentedConfig.packs.javascript)
|
||||
augmentedConfig.packs["javascript"] = [];
|
||||
augmentedConfig.packs["javascript"].push(packString);
|
||||
}
|
||||
}
|
||||
logger.info(`Writing augmented user configuration file to ${codeScanningConfigFile}`);
|
||||
logger.startGroup("Augmented user configuration file contents");
|
||||
logger.info(yaml.dump(augmentedConfig));
|
||||
@@ -958,9 +984,22 @@ function isNoCodeFoundError(e) {
|
||||
* This can be removed once support for CodeQL 2.11.6 is removed.
|
||||
*/
|
||||
const javascriptNoCodeFoundWarning = "No JavaScript or TypeScript code found.";
|
||||
return e.exitCode === 32 || e.error.includes(javascriptNoCodeFoundWarning);
|
||||
return e.exitCode === 32 || e.stderr.includes(javascriptNoCodeFoundWarning);
|
||||
}
|
||||
async function isDiagnosticsExportInvalidSarifFixed(codeql) {
|
||||
return await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED);
|
||||
}
|
||||
async function getLanguageAliasingArguments(codeql) {
|
||||
if (await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||
return ["--extractor-include-aliases"];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
async function isSublanguageFileCoverageEnabled(config, codeql) {
|
||||
return (
|
||||
// Sub-language file coverage is first supported in GHES 3.12.
|
||||
(config.gitHubVersion.type !== util.GitHubVariant.GHES ||
|
||||
semver.gte(config.gitHubVersion.version, "3.12.0")) &&
|
||||
(await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)));
|
||||
}
|
||||
//# sourceMappingURL=codeql.js.map
|
||||
File diff suppressed because one or more lines are too long
141
lib/codeql.test.js
generated
141
lib/codeql.test.js
generated
@@ -73,7 +73,6 @@ ava_1.default.beforeEach(() => {
|
||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: {
|
||||
injectedMlQueries: false,
|
||||
packsInputCombines: false,
|
||||
queriesInputCombines: false,
|
||||
},
|
||||
@@ -378,14 +377,13 @@ for (const isBundleVersionInUrl of [true, false]) {
|
||||
await util.withTmpDir(async (tempDir) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("2.9.4");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.10.5"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
const thisStubConfig = {
|
||||
...stubConfig,
|
||||
tempDir,
|
||||
augmentationProperties: {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
},
|
||||
@@ -405,7 +403,8 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon
|
||||
.stub(codeqlObject, "getVersion")
|
||||
.resolves(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion);
|
||||
.resolves((0, testing_utils_1.makeVersionInfo)(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion ||
|
||||
"1.0.0"));
|
||||
const thisStubConfig = {
|
||||
...stubConfig,
|
||||
...configOverride,
|
||||
@@ -426,49 +425,10 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
title: (providedTitle = "") => `databaseInitCluster() injected config: ${providedTitle}`,
|
||||
});
|
||||
(0, ava_1.default)("basic", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
}, {}, {});
|
||||
(0, ava_1.default)("injected ML queries", injectedConfigMacro, {
|
||||
injectedMlQueries: true,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
}, {}, {
|
||||
packs: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
|
||||
});
|
||||
(0, ava_1.default)("injected ML queries with existing packs", injectedConfigMacro, {
|
||||
injectedMlQueries: true,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
}, {
|
||||
originalUserInput: {
|
||||
packs: { javascript: ["codeql/something-else"] },
|
||||
},
|
||||
}, {
|
||||
packs: {
|
||||
javascript: [
|
||||
"codeql/something-else",
|
||||
"codeql/javascript-experimental-atm-queries@~0.4.0",
|
||||
],
|
||||
},
|
||||
});
|
||||
(0, ava_1.default)("injected ML queries with existing packs of different language", injectedConfigMacro, {
|
||||
injectedMlQueries: true,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
}, {
|
||||
originalUserInput: {
|
||||
packs: { cpp: ["codeql/something-else"] },
|
||||
},
|
||||
}, {
|
||||
packs: {
|
||||
cpp: ["codeql/something-else"],
|
||||
javascript: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
|
||||
},
|
||||
});
|
||||
(0, ava_1.default)("injected packs from input", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
@@ -476,7 +436,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
packs: ["xxx", "yyy"],
|
||||
});
|
||||
(0, ava_1.default)("injected packs from input with existing packs combines", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: true,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
@@ -492,7 +451,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
},
|
||||
});
|
||||
(0, ava_1.default)("injected packs from input with existing packs overrides", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
@@ -505,23 +463,8 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
}, {
|
||||
packs: ["xxx", "yyy"],
|
||||
});
|
||||
(0, ava_1.default)("injected packs from input with existing packs overrides and ML model inject", injectedConfigMacro, {
|
||||
injectedMlQueries: true,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
}, {
|
||||
originalUserInput: {
|
||||
packs: {
|
||||
cpp: ["codeql/something-else"],
|
||||
},
|
||||
},
|
||||
}, {
|
||||
packs: ["xxx", "yyy", "codeql/javascript-experimental-atm-queries@~0.4.0"],
|
||||
});
|
||||
// similar, but with queries
|
||||
(0, ava_1.default)("injected queries from input", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
@@ -536,7 +479,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
],
|
||||
});
|
||||
(0, ava_1.default)("injected queries from input overrides", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
@@ -555,7 +497,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
],
|
||||
});
|
||||
(0, ava_1.default)("injected queries from input combines", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: true,
|
||||
packsInputCombines: false,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
@@ -577,7 +518,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
],
|
||||
});
|
||||
(0, ava_1.default)("injected queries from input combines 2", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: true,
|
||||
packsInputCombines: true,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
@@ -592,7 +532,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
],
|
||||
});
|
||||
(0, ava_1.default)("injected queries and packs, but empty", injectedConfigMacro, {
|
||||
injectedMlQueries: false,
|
||||
queriesInputCombines: true,
|
||||
packsInputCombines: true,
|
||||
queriesInput: [],
|
||||
@@ -608,7 +547,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
// stubbed version doesn't matter. It just needs to be valid semver.
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("0.0.0");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("0.0.0"));
|
||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
||||
const args = runnerConstructorStub.firstCall.args[1];
|
||||
// should not have used a config file
|
||||
@@ -625,7 +564,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon
|
||||
.stub(codeqlObject, "getVersion")
|
||||
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG);
|
||||
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
|
||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
||||
const args = runnerConstructorStub.firstCall.args[1];
|
||||
// should have used a config file
|
||||
@@ -640,7 +579,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
await util.withTmpDir(async (tempDir) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("2.12.2");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.2"));
|
||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
||||
const args = runnerConstructorStub.firstCall.args[1];
|
||||
// should have used a config file
|
||||
@@ -657,7 +596,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon
|
||||
.stub(codeqlObject, "getVersion")
|
||||
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG);
|
||||
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
|
||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), undefined, // undefined qlconfigFile
|
||||
(0, logging_1.getRunnerLogger)(true));
|
||||
const args = runnerConstructorStub.firstCall.args[1];
|
||||
@@ -668,7 +607,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
(0, ava_1.default)("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.3"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||
@@ -677,7 +616,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.2"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||
@@ -685,36 +624,54 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
});
|
||||
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
|
||||
{
|
||||
featureEnabled: true,
|
||||
codeqlVersion: "2.14.0",
|
||||
codeqlVersion: "2.15.0",
|
||||
githubVersion: {
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
flagPassed: true,
|
||||
negativeFlagPassed: false,
|
||||
},
|
||||
{
|
||||
featureEnabled: false,
|
||||
codeqlVersion: "2.14.0",
|
||||
codeqlVersion: "2.15.0",
|
||||
githubVersion: {
|
||||
type: util.GitHubVariant.GHES,
|
||||
version: "3.9.0",
|
||||
},
|
||||
flagPassed: true,
|
||||
negativeFlagPassed: false,
|
||||
},
|
||||
{
|
||||
codeqlVersion: "2.15.0",
|
||||
githubVersion: {
|
||||
type: util.GitHubVariant.GHES,
|
||||
version: "3.8.6",
|
||||
},
|
||||
flagPassed: false,
|
||||
negativeFlagPassed: true,
|
||||
},
|
||||
{
|
||||
featureEnabled: false,
|
||||
codeqlVersion: "2.13.5",
|
||||
codeqlVersion: "2.14.6",
|
||||
githubVersion: {
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
flagPassed: false,
|
||||
negativeFlagPassed: false,
|
||||
},
|
||||
];
|
||||
for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of NEW_ANALYSIS_SUMMARY_TEST_CASES) {
|
||||
for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of NEW_ANALYSIS_SUMMARY_TEST_CASES) {
|
||||
(0, ava_1.default)(`database interpret-results passes ${flagPassed
|
||||
? "--new-analysis-summary"
|
||||
: negativeFlagPassed
|
||||
? "--no-new-analysis-summary"
|
||||
: "nothing"} for CodeQL CLI v${codeqlVersion} when the new analysis summary feature is ${featureEnabled ? "enabled" : "disabled"}`, async (t) => {
|
||||
: "nothing"} for CodeQL CLI v${codeqlVersion} and ${util.GitHubVariant[githubVersion.type]} ${githubVersion.version ? ` ${githubVersion.version}` : ""}`, async (t) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
|
||||
sinon
|
||||
.stub(codeqlObject, "getVersion")
|
||||
.resolves((0, testing_utils_1.makeVersionInfo)(codeqlVersion));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.AnalysisSummaryV2Enabled] : []), (0, logging_1.getRunnerLogger)(true));
|
||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", Object.assign({}, stubConfig, { gitHubVersion: githubVersion }), (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||
t.is(runnerConstructorStub.firstCall.args[1].includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "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`);
|
||||
});
|
||||
@@ -725,7 +682,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
||||
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("2.11.6");
|
||||
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("", "", ""), {
|
||||
@@ -736,7 +693,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
||||
(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("2.11.6");
|
||||
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("", "", ""), {
|
||||
@@ -749,12 +706,12 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
||||
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.";
|
||||
stubToolRunnerConstructor(32, cliMessage);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("2.12.4");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
`Exit code was 32 and error was: ${cliMessage}`,
|
||||
`Exit code was 32 and last log line was: ${cliMessage} See the logs for more details.`,
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("runTool summarizes several fatal errors", async (t) => {
|
||||
@@ -764,12 +721,24 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
||||
`${heapError}\n${datasetImportError}.`;
|
||||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves("2.12.4");
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
`Exit code was 32 and error was: ${datasetImportError}. Context: ${heapError}.`,
|
||||
`Exit code was 32 and error was: ${datasetImportError}. Context: ${heapError}. See the logs for more details.`,
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("runTool outputs last line of stderr if fatal error could not be found", async (t) => {
|
||||
const cliStderr = "line1\nline2\nline3\nline4\nline5";
|
||||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
"Exit code was 32 and last log line was: line5. See the logs for more details.",
|
||||
});
|
||||
});
|
||||
function stubToolRunnerConstructor(exitCode = 0, stderr) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
131
lib/config-utils.js
generated
131
lib/config-utils.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.getMlPoweredJsQueriesStatus = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
|
||||
exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = 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.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
@@ -45,13 +45,12 @@ const PATHS_IGNORE_PROPERTY = "paths-ignore";
|
||||
const PATHS_PROPERTY = "paths";
|
||||
const PACKS_PROPERTY = "packs";
|
||||
/**
|
||||
* The default, empty augmentation properties. This is most useeful
|
||||
* The default, empty augmentation properties. This is most useful
|
||||
* for tests.
|
||||
*/
|
||||
exports.defaultAugmentationProperties = {
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
injectedMlQueries: false,
|
||||
packsInput: undefined,
|
||||
queriesInput: undefined,
|
||||
};
|
||||
@@ -139,10 +138,8 @@ const builtinSuites = [
|
||||
/**
|
||||
* Determine the set of queries associated with suiteName's suites and add them to resultMap.
|
||||
* Throws an error if suiteName is not a valid builtin suite.
|
||||
* May inject ML queries, and the return value will declare if this was done.
|
||||
*/
|
||||
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suiteName, features, configFile) {
|
||||
let injectedMlQueries = false;
|
||||
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, suiteName, configFile) {
|
||||
const found = builtinSuites.find((suite) => suite === suiteName);
|
||||
if (!found) {
|
||||
throw new util_1.UserError(getQueryUsesInvalid(configFile, suiteName));
|
||||
@@ -153,27 +150,8 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suite
|
||||
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}. Please upgrade to CodeQL CLI version
|
||||
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE} or later.`);
|
||||
}
|
||||
// If we're running the JavaScript security-extended analysis (or a superset of it), the repo is
|
||||
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
|
||||
// pack, then add the ML-powered query pack so that we run ML-powered queries.
|
||||
if (languages.includes("javascript") &&
|
||||
(found === "security-experimental" ||
|
||||
found === "security-extended" ||
|
||||
found === "security-and-quality") &&
|
||||
!packs.javascript?.some(isMlPoweredJsQueriesPack) &&
|
||||
(await features.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, codeQL))) {
|
||||
if (!packs.javascript) {
|
||||
packs.javascript = [];
|
||||
}
|
||||
packs.javascript.push(await (0, util_1.getMlPoweredJsQueriesPack)(codeQL));
|
||||
injectedMlQueries = true;
|
||||
}
|
||||
const suites = languages.map((l) => `${l}-${suiteName}.qls`);
|
||||
await runResolveQueries(codeQL, resultMap, suites, undefined);
|
||||
return injectedMlQueries;
|
||||
}
|
||||
function isMlPoweredJsQueriesPack(pack) {
|
||||
return parsePacksSpecification(pack).name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME;
|
||||
}
|
||||
/**
|
||||
* Retrieve the set of queries at localQueryPath and add them to resultMap.
|
||||
@@ -230,13 +208,8 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetail
|
||||
* parsing the 'uses' actions in the workflow file. So it can handle
|
||||
* local paths starting with './', or references to remote repos, or
|
||||
* a finite set of hardcoded terms for builtin suites.
|
||||
*
|
||||
* This may inject ML queries into the packs to use, and the return value will
|
||||
* declare if this was done.
|
||||
*
|
||||
* @returns whether or not we injected ML queries into the packs
|
||||
*/
|
||||
async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
|
||||
async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
|
||||
queryUses = queryUses.trim();
|
||||
if (queryUses === "") {
|
||||
throw new util_1.UserError(getQueryUsesInvalid(configFile));
|
||||
@@ -244,11 +217,12 @@ async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, te
|
||||
// Check for the local path case before we start trying to parse the repository name
|
||||
if (queryUses.startsWith("./")) {
|
||||
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
// Check for one of the builtin suites
|
||||
if (queryUses.indexOf("/") === -1 && queryUses.indexOf("@") === -1) {
|
||||
return await addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, queryUses, features, configFile);
|
||||
await addBuiltinSuiteQueries(languages, codeQL, resultMap, queryUses, configFile);
|
||||
return;
|
||||
}
|
||||
// Otherwise, must be a reference to another repo.
|
||||
// If config parsing is handled in CLI, then this repo will be downloaded
|
||||
@@ -256,7 +230,6 @@ async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, te
|
||||
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) {
|
||||
await addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Regex validating stars in paths or paths-ignore entries.
|
||||
// The intention is to only allow ** to appear when immediately
|
||||
@@ -395,7 +368,7 @@ function getNoLanguagesError() {
|
||||
}
|
||||
exports.getNoLanguagesError = getNoLanguagesError;
|
||||
function getUnknownLanguagesError(languages) {
|
||||
return `Did not recognise the following languages: ${languages.join(", ")}`;
|
||||
return `Did not recognize the following languages: ${languages.join(", ")}`;
|
||||
}
|
||||
exports.getUnknownLanguagesError = getUnknownLanguagesError;
|
||||
/**
|
||||
@@ -436,13 +409,20 @@ exports.getLanguagesInRepo = getLanguagesInRepo;
|
||||
async function getLanguages(codeQL, languagesInput, repository, logger) {
|
||||
// Obtain languages without filtering them.
|
||||
const { rawLanguages, autodetected } = await getRawLanguages(languagesInput, repository, logger);
|
||||
let languages = rawLanguages.map(languages_1.resolveAlias);
|
||||
let languages = rawLanguages;
|
||||
if (autodetected) {
|
||||
const availableLanguages = await codeQL.resolveLanguages();
|
||||
languages = languages.filter((value) => value in availableLanguages);
|
||||
const supportedLanguages = Object.keys(await codeQL.resolveLanguages());
|
||||
languages = languages
|
||||
.map(languages_1.parseLanguage)
|
||||
.filter((value) => value && supportedLanguages.includes(value))
|
||||
.map((value) => value);
|
||||
logger.info(`Automatically detected languages: ${languages.join(", ")}`);
|
||||
}
|
||||
else {
|
||||
const aliases = await getLanguageAliases(codeQL);
|
||||
if (aliases) {
|
||||
languages = languages.map((lang) => aliases[lang] || lang);
|
||||
}
|
||||
logger.info(`Languages from configuration: ${languages.join(", ")}`);
|
||||
}
|
||||
// If the languages parameter was not given and no languages were
|
||||
@@ -454,7 +434,6 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
|
||||
const parsedLanguages = [];
|
||||
const unknownLanguages = [];
|
||||
for (const language of languages) {
|
||||
// We know this is not an alias since we resolved it above.
|
||||
const parsedLanguage = (0, languages_1.parseLanguage)(language);
|
||||
if (parsedLanguage === undefined) {
|
||||
unknownLanguages.push(language);
|
||||
@@ -471,6 +450,17 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
|
||||
return parsedLanguages;
|
||||
}
|
||||
exports.getLanguages = getLanguages;
|
||||
/**
|
||||
* Gets the set of languages supported by CodeQL, along with their aliases if supported by the
|
||||
* version of the CLI.
|
||||
*/
|
||||
async function getLanguageAliases(codeql) {
|
||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||
return (await codeql.betterResolveLanguages()).aliases;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
exports.getLanguageAliases = getLanguageAliases;
|
||||
/**
|
||||
* Gets the set of languages in the current repository without checking to
|
||||
* see if these languages are actually supported by CodeQL.
|
||||
@@ -499,16 +489,13 @@ async function getRawLanguages(languagesInput, repository, logger) {
|
||||
return { rawLanguages, autodetected };
|
||||
}
|
||||
exports.getRawLanguages = getRawLanguages;
|
||||
async function addQueriesAndPacksFromWorkflow(codeQL, queriesInput, languages, resultMap, packs, tempDir, workspacePath, apiDetails, features, logger) {
|
||||
let injectedMlQueries = false;
|
||||
async function addQueriesFromWorkflow(codeQL, queriesInput, languages, resultMap, tempDir, workspacePath, apiDetails, features, logger) {
|
||||
queriesInput = queriesInput.trim();
|
||||
// "+" means "don't override config file" - see shouldAddConfigFileQueries
|
||||
queriesInput = queriesInput.replace(/^\+/, "");
|
||||
for (const query of queriesInput.split(",")) {
|
||||
const didInject = await parseQueryUses(languages, codeQL, resultMap, packs, query, tempDir, workspacePath, apiDetails, features, logger);
|
||||
injectedMlQueries = injectedMlQueries || didInject;
|
||||
await parseQueryUses(languages, codeQL, resultMap, query, tempDir, workspacePath, apiDetails, features, logger);
|
||||
}
|
||||
return injectedMlQueries;
|
||||
}
|
||||
// Returns true if either no queries were provided in the workflow.
|
||||
// or if the queries in the workflow were provided in "additive" mode,
|
||||
@@ -540,8 +527,7 @@ async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput,
|
||||
}
|
||||
: {};
|
||||
if (rawQueriesInput) {
|
||||
augmentationProperties.injectedMlQueries =
|
||||
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
|
||||
await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
|
||||
}
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
||||
return {
|
||||
@@ -624,8 +610,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
|
||||
// unless they're prefixed with "+", in which case they supplement those
|
||||
// in the config file.
|
||||
if (rawQueriesInput) {
|
||||
augmentationProperties.injectedMlQueries =
|
||||
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
|
||||
await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
|
||||
}
|
||||
if (shouldAddConfigFileQueries(rawQueriesInput) &&
|
||||
QUERIES_PROPERTY in parsedYAML) {
|
||||
@@ -637,7 +622,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
|
||||
if (typeof query[QUERIES_USES_PROPERTY] !== "string") {
|
||||
throw new util_1.UserError(getQueriesMissingUses(configFile));
|
||||
}
|
||||
await parseQueryUses(languages, codeQL, queries, packs, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
|
||||
await parseQueryUses(languages, codeQL, queries, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
|
||||
}
|
||||
}
|
||||
if (PATHS_IGNORE_PROPERTY in parsedYAML) {
|
||||
@@ -707,7 +692,6 @@ function calculateAugmentation(rawPacksInput, rawQueriesInput, languages) {
|
||||
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
||||
const queriesInput = parseQueriesFromInput(rawQueriesInput, queriesInputCombines);
|
||||
return {
|
||||
injectedMlQueries: false,
|
||||
packsInputCombines,
|
||||
packsInput: packsInput?.[languages[0]],
|
||||
queriesInput,
|
||||
@@ -915,46 +899,6 @@ function combinePacks(packs1, packs2) {
|
||||
}
|
||||
return packs;
|
||||
}
|
||||
/**
|
||||
* Get information about ML-powered JS queries to populate status reports with.
|
||||
*
|
||||
* This will be:
|
||||
*
|
||||
* - The version string if the analysis is using a single version of the ML-powered query pack.
|
||||
* - "latest" if the version string of the ML-powered query pack is undefined. This is unlikely to
|
||||
* occur in practice (see comment below).
|
||||
* - "false" if the analysis won't run any ML-powered JS queries.
|
||||
* - "other" in all other cases.
|
||||
*
|
||||
* Our goal of the status report here is to allow us to compare the occurrence of timeouts and other
|
||||
* errors with ML-powered queries turned on and off. We also want to be able to compare minor
|
||||
* version bumps caused by us bumping the version range of `ML_POWERED_JS_QUERIES_PACK` in a new
|
||||
* version of the CodeQL Action. For instance, we might want to compare the `~0.1.0` and `~0.0.2`
|
||||
* version strings.
|
||||
*
|
||||
* This function lives here rather than in `init-action.ts` so it's easier to test, since tests for
|
||||
* `init-action.ts` would each need to live in their own file. See `analyze-action-env.ts` for an
|
||||
* explanation as to why this is.
|
||||
*/
|
||||
function getMlPoweredJsQueriesStatus(config) {
|
||||
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
|
||||
.map((p) => parsePacksSpecification(p))
|
||||
.filter((pack) => pack.name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME && !pack.path);
|
||||
switch (mlPoweredJsQueryPacks.length) {
|
||||
case 1:
|
||||
// We should always specify an explicit version string in `getMlPoweredJsQueriesPack`,
|
||||
// otherwise we won't be able to make changes to the pack unless those changes are compatible
|
||||
// with each version of the CodeQL Action. Therefore in practice we should only hit the
|
||||
// `latest` case here when customers have explicitly added the ML-powered query pack to their
|
||||
// CodeQL config.
|
||||
return mlPoweredJsQueryPacks[0].version || "latest";
|
||||
case 0:
|
||||
return "false";
|
||||
default:
|
||||
return "other";
|
||||
}
|
||||
}
|
||||
exports.getMlPoweredJsQueriesStatus = getMlPoweredJsQueriesStatus;
|
||||
function dbLocationOrDefault(dbLocation, tempDir) {
|
||||
return dbLocation || path.resolve(tempDir, "codeql_databases");
|
||||
}
|
||||
@@ -1098,7 +1042,7 @@ async function getConfig(tempDir, logger) {
|
||||
exports.getConfig = getConfig;
|
||||
async function downloadPacks(codeQL, languages, packs, apiDetails, registriesInput, tempDir, logger) {
|
||||
// This code path is only used when config parsing occurs in the Action.
|
||||
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, codeQL, tempDir, logger);
|
||||
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, tempDir, logger);
|
||||
await wrapEnvironment({
|
||||
GITHUB_TOKEN: apiDetails.auth,
|
||||
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
|
||||
@@ -1138,14 +1082,11 @@ exports.downloadPacks = downloadPacks;
|
||||
* @returns The path to the generated `qlconfig.yml` file and the auth tokens to
|
||||
* use for each registry.
|
||||
*/
|
||||
async function generateRegistries(registriesInput, codeQL, tempDir, logger) {
|
||||
async function generateRegistries(registriesInput, tempDir, logger) {
|
||||
const registries = parseRegistries(registriesInput);
|
||||
let registriesAuthTokens;
|
||||
let qlconfigFile;
|
||||
if (registries) {
|
||||
if (!(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD))) {
|
||||
throw new util_1.UserError(`The 'registries' input is not supported on CodeQL CLI versions earlier than ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD}. Please upgrade to CodeQL CLI version ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD} or later.`);
|
||||
}
|
||||
// generate a qlconfig.yml file to hold the registry configs.
|
||||
const qlconfig = createRegistriesBlock(registries);
|
||||
qlconfigFile = path.join(tempDir, "qlconfig.yml");
|
||||
|
||||
File diff suppressed because one or more lines are too long
189
lib/config-utils.test.js
generated
189
lib/config-utils.test.js
generated
@@ -35,7 +35,6 @@ const sinon = __importStar(require("sinon"));
|
||||
const api = __importStar(require("./api-client"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
@@ -1062,66 +1061,6 @@ parseInputAndConfigErrorMacro.title = (providedTitle) => `Parse Packs input and
|
||||
(0, ava_1.default)("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], false, /multi-language analysis/);
|
||||
(0, ava_1.default)("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], true, /remove the '\+'/);
|
||||
(0, ava_1.default)("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], false, /"xxx" is not a valid pack/);
|
||||
const mlPoweredQueriesMacro = ava_1.default.macro({
|
||||
exec: async (t, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async getVersion() {
|
||||
return codeQLVersion;
|
||||
},
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
javascript: { "fake-query.ql": {} },
|
||||
},
|
||||
noDeclaredLanguage: {},
|
||||
multipleDeclaredLanguages: {},
|
||||
};
|
||||
},
|
||||
async packDownload() {
|
||||
return { packs: [] };
|
||||
},
|
||||
});
|
||||
const { packs } = await configUtils.initConfig("javascript", queriesInput, packsInput, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)(isMlPoweredQueriesEnabled ? [feature_flags_1.Feature.MlPoweredQueriesEnabled] : []), (0, logging_1.getRunnerLogger)(true));
|
||||
if (expectedVersionString !== undefined) {
|
||||
t.deepEqual(packs, {
|
||||
[languages_1.Language.javascript]: [
|
||||
`codeql/javascript-experimental-atm-queries@${expectedVersionString}`,
|
||||
],
|
||||
});
|
||||
}
|
||||
else {
|
||||
t.deepEqual(packs, {});
|
||||
}
|
||||
});
|
||||
},
|
||||
title: (_providedTitle, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => `ML-powered queries ${expectedVersionString !== undefined
|
||||
? `${expectedVersionString} are`
|
||||
: "aren't"} loaded for packs: ${packsInput}, queries: ${queriesInput} using CLI v${codeQLVersion} when feature is ${isMlPoweredQueriesEnabled ? "enabled" : "disabled"}`,
|
||||
});
|
||||
// macro, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString
|
||||
// Test that ML-powered queries aren't run when the feature is off.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", false, undefined, "security-extended", undefined);
|
||||
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
|
||||
// `security-extended`, `security-and-quality`, or `security-experimental` query suite.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", true, undefined, undefined, undefined);
|
||||
// Test that we don't inject an ML-powered query pack if the user has already specified one.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", "0.0.1");
|
||||
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-extended` on
|
||||
// CodeQL CLI 2.9.4+.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.4", true, undefined, "security-extended", "~0.3.0");
|
||||
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-and-quality` on
|
||||
// CodeQL CLI 2.9.4+.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.4", true, undefined, "security-and-quality", "~0.3.0");
|
||||
// Test that ML-powered queries ~0.4.0 are run on all platforms running `security-extended` on
|
||||
// CodeQL CLI 2.11.3+.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-extended", "~0.4.0");
|
||||
// Test that ML-powered queries ~0.4.0 are run on all platforms running `security-and-quality` on
|
||||
// CodeQL CLI 2.11.3+.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-and-quality", "~0.4.0");
|
||||
// Test that ML-powered queries are run on all platforms running `security-experimental` on CodeQL
|
||||
// CLI 2.12.1+.
|
||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.1", true, undefined, "security-experimental", "~0.4.0");
|
||||
const calculateAugmentationMacro = ava_1.default.macro({
|
||||
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedAugmentationProperties) => {
|
||||
const actualAugmentationProperties = configUtils.calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
||||
@@ -1134,35 +1073,30 @@ const calculateAugmentationMacro = ava_1.default.macro({
|
||||
queriesInput: undefined,
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
injectedMlQueries: false,
|
||||
});
|
||||
(0, ava_1.default)(calculateAugmentationMacro, "With queries", undefined, " a, b , c, d", [languages_1.Language.javascript], {
|
||||
queriesInputCombines: false,
|
||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
injectedMlQueries: false,
|
||||
});
|
||||
(0, ava_1.default)(calculateAugmentationMacro, "With queries combining", undefined, " + a, b , c, d ", [languages_1.Language.javascript], {
|
||||
queriesInputCombines: true,
|
||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
injectedMlQueries: false,
|
||||
});
|
||||
(0, ava_1.default)(calculateAugmentationMacro, "With packs", " codeql/a , codeql/b , codeql/c , codeql/d ", undefined, [languages_1.Language.javascript], {
|
||||
queriesInputCombines: false,
|
||||
queriesInput: undefined,
|
||||
packsInputCombines: false,
|
||||
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
||||
injectedMlQueries: false,
|
||||
});
|
||||
(0, ava_1.default)(calculateAugmentationMacro, "With packs combining", " + codeql/a, codeql/b, codeql/c, codeql/d", undefined, [languages_1.Language.javascript], {
|
||||
queriesInputCombines: false,
|
||||
queriesInput: undefined,
|
||||
packsInputCombines: true,
|
||||
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
||||
injectedMlQueries: false,
|
||||
});
|
||||
const calculateAugmentationErrorMacro = ava_1.default.macro({
|
||||
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedError) => {
|
||||
@@ -1243,7 +1177,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
||||
});
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
packDownload: packDownloadStub,
|
||||
getVersion: () => Promise.resolve("2.10.5"),
|
||||
getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.5")),
|
||||
});
|
||||
// packs are supplied for go, java, and python
|
||||
// analyzed languages are java, javascript, and python
|
||||
@@ -1267,33 +1201,6 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
||||
t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, undefined);
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("downloadPacks-with-registries fails on 2.10.3", async (t) => {
|
||||
// same thing, but this time include a registries block and
|
||||
// associated env vars
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
process.env.GITHUB_TOKEN = "not-a-token";
|
||||
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
|
||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||
const registriesInput = yaml.dump([
|
||||
{
|
||||
url: "http://ghcr.io",
|
||||
packages: ["codeql/*", "codeql-testing/*"],
|
||||
token: "not-a-token",
|
||||
},
|
||||
{
|
||||
url: "https://containers.GHEHOSTNAME1/v2/",
|
||||
packages: "semmle/*",
|
||||
token: "still-not-a-token",
|
||||
},
|
||||
]);
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
getVersion: () => Promise.resolve("2.10.3"),
|
||||
});
|
||||
await t.throwsAsync(async () => {
|
||||
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
|
||||
}, { instanceOf: Error }, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("downloadPacks-with-registries fails with invalid registries block", async (t) => {
|
||||
// same thing, but this time include a registries block and
|
||||
// associated env vars
|
||||
@@ -1314,42 +1221,18 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
||||
},
|
||||
]);
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
getVersion: () => Promise.resolve("2.10.4"),
|
||||
getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.4")),
|
||||
});
|
||||
await t.throwsAsync(async () => {
|
||||
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
|
||||
}, { instanceOf: Error }, "Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
|
||||
});
|
||||
});
|
||||
// the happy path for generateRegistries is already tested in downloadPacks.
|
||||
// these following tests are for the error cases and when nothing is generated.
|
||||
(0, ava_1.default)("no generateRegistries when CLI is too old", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const registriesInput = yaml.dump([
|
||||
{
|
||||
// no slash
|
||||
url: "http://ghcr.io",
|
||||
packages: ["codeql/*", "codeql-testing/*"],
|
||||
token: "not-a-token",
|
||||
},
|
||||
]);
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
// Accepted CLI versions are 2.10.4 or higher
|
||||
getVersion: () => Promise.resolve("2.10.3"),
|
||||
});
|
||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||
await t.throwsAsync(async () => await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger), undefined, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("no generateRegistries when registries is undefined", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const registriesInput = undefined;
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
// Accepted CLI versions are 2.10.4 or higher
|
||||
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
|
||||
});
|
||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger);
|
||||
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
|
||||
t.is(registriesAuthTokens, undefined);
|
||||
t.is(qlconfigFile, undefined);
|
||||
});
|
||||
@@ -1364,12 +1247,8 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
||||
token: "not-a-token",
|
||||
},
|
||||
]);
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
// Accepted CLI versions are 2.10.4 or higher
|
||||
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
|
||||
});
|
||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger);
|
||||
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
|
||||
t.is(registriesAuthTokens, "original");
|
||||
t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml"));
|
||||
});
|
||||
@@ -1456,64 +1335,4 @@ const mockRepositoryNwo = (0, repository_1.parseRepositoryNwo)("owner/repo");
|
||||
t.deepEqual(mockRequest.called, args.expectedApiCall);
|
||||
});
|
||||
});
|
||||
const ML_POWERED_JS_STATUS_TESTS = [
|
||||
// If no packs are loaded, status is false.
|
||||
[[], "false"],
|
||||
// If another pack is loaded but not the ML-powered query pack, status is false.
|
||||
[["some-other/pack"], "false"],
|
||||
// If the ML-powered query pack is loaded with a specific version, status is that version.
|
||||
[[`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
||||
// If the ML-powered query pack is loaded with a specific version and another pack is loaded, the
|
||||
// status is the version of the ML-powered query pack.
|
||||
[["some-other/pack", `${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
||||
// If the ML-powered query pack is loaded without a version, the status is "latest".
|
||||
[[util_1.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
||||
// If the ML-powered query pack is loaded with two different versions, the status is "other".
|
||||
[
|
||||
[
|
||||
`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.0.1`,
|
||||
`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.0.2`,
|
||||
],
|
||||
"other",
|
||||
],
|
||||
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
|
||||
// the status is "latest".
|
||||
[["some-other/pack", util_1.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
||||
];
|
||||
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
||||
const packDescriptions = `[${packs
|
||||
.map((pack) => JSON.stringify(pack))
|
||||
.join(", ")}]`;
|
||||
(0, ava_1.default)(`ML-powered JS queries status report is "${expectedStatus}" for packs = ${packDescriptions}`, (t) => {
|
||||
return (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const config = {
|
||||
languages: [],
|
||||
queries: {},
|
||||
paths: [],
|
||||
pathsIgnore: [],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
codeQLCmd: "",
|
||||
gitHubVersion: {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
},
|
||||
dbLocation: "",
|
||||
packs: {
|
||||
javascript: packs,
|
||||
},
|
||||
debugMode: false,
|
||||
debugArtifactName: util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: {
|
||||
injectedMlQueries: false,
|
||||
packsInputCombines: false,
|
||||
queriesInputCombines: false,
|
||||
},
|
||||
trapCaches: {},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
t.is(configUtils.getMlPoweredJsQueriesStatus(config), expectedStatus);
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=config-utils.test.js.map
|
||||
File diff suppressed because one or more lines are too long
4
lib/database-upload.js
generated
4
lib/database-upload.js
generated
@@ -56,12 +56,14 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
||||
const bundledDb = await (0, util_1.bundleDb)(config, language, codeql, language);
|
||||
const bundledDbSize = fs.statSync(bundledDb).size;
|
||||
const bundledDbReadStream = fs.createReadStream(bundledDb);
|
||||
const commitOid = await actionsUtil.getCommitOid(actionsUtil.getRequiredInput("checkout_path"));
|
||||
try {
|
||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`, {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
name: `${language}-database`,
|
||||
commit_oid: commitOid,
|
||||
data: bundledDbReadStream,
|
||||
headers: {
|
||||
authorization: `token ${apiDetails.auth}`,
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjE,OAAO;KACR;IAED,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,wBAAwB,EAAE,CAAC,EAAE;QACnD,4EAA4E;QAC5E,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,MAAM,MAAM,GAAG,IAAA,yBAAY,GAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAEjD,KAAK,MAAM,QAA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CAAC;gBACH,MAAM,MAAM,CAAC,OAAO,CAClB,+HAA+H,EAC/H;oBACE,KAAK,EAAE,aAAa,CAAC,KAAK;oBAC1B,IAAI,EAAE,aAAa,CAAC,IAAI;oBACxB,QAAQ;oBACR,IAAI,EAAE,GAAG,QAAQ,WAAW;oBAC5B,UAAU,EAAE,SAAS;oBACrB,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE;wBACP,aAAa,EAAE,SAAS,UAAU,CAAC,IAAI,EAAE;wBACzC,cAAc,EAAE,iBAAiB;wBACjC,gBAAgB,EAAE,aAAa;qBAChC;iBACF,CACF,CAAC;gBACF,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;YACjE,CAAC;oBAAS,CAAC;gBACT,mBAAmB,CAAC,KAAK,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,iCAAiC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,CAAC;AAjED,0CAiEC"}
|
||||
2
lib/database-upload.test.js
generated
2
lib/database-upload.test.js
generated
@@ -72,7 +72,7 @@ async function mockHttpRequests(databaseUploadStatusCode) {
|
||||
// Passing an auth token is required, so we just use a dummy value
|
||||
const client = github.getOctokit("123");
|
||||
const requestSpy = sinon.stub(client, "request");
|
||||
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name";
|
||||
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid";
|
||||
const databaseUploadSpy = requestSpy.withArgs(url);
|
||||
if (databaseUploadStatusCode < 300) {
|
||||
databaseUploadSpy.resolves(undefined);
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/debug-artifacts.js
generated
2
lib/debug-artifacts.js
generated
@@ -56,7 +56,7 @@ async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
|
||||
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
|
||||
}
|
||||
}
|
||||
await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir));
|
||||
await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), { continueOnError: true });
|
||||
}
|
||||
exports.uploadDebugArtifacts = uploadDebugArtifacts;
|
||||
async function uploadSarifDebugArtifact(config, outputDir) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user