Skip to content

Commit 29381dc

Browse files
committed
Use fetch-codeql in more places
1 parent 2bbd2f3 commit 29381dc

File tree

6 files changed

+260
-342
lines changed

6 files changed

+260
-342
lines changed

.github/workflows/csv-coverage-pr-artifacts.yml

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ name: Check framework coverage changes
33
on:
44
pull_request:
55
paths:
6-
- '.github/workflows/csv-coverage-pr-comment.yml'
7-
- '*/ql/src/**/*.ql'
8-
- '*/ql/src/**/*.qll'
9-
- '*/ql/lib/**/*.ql'
10-
- '*/ql/lib/**/*.qll'
11-
- 'misc/scripts/library-coverage/*.py'
6+
- ".github/workflows/csv-coverage-pr-comment.yml"
7+
- ".github/workflows/csv-coverage-pr-artifacts.yml"
8+
- ".github/actions/fetch-codeql"
9+
- "*/ql/src/**/*.ql"
10+
- "*/ql/src/**/*.qll"
11+
- "*/ql/lib/**/*.ql"
12+
- "*/ql/lib/**/*.qll"
13+
- "misc/scripts/library-coverage/*.py"
1214
# input data files
13-
- '*/documentation/library-coverage/cwe-sink.csv'
14-
- '*/documentation/library-coverage/frameworks.csv'
15+
- "*/documentation/library-coverage/cwe-sink.csv"
16+
- "*/documentation/library-coverage/frameworks.csv"
1517
branches:
1618
- main
17-
- 'rc/*'
19+
- "rc/*"
1820

1921
jobs:
2022
generate:
@@ -23,77 +25,72 @@ jobs:
2325
runs-on: ubuntu-latest
2426

2527
steps:
26-
- name: Dump GitHub context
27-
env:
28-
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
29-
run: echo "$GITHUB_CONTEXT"
30-
- name: Clone self (github/codeql) - MERGE
31-
uses: actions/checkout@v3
32-
with:
33-
path: merge
34-
- name: Clone self (github/codeql) - BASE
35-
uses: actions/checkout@v3
36-
with:
37-
fetch-depth: 2
38-
path: base
39-
- run: |
40-
git checkout HEAD^1
41-
git log -1 --format='%H'
42-
working-directory: base
43-
- name: Set up Python 3.8
44-
uses: actions/setup-python@v4
45-
with:
46-
python-version: 3.8
47-
- name: Download CodeQL CLI
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
run: |
51-
gh release download --repo "github/codeql-cli-binaries" --pattern "codeql-linux64.zip"
52-
- name: Unzip CodeQL CLI
53-
run: unzip -d codeql-cli codeql-linux64.zip
54-
- name: Generate CSV files on merge commit of the PR
55-
run: |
56-
echo "Running generator on merge"
57-
PATH="$PATH:codeql-cli/codeql" python merge/misc/scripts/library-coverage/generate-report.py ci merge merge
58-
mkdir out_merge
59-
cp framework-coverage-*.csv out_merge/
60-
cp framework-coverage-*.rst out_merge/
61-
- name: Generate CSV files on base commit of the PR
62-
run: |
63-
echo "Running generator on base"
64-
PATH="$PATH:codeql-cli/codeql" python base/misc/scripts/library-coverage/generate-report.py ci base base
65-
mkdir out_base
66-
cp framework-coverage-*.csv out_base/
67-
cp framework-coverage-*.rst out_base/
68-
- name: Generate diff of coverage reports
69-
run: |
70-
python base/misc/scripts/library-coverage/compare-folders.py out_base out_merge comparison.md
71-
- name: Upload CSV package list
72-
uses: actions/upload-artifact@v3
73-
with:
74-
name: csv-framework-coverage-merge
75-
path: |
76-
out_merge/framework-coverage-*.csv
77-
out_merge/framework-coverage-*.rst
78-
- name: Upload CSV package list
79-
uses: actions/upload-artifact@v3
80-
with:
81-
name: csv-framework-coverage-base
82-
path: |
83-
out_base/framework-coverage-*.csv
84-
out_base/framework-coverage-*.rst
85-
- name: Upload comparison results
86-
uses: actions/upload-artifact@v3
87-
with:
88-
name: comparison
89-
path: |
90-
comparison.md
91-
- name: Save PR number
92-
run: |
93-
mkdir -p pr
94-
echo ${{ github.event.pull_request.number }} > pr/NR
95-
- name: Upload PR number
96-
uses: actions/upload-artifact@v3
97-
with:
98-
name: pr
99-
path: pr/
28+
- name: Dump GitHub context
29+
env:
30+
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
31+
run: echo "$GITHUB_CONTEXT"
32+
- name: Clone self (github/codeql) - MERGE
33+
uses: actions/checkout@v3
34+
with:
35+
path: merge
36+
- name: Clone self (github/codeql) - BASE
37+
uses: actions/checkout@v3
38+
with:
39+
fetch-depth: 2
40+
path: base
41+
- run: |
42+
git checkout HEAD^1
43+
git log -1 --format='%H'
44+
working-directory: base
45+
- name: Set up Python 3.8
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: 3.8
49+
- name: Download CodeQL CLI
50+
uses: ./merge/.github/actions/fetch-codeql
51+
- name: Generate CSV files on merge commit of the PR
52+
run: |
53+
echo "Running generator on merge"
54+
PATH="$PATH:codeql-cli/codeql" python merge/misc/scripts/library-coverage/generate-report.py ci merge merge
55+
mkdir out_merge
56+
cp framework-coverage-*.csv out_merge/
57+
cp framework-coverage-*.rst out_merge/
58+
- name: Generate CSV files on base commit of the PR
59+
run: |
60+
echo "Running generator on base"
61+
PATH="$PATH:codeql-cli/codeql" python base/misc/scripts/library-coverage/generate-report.py ci base base
62+
mkdir out_base
63+
cp framework-coverage-*.csv out_base/
64+
cp framework-coverage-*.rst out_base/
65+
- name: Generate diff of coverage reports
66+
run: |
67+
python base/misc/scripts/library-coverage/compare-folders.py out_base out_merge comparison.md
68+
- name: Upload CSV package list
69+
uses: actions/upload-artifact@v3
70+
with:
71+
name: csv-framework-coverage-merge
72+
path: |
73+
out_merge/framework-coverage-*.csv
74+
out_merge/framework-coverage-*.rst
75+
- name: Upload CSV package list
76+
uses: actions/upload-artifact@v3
77+
with:
78+
name: csv-framework-coverage-base
79+
path: |
80+
out_base/framework-coverage-*.csv
81+
out_base/framework-coverage-*.rst
82+
- name: Upload comparison results
83+
uses: actions/upload-artifact@v3
84+
with:
85+
name: comparison
86+
path: |
87+
comparison.md
88+
- name: Save PR number
89+
run: |
90+
mkdir -p pr
91+
echo ${{ github.event.pull_request.number }} > pr/NR
92+
- name: Upload PR number
93+
uses: actions/upload-artifact@v3
94+
with:
95+
name: pr
96+
path: pr/

.github/workflows/csv-coverage-timeseries.yml

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,31 @@ on:
55

66
jobs:
77
build:
8-
98
runs-on: ubuntu-latest
109

1110
steps:
12-
- name: Clone self (github/codeql)
13-
uses: actions/checkout@v3
14-
with:
15-
path: script
16-
- name: Clone self (github/codeql) for analysis
17-
uses: actions/checkout@v3
18-
with:
19-
path: codeqlModels
20-
fetch-depth: 0
21-
- name: Set up Python 3.8
22-
uses: actions/setup-python@v4
23-
with:
24-
python-version: 3.8
25-
- name: Download CodeQL CLI
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
run: |
29-
gh release download --repo "github/codeql-cli-binaries" --pattern "codeql-linux64.zip"
30-
- name: Unzip CodeQL CLI
31-
run: unzip -d codeql-cli codeql-linux64.zip
32-
- name: Build modeled package list
33-
run: |
34-
CLI=$(realpath "codeql-cli/codeql")
35-
echo $CLI
36-
PATH="$PATH:$CLI" python script/misc/scripts/library-coverage/generate-timeseries.py codeqlModels
37-
- name: Upload timeseries CSV
38-
uses: actions/upload-artifact@v3
39-
with:
40-
name: framework-coverage-timeseries
41-
path: framework-coverage-timeseries-*.csv
42-
11+
- name: Clone self (github/codeql)
12+
uses: actions/checkout@v3
13+
with:
14+
path: script
15+
- name: Clone self (github/codeql) for analysis
16+
uses: actions/checkout@v3
17+
with:
18+
path: codeqlModels
19+
fetch-depth: 0
20+
- name: Set up Python 3.8
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.8
24+
- name: Download CodeQL CLI
25+
uses: ./.github/actions/fetch-codeql
26+
- name: Build modeled package list
27+
run: |
28+
CLI=$(realpath "codeql-cli/codeql")
29+
echo $CLI
30+
PATH="$PATH:$CLI" python script/misc/scripts/library-coverage/generate-timeseries.py codeqlModels
31+
- name: Upload timeseries CSV
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: framework-coverage-timeseries
35+
path: framework-coverage-timeseries-*.csv

.github/workflows/csv-coverage-update.yml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,27 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Dump GitHub context
16-
env:
17-
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
18-
run: echo "$GITHUB_CONTEXT"
19-
- name: Clone self (github/codeql)
20-
uses: actions/checkout@v3
21-
with:
22-
path: ql
23-
fetch-depth: 0
24-
- name: Set up Python 3.8
25-
uses: actions/setup-python@v4
26-
with:
27-
python-version: 3.8
28-
- name: Download CodeQL CLI
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
run: |
32-
gh release download --repo "github/codeql-cli-binaries" --pattern "codeql-linux64.zip"
33-
- name: Unzip CodeQL CLI
34-
run: unzip -d codeql-cli codeql-linux64.zip
15+
- name: Dump GitHub context
16+
env:
17+
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
18+
run: echo "$GITHUB_CONTEXT"
19+
- name: Clone self (github/codeql)
20+
uses: actions/checkout@v3
21+
with:
22+
path: ql
23+
fetch-depth: 0
24+
- name: Set up Python 3.8
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: 3.8
28+
- name: Download CodeQL CLI
29+
uses: ./.github/actions/fetch-codeql
30+
- name: Generate coverage files
31+
run: |
32+
PATH="$PATH:codeql-cli/codeql" python ql/misc/scripts/library-coverage/generate-report.py ci ql ql
3533
36-
- name: Generate coverage files
37-
run: |
38-
PATH="$PATH:codeql-cli/codeql" python ql/misc/scripts/library-coverage/generate-report.py ci ql ql
39-
40-
- name: Create pull request with changes
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
run: |
44-
python ql/misc/scripts/library-coverage/create-pr.py ql "$GITHUB_REPOSITORY"
34+
- name: Create pull request with changes
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
python ql/misc/scripts/library-coverage/create-pr.py ql "$GITHUB_REPOSITORY"

.github/workflows/csv-coverage.yml

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,39 @@ on:
44
workflow_dispatch:
55
inputs:
66
qlModelShaOverride:
7-
description: 'github/codeql repo SHA used for looking up the CSV models'
7+
description: "github/codeql repo SHA used for looking up the CSV models"
88
required: false
99

1010
jobs:
1111
build:
12-
1312
runs-on: ubuntu-latest
1413

1514
steps:
16-
- name: Clone self (github/codeql)
17-
uses: actions/checkout@v3
18-
with:
19-
path: script
20-
- name: Clone self (github/codeql) for analysis
21-
uses: actions/checkout@v3
22-
with:
23-
path: codeqlModels
24-
ref: ${{ github.event.inputs.qlModelShaOverride || github.ref }}
25-
- name: Set up Python 3.8
26-
uses: actions/setup-python@v4
27-
with:
28-
python-version: 3.8
29-
- name: Download CodeQL CLI
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
run: |
33-
gh release download --repo "github/codeql-cli-binaries" --pattern "codeql-linux64.zip"
34-
- name: Unzip CodeQL CLI
35-
run: unzip -d codeql-cli codeql-linux64.zip
36-
- name: Build modeled package list
37-
run: |
38-
PATH="$PATH:codeql-cli/codeql" python script/misc/scripts/library-coverage/generate-report.py ci codeqlModels script
39-
- name: Upload CSV package list
40-
uses: actions/upload-artifact@v3
41-
with:
42-
name: framework-coverage-csv
43-
path: framework-coverage-*.csv
44-
- name: Upload RST package list
45-
uses: actions/upload-artifact@v3
46-
with:
47-
name: framework-coverage-rst
48-
path: framework-coverage-*.rst
49-
15+
- name: Clone self (github/codeql)
16+
uses: actions/checkout@v3
17+
with:
18+
path: script
19+
- name: Clone self (github/codeql) for analysis
20+
uses: actions/checkout@v3
21+
with:
22+
path: codeqlModels
23+
ref: ${{ github.event.inputs.qlModelShaOverride || github.ref }}
24+
- name: Set up Python 3.8
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: 3.8
28+
- name: Download CodeQL CLI
29+
uses: ./.github/actions/fetch-codeql
30+
- name: Build modeled package list
31+
run: |
32+
PATH="$PATH:codeql-cli/codeql" python script/misc/scripts/library-coverage/generate-report.py ci codeqlModels script
33+
- name: Upload CSV package list
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: framework-coverage-csv
37+
path: framework-coverage-*.csv
38+
- name: Upload RST package list
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: framework-coverage-rst
42+
path: framework-coverage-*.rst

0 commit comments

Comments
 (0)