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
157 changes: 124 additions & 33 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ jobs:
steps:
- name: change folder permissions
run: |
sudo chmod -R 777 /usr/local/lib
sudo chmod -R 777 /usr/local/include
sudo chmod 777 /usr/local/lib
sudo chmod 777 /usr/local/include

- name: Cache Assimp
id: cache-assimp-linux
Expand Down Expand Up @@ -325,9 +325,9 @@ jobs:
steps:
- name: change folder permissions
run: |
sudo chmod -R 777 /usr/local/lib
sudo chmod -R 777 /usr/local/include
sudo chmod -R 777 /usr/local/share
sudo chmod 777 /usr/local/lib
sudo chmod 777 /usr/local/include
sudo chmod 777 /usr/local/share

- name: Cache Ogre
id: cache-ogre-linux
Expand Down Expand Up @@ -415,9 +415,9 @@ jobs:

- name: change folder permissions
run: |
sudo chmod -R 777 /usr/local/lib
sudo chmod -R 777 /usr/local/include
sudo chmod -R 777 /usr/local/share
sudo chmod 777 /usr/local/lib
sudo chmod 777 /usr/local/include
sudo chmod 777 /usr/local/share

- name: Cache Assimp
id: cache-assimp-linux
Expand Down Expand Up @@ -558,9 +558,9 @@ jobs:

- name: change folder permissions
run: |
sudo chmod -R 777 /usr/local/lib
sudo chmod -R 777 /usr/local/include
sudo chmod -R 777 /usr/local/share
sudo chmod 777 /usr/local/lib
sudo chmod 777 /usr/local/include
sudo chmod 777 /usr/local/share

- name: Cache Assimp
id: cache-assimp-linux
Expand Down Expand Up @@ -685,11 +685,11 @@ jobs:
fi
}

echo "Running UnitTests (Google Tests - includes Assimp and other unit tests)..."
run_test "UnitTests" "test-results-unittests.xml" || echo "UnitTests not found"

echo "Running MaterialEditorQML Unit Tests..."
if ! run_test "MaterialEditorQML_test" "test-results-unit.xml"; then
echo "MaterialEditorQML_test not found, trying UnitTests..."
run_test "UnitTests" "test-results-unit.xml" || echo "UnitTests also not found"
fi
run_test "MaterialEditorQML_test" "test-results-materialeditor.xml" || echo "MaterialEditorQML_test not found"

echo "Running MaterialEditorQML QML Integration Tests..."
run_test "MaterialEditorQML_qml_test" "test-results-qml.xml" || echo "MaterialEditorQML_qml_test not found"
Expand Down Expand Up @@ -729,7 +729,8 @@ jobs:
find build -name "*.gcno" -type f | head -10 || echo "No .gcno files found"

echo "=== Generating gcov files ==="
# Change to build directory to generate gcov files with correct paths
# Generate gcov files in build directory
# SonarQube will read .gcov files from the build directory via gcov.reportsPath
cd build

# Generate gcov files for all object files including the new tests
Expand All @@ -739,22 +740,88 @@ jobs:
cd ..

echo "=== Generated gcov files ==="
find . -name "*.gcov" | head -10 || echo "No .gcov files found"
find build -name "*.gcov" | head -10 || echo "No .gcov files found in build directory"

echo "=== Running gcovr ==="
# Run gcovr to generate coverage reports with better error handling
# Generate SonarQube Generic Coverage XML (version=1) to avoid parser errors
gcovr --root . --filter src/ \
--exclude 'src/OgreXML/.*' \
--exclude 'src/dependencies/.*' \
--exclude '.*_test\.cpp' \
--exclude '.*_test\\.cpp' \
--exclude '.*_autogen.*' \
--exclude '.*/CMakeFiles/.*' \
--exclude '.*/ui_files/.*' \
--exclude '.*/moc_.*' \
--xml-pretty --xml coverage.xml \
--sonarqube --output coverage.xml \
--html --html-details -o coverage.html \
--gcov-executable gcov \
--verbose 2>&1 || echo "gcovr completed with warnings"

echo "=== Generating LCOV format using lcov tool ==="
# Use lcov tool to generate LCOV format from .gcda files
# Install lcov if not available
if ! command -v lcov &> /dev/null; then
echo "Installing lcov..."
sudo apt-get update && sudo apt-get install -y lcov || echo "Failed to install lcov"
fi

# Check for .gcda files before running lcov
echo "Checking for .gcda files in build directory..."
GCDA_COUNT=$(find build -name "*.gcda" -type f 2>/dev/null | wc -l)
echo "Found $GCDA_COUNT .gcda files"

if [ "$GCDA_COUNT" -eq 0 ]; then
echo "WARNING: No .gcda files found! Coverage data may not have been generated."
echo "This usually means tests didn't run or coverage flags weren't applied correctly."
else
# Generate LCOV format from coverage data
# lcov captures from the build directory but outputs to root
# Use --base-directory to make paths relative to project root
cd build
lcov --capture --directory . --output-file ../coverage.lcov \
--base-directory "$(cd .. && pwd)" \
--rc lcov_branch_coverage=1 \
--exclude '*/OgreXML/*' \
--exclude '*/dependencies/*' \
--exclude '*/_test.cpp' \
--exclude '*/test_*.cpp' \
--exclude '*_autogen*' \
--exclude '*/CMakeFiles/*' \
--exclude '*/ui_files/*' \
--exclude '*/moc_*' \
--quiet 2>&1 | head -20 || echo "lcov generation had issues"
cd ..

# If lcov file was created but is empty or has issues, try without exclusions first
if [ -f coverage.lcov ] && [ ! -s coverage.lcov ]; then
echo "First attempt created empty file, trying with minimal exclusions..."
cd build
lcov --capture --directory . --output-file ../coverage.lcov \
--base-directory "$(cd .. && pwd)" \
--rc lcov_branch_coverage=1 \
--exclude '*/CMakeFiles/*' \
--quiet 2>&1 | head -20 || echo "lcov generation with minimal exclusions had issues"
cd ..
fi
fi

echo "=== Validating coverage files ==="
# Check if coverage files exist and have content
if [ -f coverage.xml ] && [ -s coverage.xml ]; then
echo "coverage.xml exists and has content ($(wc -l < coverage.xml) lines)"
head -5 coverage.xml
else
echo "ERROR: coverage.xml is missing or empty!"
fi

if [ -f coverage.lcov ] && [ -s coverage.lcov ]; then
echo "coverage.lcov exists and has content ($(wc -l < coverage.lcov) lines)"
head -10 coverage.lcov
else
echo "WARNING: coverage.lcov is missing or empty!"
echo "Will fallback to XML format"
fi

echo "=== Coverage files generated ==="
ls -la coverage.* || echo "No coverage files found"

Expand All @@ -770,25 +837,48 @@ jobs:

echo "=== Checking required files ==="
ls -la sonar-project.properties || echo "sonar-project.properties not found"
ls -la coverage.xml || echo "coverage.xml not found"
ls -la "${{ env.BUILD_WRAPPER_OUT_DIR }}" || echo "Build wrapper output directory not found"
ls -la coverage.xml coverage.lcov 2>/dev/null || echo "Coverage files not found"

echo "=== Checking coverage file formats ==="
if [ -f coverage.lcov ]; then
echo "--- coverage.lcov (first 10 lines) ---"
head -10 coverage.lcov || echo "Cannot read coverage.lcov"
fi
if [ -f coverage.xml ]; then
echo "--- coverage.xml (first 10 lines) ---"
head -10 coverage.xml || echo "Cannot read coverage.xml"
fi

echo "=== Running SonarCloud analysis ==="
sonar-scanner \
# Build scanner command base
SCANNER_CMD="sonar-scanner \
-Dsonar.projectKey=fernandotonon_QtMeshEditor \
-Dsonar.organization=fernandotonon \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login="$SONAR_TOKEN" \
-Dsonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
-Dsonar.cfamily.gcov.reportsPath=. \
-Dsonar.cfamily.compile-commands=build/compile_commands.json \
-Dsonar.coverage.jacoco.xmlReportPaths=coverage.xml \
-Dsonar.login=\"\$SONAR_TOKEN\" \
-Dsonar.sources=src/ \
-Dsonar.tests=src/,tests/ \
-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.verbose=true || echo "SonarCloud analysis completed with warnings"
-Dsonar.c.file.suffixes=- \
-Dsonar.cpp.file.suffixes=- \
-Dsonar.objc.file.suffixes=- \
-Dsonar.verbose=true"

# Only add coverage if file exists and is not empty
if [ -f coverage.lcov ] && [ -s coverage.lcov ]; then
echo "Using LCOV format for coverage"
SCANNER_CMD="$SCANNER_CMD -Dsonar.coverageReportPaths=coverage.lcov"
elif [ -f coverage.xml ] && [ -s coverage.xml ]; then
echo "Using XML format for coverage (LCOV not available)"
SCANNER_CMD="$SCANNER_CMD -Dsonar.coverageReportPaths=coverage.xml"
else
echo "WARNING: No coverage file found! Skipping coverage reporting."
fi

# Execute scanner
eval $SCANNER_CMD || echo "SonarCloud analysis completed with warnings"



Expand All @@ -799,6 +889,7 @@ jobs:
name: coverage-reports
path: |
coverage.xml
coverage.lcov
coverage.html

####################################################################
Expand All @@ -812,8 +903,8 @@ jobs:
run: |
sudo mkdir /usr/local/lib
sudo mkdir /usr/local/include
sudo chmod -R 777 /usr/local/lib
sudo chmod -R 777 /usr/local/include
sudo chmod 777 /usr/local/lib
sudo chmod 777 /usr/local/include

- name: Cache Assimp
id: cache-assimp-macos
Expand Down Expand Up @@ -857,8 +948,8 @@ jobs:
run: |
sudo mkdir /usr/local/lib
sudo mkdir /usr/local/include
sudo chmod -R 777 /usr/local/lib
sudo chmod -R 777 /usr/local/include
sudo chmod 777 /usr/local/lib
sudo chmod 777 /usr/local/include

- name: Cache Assimp
id: cache-assimp-macos
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ DartConfiguration.tcl

# Temporary test files
TESTING_CRASH_FIX.md
Ch14_1001_Diffuse.png
exported.material
exported.mesh
exported.mesh.xml
exported.skeleton.xml
temp.material
temp.mesh.xml
Twist Dance.fbx.skeleton
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.24.0)
cmake_policy(SET CMP0005 NEW)
cmake_policy(SET CMP0048 NEW) # manages project version

project(QtMeshEditor VERSION 2.0.5 LANGUAGES CXX)
project(QtMeshEditor VERSION 2.0.6 LANGUAGES CXX)
message(STATUS "Building QtMeshEditor version ${PROJECT_VERSION}")

set(QTMESHEDITOR_VERSION_STRING "\"${PROJECT_VERSION}\"")
Expand Down
22 changes: 11 additions & 11 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
sonar.projectKey=fernandotonon_QtMeshEditor
sonar.organization=fernandotonon
sonar.cfamily.gcov.reportsPath=./

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=QtMeshEditor
Expand All @@ -25,13 +24,14 @@ sonar.exclusions=**/OgreXML/**,**/dependencies/**,**/*_autogen/**,**/CMakeFiles/
# Coverage exclusions - exclude test files from coverage calculation
sonar.coverage.exclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp,tests/**/*.qml,**/*_autogen/**

# C++ specific settings
sonar.cfamily.compile-commands=compile_commands.json
sonar.cfamily.cache.enabled=true
sonar.cfamily.threads=4

# Quality gate settings for comprehensive test coverage
sonar.coverage.jacoco.xmlReportPaths=coverage.xml

# Additional coverage settings
sonar.coverageReportPaths=coverage.xml
# Coverage settings for C++ projects without cfamily plugin
# Note: Generic coverage support in SonarQube is limited for C++
# 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=-
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ if(BUILD_TESTS)
endif()
endforeach()

# Add all files ending with _test.cpp to the set
file(GLOB TestFiles "*_test.cpp")
# Add all files ending with _test.cpp to the set (recursively to include subdirectories like Assimp)
file(GLOB_RECURSE TestFiles "${CMAKE_CURRENT_SOURCE_DIR}/*_test.cpp")
foreach(TestFile ${TestFiles})
list(APPEND TEST_SOURCES ${TestFile})
endforeach()
Expand Down Expand Up @@ -371,7 +371,7 @@ else()
ENDIF()
SET(OGRELIBLIST ${OGRELIBLIST}
OgreMain
Codec_Assimp
#Codec_Assimp
Codec_STBI
RenderSystem_GL
Plugin_OctreeSceneManager
Expand Down
20 changes: 12 additions & 8 deletions src/EditorViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ MainWindow* EditorViewport::getMainWindow() const

void EditorViewport::paintEvent(QPaintEvent *e)
{
if (m_pOgreWidget->hasFocus())
// Safety check: don't access OgreWidget if it's being destroyed
if (m_pOgreWidget)
{
setPalette(QPalette(QColor(0, 255, 127)));
setAutoFillBackground(true);
}
else
{
setPalette(QGuiApplication::palette());
setAutoFillBackground(true);
if (m_pOgreWidget->hasFocus())
{
setPalette(QPalette(QColor(0, 255, 127)));
setAutoFillBackground(true);
}
else
{
setPalette(QGuiApplication::palette());
setAutoFillBackground(true);
}
}

QDockWidget::paintEvent(e);
Expand Down
Loading
Loading