Skip to content
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

ci(gha): improve CodeQL #12513

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/_build_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
build-binaries:
timeout-minutes: 40
runs-on: ubuntu-24.04
permissions:
contents: read
actions: read
security-events: write
outputs:
BINARY_ARTIFACT_DIGEST_BASE64: ${{ steps.inspect-binary-output.outputs.binary_artifact_digest_base64 }}
steps:
Expand All @@ -60,8 +64,20 @@ jobs:
key: ${{ runner.os }}-${{ runner.arch }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-devtools
- name: Initialize CodeQL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be in check instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most time takes the build step which here is already done. If we'll put it in check we'll have to build binaries there as well which will take 10+ more minutes

uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
with:
config-file: ./.github/codeql/codeql-config.yml
languages: go
build-mode: manual
debug: ${{ runner.debug == '1' }}
- run: |
make build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
with:
category: "/language:go"
check_name: CodeQL
- id: annotate-image-tag
name: Image tag
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-test-distribute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ jobs:
build_publish:
permissions:
contents: read
actions: read # Required for CodeQL
id-token: write # Required for image signing
security-events: write # Required for CodeQL
needs: ["check", "test"]
uses: ./.github/workflows/_build_publish.yaml
if: ${{ fromJSON(needs.check.outputs.BUILD) }}
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "CodeQL"

on:
schedule:
- cron: '35 3 * * *' # Runs daily at 3:35 AM UTC
- cron: '15 3 * * *' # Runs daily at 3:15 AM UTC
workflow_dispatch: {}

permissions: {}
Expand Down Expand Up @@ -30,11 +30,17 @@ jobs:
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
build-mode: manual
debug: ${{ runner.debug == '1' }}
- name: Build
run: |
echo "${{ steps.checkout.outputs.ref }}"
echo "${{ steps.checkout.outputs.commit }}"
make build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
with:
ref: ${{ steps.checkout.outputs.ref }}
sha: ${{ steps.checkout.outputs.commit }}
category: "/language:${{matrix.language}}"
check_name: CodeQL
Loading