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

Sonar fixes #22

Merged
merged 11 commits into from
Sep 6, 2024
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
19 changes: 15 additions & 4 deletions .github/workflows/gtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,29 @@ jobs:
run: sudo apt-get update
- name: Install libcurl
run: sudo apt-get install libcurl4-openssl-dev
- name: Set up Python 3.8 for gcovr
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: install gcovr 5.0
run: |
pip install gcovr==5.0 # 5.1 is not supported
- name: SonarQube install
uses: SonarSource/sonarcloud-github-c-cpp@v3
- name: Make build directory
run: mkdir gtest-build
- name: CMake
run: cmake -S . -B gtest-build -DCMAKE_BUILD_TYPE=Debug -DCMAKE-CXX_FLAGS=-Werror
run: cmake -S . -B gtest-build -DCMAKE_BUILD_TYPE=Debug
- name: Build Wrapper
run: build-wrapper-linux-x86-64 --out-dir sonar-out cmake --build gtest-build
- name: Run Tests
run: cd ./gtest-build && ./rapidxml-test
- name: Show coverage
run: cd ./gtest-build && gcovr -r ..
- name: Collate coverage
run: cd ./gtest-build && gcovr -r .. --sonarqube >../coverage.xml
- name: Sonar Scanner
run: sonar-scanner --define sonar.cfamily.compile-commands=sonar-out/compile_commands.json
run: sonar-scanner --define sonar.cfamily.compile-commands=sonar-out/compile_commands.json --define sonar.coverageReportPaths=coverage.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Run Tests
run: cd gtest-build && ./rapidxml-test
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ add_executable(rapidxml-test
test/xpath.cpp
rapidxml_generator.hpp
test/main.cc
rapidxml_predicates.hpp
)
target_link_libraries(rapidxml-test PRIVATE
GTest::gtest
Expand All @@ -51,6 +52,8 @@ target_include_directories(rapidxml-test
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_options(rapidxml-test PRIVATE -Werror -Wall --coverage -g -O0)
target_link_options(rapidxml-test PRIVATE --coverage -g)
if (RAPIDXML_PERF_TESTS)
message("Running performance tests")
file(DOWNLOAD https://www.w3.org/TR/xml/REC-xml-20081126.xml ${CMAKE_CURRENT_BINARY_DIR}/REC-xml-20081126.xml)
Expand Down
Loading
Loading