-
Notifications
You must be signed in to change notification settings - Fork 36
add_codeql misra scan #56
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
Draft
FScholPer
wants to merge
16
commits into
main
Choose a base branch
from
add_codeql
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
098aed3
add_codeql
FScholPer f44d8aa
fix wrong target
FScholPer 346e3d7
added push to main trigger
FScholPer dd01f30
tryout switch to none build mode
FScholPer e429319
try autobild
FScholPer afd0000
try to improve bazel setting to codeql usage
FScholPer 89111e9
readded config and added multicore
FScholPer 67b5fca
increased version
FScholPer bac344d
changed version
FScholPer 271f017
added debug flag
FScholPer 333dfd2
added LD_PRELOAD and batching
FScholPer 9f073e8
added debug step
FScholPer b9aa4fd
increase the action of preload
FScholPer 9a9d9e3
increased the pressure to bazel
FScholPer e58a11a
tried new flags
FScholPer d1ac0f3
removed experimental
FScholPer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| # Workflow configuration for S-CORE CI - Release Check | ||
| # This workflow runs Bazel build and test when triggered by tag creation. | ||
|
|
||
| name: "CodeQL Advanced" | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| push: | ||
| branches: | ||
| - main | ||
| merge_group: | ||
| types: [checks_requested] | ||
|
|
||
| #jobs: | ||
| # analyze: | ||
| # uses: eclipse-score/cicd-workflows/.github/workflows/codeql.yml@main | ||
| # with: | ||
| # build-script: | | ||
| # bazel build --config bl-x86_64-linux -- //score/... | ||
|
|
||
| # permissions: | ||
| # security-events: write | ||
| # packages: read | ||
| # actions: read | ||
| # contents: read | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze (${{ matrix.language }}) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| security-events: write | ||
| packages: read | ||
| actions: read | ||
| contents: read | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - language: c-cpp | ||
| build-mode: manual | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Initializes the CodeQL tools for scanning. | ||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v4 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| build-mode: ${{ matrix.build-mode }} | ||
| packs: codeql/misra-cpp-coding-standards | ||
| dependency-caching: true | ||
| env: | ||
| CODEQL_ACTION_DEBUG: true | ||
|
|
||
| - if: matrix.build-mode == 'manual' | ||
| shell: bash | ||
| run: | | ||
| # Clean Bazel cache to ensure a fresh build that CodeQL can trace. | ||
| # This is crucial as Bazel often uses cached results, which CodeQL cannot observe. | ||
| bazel clean --expunge | ||
|
|
||
| # Build using specific Bazel flags to help CodeQL detect the build. | ||
| # --spawn_strategy=local: Ensures local compilation, not distributed. | ||
| # --nouse_action_cache: Prevents using action cache, forcing recompilation. | ||
| # --noremote_accept_cached, --noremote_upload_local_results: Avoids remote caching. | ||
| # --disk_cache=: Disables disk cache. | ||
| bazel --batch build -j 4 --config bl-x86_64-linux \ | ||
| --spawn_strategy=local \ | ||
| --strategy=Genrule=local \ | ||
| --nouse_action_cache \ | ||
| --noremote_accept_cached \ | ||
| --noremote_upload_local_results \ | ||
| --disk_cache= \ | ||
| //score/... | ||
|
|
||
| # Shut down Bazel server processes after the build. | ||
| # This ensures future build commands start in a clean Bazel server process without CodeQL attached. | ||
| bazel shutdown | ||
|
|
||
| - name: Check CodeQL Tracer Log | ||
| if: always() | ||
| run: | | ||
| echo "--- Contents of CODEQL_TRACER_LOG ---" | ||
| cat "${CODEQL_TRACER_LOG}" || echo "Tracer log file not found or empty." | ||
| echo "-------------------------------------" | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@v4 | ||
| with: | ||
| category: "/language:${{matrix.language}}" | ||
| output: sarif-results.sarif | ||
|
|
||
| - name: Upload Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: sarif-results.sarif | ||
| path: sarif-results.sarif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you try adding
--action_env=LD_PRELOADhere?CodeQL injects a library to intercept build commands, but bazel seems to ignore it: https://github.com/eclipse-score/baselibs/actions/runs/19935641098/job/57159502549#step:4:65
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.
Other code checking tools do it as well https://codechecker.readthedocs.io/en/latest/analyzer/user_guide/#bazel
I'm not sure if more CodeQL environment variables need to be listed as well or the one for LD_PRELOAD is enough.
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.
Thanks i will give it a try