Skip to content

Commit

Permalink
Fix Sonar warning: use compile_commands.json (#2281)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir authored Jul 23, 2024
1 parent ea71166 commit 68a388d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
ORTOOLS_DIR: ${{ github.workspace }}/or-tools
# Caching strategy of VCPKG dependencies
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
BUILD_WRAPPER_OUT_DIR: ${{ github.workspace }}/_build/output # Directory where build-wrapper output will be placed

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -96,11 +97,12 @@ jobs:
-DCMAKE_PREFIX_PATH="../install;${{ env.ORTOOLS_DIR }}/install" \
-DBUILD_TESTING=ON \
-DMZ_CODE_COVERAGE=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DPython3_EXECUTABLE='${{ steps.setup-python.outputs.python-path }}'
- name: Build
run: |
build-wrapper-linux-x86-64 --out-dir $GITHUB_WORKSPACE/_build/output cmake --build _build --config release -j$(nproc)
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build _build --config release -j$(nproc)
- name: Test and generate coverage
continue-on-error: true
Expand All @@ -116,7 +118,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}"
run: sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"

- name: Cache vcpkg binary dir
if: always()
Expand Down
1 change: 0 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ sonar.sourceEncoding=UTF-8
sonar.exclusions=src/ext/**,src/tests/**,src/ui/**
sonar.coverage.exclusions=src/ext/**,src/tests/**,src/analyzer/**,src/distrib/**,src/tools/**,src/ui/**

sonar.cfamily.build-wrapper-output=_build/output
sonar.coverageReportPaths=coverage.xml
sonar.cfamily.threads=4

0 comments on commit 68a388d

Please sign in to comment.