Skip to content

Commit 54ada66

Browse files
authored
Merge branch 'main' into jeongsoolee09/a0-1-2_and_a0-1-4
2 parents c94a17b + 3319523 commit 54ada66

File tree

94 files changed

+1263
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1263
-162
lines changed

.codeqlmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "provide": [ "codeql_modules/*/.codeqlmanifest.json", "cpp/.codeqlmanifest.json", "c/.codeqlmanifest.json"] }
1+
{ "provide": [ "cpp/*/src/qlpack.yml", "cpp/*/test/qlpack.yml", "c/*/src/qlpack.yml", "c/*/test/qlpack.yml", "scripts/generate_modules/queries/qlpack.yml" ] }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Install CodeQL library pack dependencies
2+
description: |
3+
Downloads any necessary CodeQL library packs needed by packs in the repo.
4+
inputs:
5+
cli_path:
6+
description: |
7+
The path to the CodeQL CLI directory.
8+
required: false
9+
10+
mode:
11+
description: |
12+
The `--mode` option to `codeql pack install`.
13+
required: true
14+
default: verify
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Install CodeQL library packs
20+
shell: bash
21+
env:
22+
CODEQL_CLI: ${{ inputs.cli_path }}
23+
run: |
24+
PATH=$PATH:$CODEQL_CLI
25+
python scripts/install-packs.py --mode ${{ inputs.mode }}

.github/workflows/code-scanning-pack-gen.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ jobs:
5959
codeql-home: ${{ github.workspace }}/codeql_home
6060
add-to-path: false
6161

62+
- name: Install CodeQL packs
63+
uses: ./.github/actions/install-codeql-packs
64+
with:
65+
cli_path: ${{ github.workspace }}/codeql_home/codeql
66+
6267
- name: Checkout external help files
6368
continue-on-error: true
6469
id: checkout-external-help-files
@@ -82,8 +87,8 @@ jobs:
8287
run: |
8388
PATH=$PATH:$CODEQL_HOME/codeql
8489
85-
codeql query compile --search-path cpp --threads 0 cpp
86-
codeql query compile --search-path c --search-path cpp --threads 0 c
90+
codeql query compile --threads 0 cpp
91+
codeql query compile --threads 0 c
8792
8893
cd ..
8994
zip -r codeql-coding-standards/code-scanning-cpp-query-pack.zip codeql-coding-standards/c/ codeql-coding-standards/cpp/ codeql-coding-standards/.codeqlmanifest.json codeql-coding-standards/supported_codeql_configs.json codeql-coding-standards/scripts/configuration codeql-coding-standards/scripts/reports codeql-coding-standards/scripts/shared codeql-coding-standards/scripts/guideline_recategorization codeql-coding-standards/scripts/shared codeql-coding-standards/scripts/schemas

.github/workflows/codeql_unit_tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
uses: actions/setup-python@v4
4848
with:
4949
python-version: "3.9"
50+
51+
- name: Install Python dependencies
52+
run: pip install -r scripts/requirements.txt
5053

5154
- name: Cache CodeQL
5255
id: cache-codeql
@@ -66,11 +69,15 @@ jobs:
6669
codeql-home: ${{ github.workspace }}/codeql_home
6770
add-to-path: false
6871

72+
- name: Install CodeQL packs
73+
uses: ./.github/actions/install-codeql-packs
74+
with:
75+
cli_path: ${{ github.workspace }}/codeql_home/codeql
76+
6977
- name: Pre-Compile Queries
7078
id: pre-compile-queries
7179
run: |
72-
${{ github.workspace }}/codeql_home/codeql/codeql query compile --search-path cpp --threads 0 cpp
73-
${{ github.workspace }}/codeql_home/codeql/codeql query compile --search-path c --search-path cpp --threads 0 c
80+
${{ github.workspace }}/codeql_home/codeql/codeql query compile --threads 0 ${{ matrix.language }}
7481
7582
7683
- name: Run test suites
@@ -122,18 +129,11 @@ jobs:
122129
os.makedirs(os.path.dirname(test_report_path), exist_ok=True)
123130
test_report_file = open(test_report_path, 'w')
124131
files_to_close.append(test_report_file)
125-
if "${{ matrix.language }}".casefold() == "c".casefold():
126-
# c tests require cpp -- but we don't want c things on the cpp
127-
# path in case of design errors.
128-
cpp_language_root = Path(workspace, 'cpp')
129-
procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", f'--search-path={cpp_language_root}', f'--search-path={language_root}', *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
130-
else:
131-
procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", f'--search-path={language_root}', f'--search-path={language_root}', *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
132+
procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
132133
133134
for p in procs:
134-
p.wait()
135+
_, err = p.communicate()
135136
if p.returncode != 0:
136-
_, err = p.communicate()
137137
if p.returncode == 122:
138138
# Failed because a test case failed, so just print the regular output.
139139
# This will allow us to proceed to validate-test-results, which will fail if

.github/workflows/dispatch-matrix-check.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: 🤖 Run Matrix Check
22

33
on:
4-
pull_request:
4+
pull_request_target:
5+
types: [synchronize,opened]
56
branches:
67
- "**"
78
workflow_dispatch:
@@ -11,7 +12,13 @@ jobs:
1112
runs-on: ubuntu-latest
1213
steps:
1314

15+
- name: Test Variables
16+
shell: pwsh
17+
run: |
18+
Write-Host "Running as: ${{github.actor}}"
19+
1420
- name: Dispatch Matrix Testing Job
21+
if: ${{ contains(fromJSON('["jsinglet", "mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine"]'), github.actor) }}
1522
uses: peter-evans/repository-dispatch@v2
1623
with:
1724
token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
@@ -21,6 +28,7 @@ jobs:
2128

2229

2330
- uses: actions/github-script@v6
31+
if: ${{ contains(fromJSON('["jsinglet", "mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine"]'), github.actor) }}
2432
with:
2533
script: |
2634
github.rest.issues.createComment({

.github/workflows/dispatch-release-performance-check.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,27 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515

16+
- name: Test Variables
17+
shell: pwsh
18+
run: |
19+
Write-Host "Running as: ${{github.actor}}"
20+
21+
$actor = "${{github.actor}}"
22+
23+
$acl = @("jsinglet","mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine")
24+
25+
if(-not ($actor -in $acl)){
26+
throw "Refusing to run workflow for user not in acl."
27+
}
28+
1629
- name: Dispatch Performance Testing Job
1730
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-performance') }}
1831
uses: peter-evans/repository-dispatch@v2
1932
with:
2033
token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
2134
repository: github/codeql-coding-standards-release-engineering
2235
event-type: performance-test
23-
client-payload: '{"pr": "${{ github.event.number }}"}'
36+
client-payload: '{"pr": "${{ github.event.issue.number }}"}'
2437

2538

2639
- uses: actions/github-script@v6

.github/workflows/standard_library_upgrade_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
stdlib_path = os.path.join(codeql_home, 'codeql-stdlib')
117117
cpp_test_root = Path(stdlib_path, 'cpp/ql/test')
118118
print(f"Executing tests found (recursively) in the directory '{cpp_test_root}'")
119-
cp = subprocess.run([codeql_bin, "test", "run", "--format=json", f'--search-path={stdlib_path}', cpp_test_root], stdout=test_report_file, stderr=subprocess.PIPE)
119+
cp = subprocess.run([codeql_bin, "test", "run", "--format=json", cpp_test_root], stdout=test_report_file, stderr=subprocess.PIPE)
120120
if cp.returncode != 0:
121121
print_error_and_fail(f"Failed to run tests with return code {cp.returncode} and error {cp.stderr}")
122122

.github/workflows/tooling-unit-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ jobs:
6464
codeql-home: ${{ github.workspace }}/codeql_home
6565
add-to-path: false
6666

67+
- name: Install CodeQL packs
68+
uses: ./.github/actions/install-codeql-packs
69+
with:
70+
cli_path: ${{ github.workspace }}/codeql_home/codeql
71+
6772
- name: Run PyTest
6873
env:
6974
CODEQL_HOME: ${{ github.workspace }}/codeql_home
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Verify Standard Library Dependencies
2+
3+
# Run this workflow every time the "supported_codeql_configs.json" file or a "qlpack.yml" file is changed
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
- "rc/**"
9+
- next
10+
paths:
11+
- "supported_codeql_configs.json"
12+
- "**/qlpack.yml"
13+
workflow_dispatch:
14+
15+
jobs:
16+
prepare-matrix:
17+
name: Prepare CodeQL configuration matrix
18+
runs-on: ubuntu-latest
19+
outputs:
20+
matrix: ${{ steps.export-matrix.outputs.matrix }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v2
24+
25+
- name: Export unit test matrix
26+
id: export-matrix
27+
run: |
28+
echo "::set-output name=matrix::$(
29+
jq --compact-output \
30+
'.supported_environment | map([.+{os: "ubuntu-20.04-xl", codeql_standard_library_ident : .codeql_standard_library | sub("\/"; "_")}]) | flatten | {include: .}' \
31+
supported_codeql_configs.json
32+
)"
33+
34+
verify-dependencies:
35+
name: Verify dependencies
36+
needs: prepare-matrix
37+
38+
runs-on: ${{ matrix.os }}
39+
strategy:
40+
fail-fast: false
41+
matrix: ${{fromJSON(needs.prepare-matrix.outputs.matrix)}}
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v2
46+
47+
- name: Setup Python 3
48+
uses: actions/setup-python@v4
49+
with:
50+
python-version: "3.9"
51+
52+
- name: Cache CodeQL
53+
id: cache-codeql
54+
uses: actions/cache@v2.1.3
55+
with:
56+
# A list of files, directories, and wildcard patterns to cache and restore
57+
path: ${{github.workspace}}/codeql_home
58+
# An explicit key for restoring and saving the cache
59+
key: codeql-home-${{matrix.os}}-${{matrix.codeql_cli}}-${{matrix.codeql_standard_library}}
60+
61+
- name: Install CodeQL
62+
if: steps.cache-codeql.outputs.cache-hit != 'true'
63+
uses: ./.github/actions/install-codeql
64+
with:
65+
codeql-cli-version: ${{matrix.codeql_cli}}
66+
codeql-stdlib-version: ${{matrix.codeql_standard_library}}
67+
codeql-home: ${{ github.workspace }}/codeql_home
68+
69+
- name: Verify dependencies
70+
shell: bash
71+
env:
72+
CLI_PATH: ${{ github.workspace }}/codeql_home/codeql
73+
STDLIB_PATH: ${{ github.workspace }}/codeql_home/codeql-stdlib
74+
run: |
75+
PATH=$PATH:$CLI_PATH
76+
ls $STDLIB_PATH
77+
pip install -r scripts/requirements.txt
78+
python3 scripts/verify-standard-library-version.py --codeql-repo $STDLIB_PATH --mode verify
79+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@
2020
# C/C++ build artifacts
2121
*.o
2222
/databases/
23+
24+
# CodeQL build artifacts
25+
**/.codeql/**

.vscode/tasks.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@
193193
"Classes",
194194
"Comments",
195195
"Contracts1",
196+
"Contracts2",
197+
"Contracts3",
198+
"Contracts4",
199+
"Contracts5",
200+
"Contracts6",
196201
"Concurrency",
197202
"Concurrency",
198203
"Concurrency1",

c/.codeqlmanifest.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

c/cert/src/codeql-pack.lock.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
dependencies:
3+
codeql/cpp-all:
4+
version: 0.2.3
5+
compiled: false
6+
lockVersion: 1.0.0

c/cert/src/codeql-suites/cert-default.qls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- description: CERT C 2016 (Default)
2-
- qlpack: cert-c-coding-standards
2+
- qlpack: codeql/cert-c-coding-standards
33
- include:
44
kind:
55
- problem

c/cert/src/qlpack.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
name: cert-c-coding-standards
2-
version: 2.13.0-dev
1+
name: codeql/cert-c-coding-standards
2+
version: 2.14.0-dev
3+
description: CERT C 2016
34
suites: codeql-suites
4-
libraryPathDependencies: common-c-coding-standards
5+
license: MIT
6+
dependencies:
7+
codeql/common-c-coding-standards: '*'
8+
codeql/cpp-all: 0.2.3

0 commit comments

Comments
 (0)