Skip to content
Merged
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
25 changes: 22 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,17 @@ jobs:
fi

echo "=== Running SonarCloud analysis ==="
# Check if build-wrapper output exists
BUILD_WRAPPER_OUTPUT="${{ env.BUILD_WRAPPER_OUT_DIR }}bw-output"
if [ -d "$BUILD_WRAPPER_OUTPUT" ] && [ -f "$BUILD_WRAPPER_OUTPUT/build-wrapper-output.json" ]; then
echo "Build-wrapper output found at: $BUILD_WRAPPER_OUTPUT"
ls -la "$BUILD_WRAPPER_OUTPUT" | head -5
Comment on lines +854 to +857

Choose a reason for hiding this comment

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

P1 Badge Fix build-wrapper path detection for SonarCloud step

The new SonarCloud logic sets BUILD_WRAPPER_OUTPUT="${{ env.BUILD_WRAPPER_OUT_DIR }}bw-output" and looks for build-wrapper-output.json, but the earlier build-wrapper invocation uses --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} (which is ./) and produces build-wrapper-dump.json directly in the repository root. Because no bw-output directory or build-wrapper-output.json file is created, this condition always fails and sonar.cfamily.build-wrapper-output is never passed to sonar-scanner, even though C/C++ analysis has been re-enabled. The scan will still error out or skip C++ files. Point the check (and subsequent parameter) at the actual output directory/file or adjust the build-wrapper invocation to write to the expected location.

Useful? React with 👍 / 👎.

else
echo "WARNING: Build-wrapper output not found at $BUILD_WRAPPER_OUTPUT"
echo "Checking for alternative locations..."
find . -name "build-wrapper-output.json" -type f 2>/dev/null | head -5 || echo "No build-wrapper-output.json found"
fi

# Build scanner command base
SCANNER_CMD="sonar-scanner \
-Dsonar.projectKey=fernandotonon_QtMeshEditor \
Expand All @@ -861,11 +872,19 @@ jobs:
-Dsonar.test.inclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp \
-Dsonar.exclusions=**/OgreXML/**,**/dependencies/**,**/*_autogen/**,**/CMakeFiles/**,**/ui_files/**,**/moc_*,**/_deps/** \
-Dsonar.coverage.exclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp,tests/**/*.qml,**/*_autogen/** \
-Dsonar.c.file.suffixes=- \
-Dsonar.cpp.file.suffixes=- \
-Dsonar.objc.file.suffixes=- \
-Dsonar.c.file.suffixes=.c \
-Dsonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++ \
-Dsonar.objc.file.suffixes=.m,.mm \
-Dsonar.verbose=true"

# Add build-wrapper output if it exists
if [ -d "$BUILD_WRAPPER_OUTPUT" ] && [ -f "$BUILD_WRAPPER_OUTPUT/build-wrapper-output.json" ]; then
echo "Adding build-wrapper output to analysis"
SCANNER_CMD="$SCANNER_CMD -Dsonar.cfamily.build-wrapper-output=$BUILD_WRAPPER_OUTPUT"
else
echo "WARNING: Skipping build-wrapper output (not found). Analysis will proceed without compilation database."
fi

# Only add coverage if file exists and is not empty
if [ -f coverage.lcov ] && [ -s coverage.lcov ]; then
echo "Using LCOV format for coverage"
Expand Down
12 changes: 6 additions & 6 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ sonar.coverage.exclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp,tests/**/*.
# Coverage path will be set dynamically in workflow to ensure file exists
# If coverage reporting doesn't work, you may need to use the sonar-cxx community plugin

# Disable C++ file analysis since we don't have cfamily plugin
# This prevents SonarQube from trying to analyze C++ code
# We only use SonarQube for coverage reporting via generic coverage format
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
# Enable C++ file analysis with build-wrapper support
# The build-wrapper provides compilation data for SonarCloud analysis
# File suffixes for C/C++ source files
sonar.c.file.suffixes=.c
sonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++
sonar.objc.file.suffixes=.m,.mm
Loading