-
Notifications
You must be signed in to change notification settings - Fork 2k
CI: make all jobs that fetch a CodeQL CLI use the fetch-codeql action #9938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bc05cda
3b8eeb0
2bbd2f3
29381dc
4d35d8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,18 +3,20 @@ name: Check framework coverage changes | |
| on: | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/csv-coverage-pr-comment.yml' | ||
| - '*/ql/src/**/*.ql' | ||
| - '*/ql/src/**/*.qll' | ||
| - '*/ql/lib/**/*.ql' | ||
| - '*/ql/lib/**/*.qll' | ||
| - 'misc/scripts/library-coverage/*.py' | ||
| - ".github/workflows/csv-coverage-pr-comment.yml" | ||
| - ".github/workflows/csv-coverage-pr-artifacts.yml" | ||
| - ".github/actions/fetch-codeql" | ||
| - "*/ql/src/**/*.ql" | ||
| - "*/ql/src/**/*.qll" | ||
| - "*/ql/lib/**/*.ql" | ||
| - "*/ql/lib/**/*.qll" | ||
| - "misc/scripts/library-coverage/*.py" | ||
| # input data files | ||
| - '*/documentation/library-coverage/cwe-sink.csv' | ||
| - '*/documentation/library-coverage/frameworks.csv' | ||
| - "*/documentation/library-coverage/cwe-sink.csv" | ||
| - "*/documentation/library-coverage/frameworks.csv" | ||
| branches: | ||
| - main | ||
| - 'rc/*' | ||
| - "rc/*" | ||
|
|
||
| jobs: | ||
| generate: | ||
|
|
@@ -23,77 +25,72 @@ jobs: | |
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Dump GitHub context | ||
| env: | ||
| GITHUB_CONTEXT: ${{ toJSON(github.event) }} | ||
| run: echo "$GITHUB_CONTEXT" | ||
| - name: Clone self (github/codeql) - MERGE | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: merge | ||
| - name: Clone self (github/codeql) - BASE | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 2 | ||
| path: base | ||
| - run: | | ||
| git checkout HEAD^1 | ||
| git log -1 --format='%H' | ||
| working-directory: base | ||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
| - name: Download CodeQL CLI | ||
| 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 merge commit of the PR | ||
| run: | | ||
| echo "Running generator on merge" | ||
| 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/ | ||
| - name: Generate CSV files on base commit of the PR | ||
| run: | | ||
| echo "Running generator on base" | ||
| PATH="$PATH:codeql-cli/codeql" python base/misc/scripts/library-coverage/generate-report.py ci base base | ||
| mkdir out_base | ||
| cp framework-coverage-*.csv out_base/ | ||
| cp framework-coverage-*.rst out_base/ | ||
| - name: Generate diff of coverage reports | ||
| run: | | ||
| python base/misc/scripts/library-coverage/compare-folders.py out_base out_merge comparison.md | ||
| - name: Upload CSV package list | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: csv-framework-coverage-merge | ||
| path: | | ||
| out_merge/framework-coverage-*.csv | ||
| out_merge/framework-coverage-*.rst | ||
| - name: Upload CSV package list | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: csv-framework-coverage-base | ||
| path: | | ||
| out_base/framework-coverage-*.csv | ||
| out_base/framework-coverage-*.rst | ||
| - name: Upload comparison results | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: comparison | ||
| path: | | ||
| comparison.md | ||
| - name: Save PR number | ||
| run: | | ||
| mkdir -p pr | ||
| echo ${{ github.event.pull_request.number }} > pr/NR | ||
| - name: Upload PR number | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: pr | ||
| path: pr/ | ||
| - name: Dump GitHub context | ||
| env: | ||
| GITHUB_CONTEXT: ${{ toJSON(github.event) }} | ||
| run: echo "$GITHUB_CONTEXT" | ||
| - name: Clone self (github/codeql) - MERGE | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: merge | ||
| - name: Clone self (github/codeql) - BASE | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 2 | ||
| path: base | ||
| - run: | | ||
| git checkout HEAD^1 | ||
| git log -1 --format='%H' | ||
| working-directory: base | ||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
| - name: Download CodeQL CLI | ||
| uses: ./merge/.github/actions/fetch-codeql | ||
| - name: Generate CSV files on merge commit of the PR | ||
| run: | | ||
| echo "Running generator on merge" | ||
| 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/ | ||
| - name: Generate CSV files on base commit of the PR | ||
| run: | | ||
| echo "Running generator on base" | ||
| PATH="$PATH:codeql-cli/codeql" python base/misc/scripts/library-coverage/generate-report.py ci base base | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| mkdir out_base | ||
| cp framework-coverage-*.csv out_base/ | ||
| cp framework-coverage-*.rst out_base/ | ||
| - name: Generate diff of coverage reports | ||
| run: | | ||
| python base/misc/scripts/library-coverage/compare-folders.py out_base out_merge comparison.md | ||
| - name: Upload CSV package list | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: csv-framework-coverage-merge | ||
| path: | | ||
| out_merge/framework-coverage-*.csv | ||
| out_merge/framework-coverage-*.rst | ||
| - name: Upload CSV package list | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: csv-framework-coverage-base | ||
| path: | | ||
| out_base/framework-coverage-*.csv | ||
| out_base/framework-coverage-*.rst | ||
| - name: Upload comparison results | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: comparison | ||
| path: | | ||
| comparison.md | ||
| - name: Save PR number | ||
| run: | | ||
| mkdir -p pr | ||
| echo ${{ github.event.pull_request.number }} > pr/NR | ||
| - name: Upload PR number | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: pr | ||
| path: pr/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,38 +5,31 @@ on: | |
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Clone self (github/codeql) | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: script | ||
| - name: Clone self (github/codeql) for analysis | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: codeqlModels | ||
| fetch-depth: 0 | ||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
| - name: Download CodeQL CLI | ||
| 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: Build modeled package list | ||
| run: | | ||
| CLI=$(realpath "codeql-cli/codeql") | ||
| echo $CLI | ||
| PATH="$PATH:$CLI" python script/misc/scripts/library-coverage/generate-timeseries.py codeqlModels | ||
| - name: Upload timeseries CSV | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: framework-coverage-timeseries | ||
| path: framework-coverage-timeseries-*.csv | ||
|
|
||
| - name: Clone self (github/codeql) | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: script | ||
| - name: Clone self (github/codeql) for analysis | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: codeqlModels | ||
| fetch-depth: 0 | ||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
| - name: Download CodeQL CLI | ||
| uses: ./.github/actions/fetch-codeql | ||
| - name: Build modeled package list | ||
| run: | | ||
| CLI=$(realpath "codeql-cli/codeql") | ||
| echo $CLI | ||
| PATH="$PATH:$CLI" python script/misc/scripts/library-coverage/generate-timeseries.py codeqlModels | ||
|
Comment on lines
+28
to
+30
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, the CLI is not in |
||
| - name: Upload timeseries CSV | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: framework-coverage-timeseries | ||
| path: framework-coverage-timeseries-*.csv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,33 +12,27 @@ jobs: | |
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Dump GitHub context | ||
| env: | ||
| GITHUB_CONTEXT: ${{ toJSON(github.event) }} | ||
| run: echo "$GITHUB_CONTEXT" | ||
| - name: Clone self (github/codeql) | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: ql | ||
| fetch-depth: 0 | ||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
| - name: Download CodeQL CLI | ||
| 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: Dump GitHub context | ||
| env: | ||
| GITHUB_CONTEXT: ${{ toJSON(github.event) }} | ||
| run: echo "$GITHUB_CONTEXT" | ||
| - name: Clone self (github/codeql) | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: ql | ||
| fetch-depth: 0 | ||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
| - name: Download CodeQL CLI | ||
| uses: ./.github/actions/fetch-codeql | ||
| - name: Generate coverage files | ||
| run: | | ||
| PATH="$PATH:codeql-cli/codeql" python ql/misc/scripts/library-coverage/generate-report.py ci ql ql | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above. |
||
|
|
||
| - name: Generate coverage files | ||
| run: | | ||
| PATH="$PATH:codeql-cli/codeql" python ql/misc/scripts/library-coverage/generate-report.py ci ql ql | ||
|
|
||
| - name: Create pull request with changes | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| python ql/misc/scripts/library-coverage/create-pr.py ql "$GITHUB_REPOSITORY" | ||
| - name: Create pull request with changes | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| python ql/misc/scripts/library-coverage/create-pr.py ql "$GITHUB_REPOSITORY" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path needs to change I think; or we drop it since
codeqlshould already be onGITHUB_PATH.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well spotted;
codeqlis already on theGITHUB_PATH. I'll clean this up in a follow-up PR. Thegotests take ridiculously long on each commit so I'd rather get this merged and make a quick fix-up PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: #9943