mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Apply code review findings
This commit is contained in:
35
.github/workflows/csv-coverage-pr-artifacts.yml
vendored
35
.github/workflows/csv-coverage-pr-artifacts.yml
vendored
@@ -15,20 +15,21 @@ on:
|
||||
- 'rc/*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
generate:
|
||||
name: Generate framework coverage artifacts
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
||||
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
- name: Clone self (github/codeql) head
|
||||
- name: Clone self (github/codeql) - MERGE
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: head
|
||||
- name: Clone self (github/codeql) base
|
||||
path: merge
|
||||
- name: Clone self (github/codeql) - BASE
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.base.sha }}
|
||||
@@ -38,21 +39,19 @@ jobs:
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Download CodeQL CLI
|
||||
uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
|
||||
with:
|
||||
repo: "github/codeql-cli-binaries"
|
||||
version: "latest"
|
||||
file: "codeql-linux64.zip"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release download --repo "github/codeql-cli-binaries" --pattern "codeql-linux64.zip"
|
||||
- name: Unzip CodeQL CLI
|
||||
run: unzip -d codeql-cli codeql-linux64.zip
|
||||
- name: Generate CSV files on head and base of the PR
|
||||
- name: Generate CSV files on merge and base of the PR
|
||||
run: |
|
||||
echo "Running generator on ${{github.sha}}"
|
||||
PATH="$PATH:codeql-cli/codeql" python head/misc/scripts/library-coverage/generate-report.py ci head head
|
||||
mkdir out_head
|
||||
cp framework-coverage-*.csv out_head/
|
||||
cp framework-coverage-*.rst out_head/
|
||||
PATH="$PATH:codeql-cli/codeql" python merge/misc/scripts/library-coverage/generate-report.py ci merge merge
|
||||
mkdir out_merge
|
||||
cp framework-coverage-*.csv out_merge/
|
||||
cp framework-coverage-*.rst out_merge/
|
||||
|
||||
echo "Running generator on ${{github.event.pull_request.base.sha}}"
|
||||
PATH="$PATH:codeql-cli/codeql" python base/misc/scripts/library-coverage/generate-report.py ci base base
|
||||
@@ -64,8 +63,8 @@ jobs:
|
||||
with:
|
||||
name: csv-framework-coverage-merge
|
||||
path: |
|
||||
out_head/framework-coverage-*.csv
|
||||
out_head/framework-coverage-*.rst
|
||||
out_merge/framework-coverage-*.csv
|
||||
out_merge/framework-coverage-*.rst
|
||||
- name: Upload CSV package list
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
||||
53
.github/workflows/csv-coverage-pr-comment.yml
vendored
53
.github/workflows/csv-coverage-pr-comment.yml
vendored
@@ -7,8 +7,8 @@ on:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
check:
|
||||
name: Check framework coverage differences and comment
|
||||
runs-on: ubuntu-latest
|
||||
if: >
|
||||
${{ github.event.workflow_run.event == 'pull_request' &&
|
||||
@@ -17,47 +17,46 @@ jobs:
|
||||
steps:
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
||||
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
- name: Clone self (github/codeql) head
|
||||
- name: Clone self (github/codeql)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: head
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
# download artifacts from the PR job:
|
||||
- name: Download artifact - HEAD
|
||||
uses: dawidd6/action-download-artifact@v2.14.0
|
||||
with:
|
||||
workflow: csv-coverage-pr-artifacts.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: csv-framework-coverage-merge
|
||||
path: out_head
|
||||
|
||||
- name: Download artifact - MERGE
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
gh run download --name "csv-framework-coverage-merge" --dir "out_merge" "$RUN_ID"
|
||||
|
||||
- name: Download artifact - BASE
|
||||
uses: dawidd6/action-download-artifact@v2.14.0
|
||||
with:
|
||||
workflow: csv-coverage-pr-artifacts.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: csv-framework-coverage-base
|
||||
path: out_base
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
gh run download --name "csv-framework-coverage-base" --dir "out_base" "$RUN_ID"
|
||||
|
||||
- name: Download artifact - PR
|
||||
uses: dawidd6/action-download-artifact@v2.14.0
|
||||
with:
|
||||
workflow: csv-coverage-pr-artifacts.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: pr
|
||||
path: pr
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
gh run download --name "pr" --dir "pr" "$RUN_ID"
|
||||
|
||||
- name: Check coverage files
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
PR=$(cat "pr/NR")
|
||||
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python head/misc/scripts/library-coverage/compare-files-comment-pr.py \
|
||||
out_head out_base comparison.md ${{ github.repository }} $PR ${{ github.event.workflow_run.id }}
|
||||
python misc/scripts/library-coverage/compare-files-comment-pr.py \
|
||||
out_merge out_base comparison.md ${{ github.repository }} $PR $RUN_ID
|
||||
- name: Upload comparison results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user