You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2022/09/11 18:38:56 UTC

[logging-log4cxx] branch sonarcloud-coverage created (now 2b5387e3)

This is an automated email from the ASF dual-hosted git repository.

rmiddleton pushed a change to branch sonarcloud-coverage
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at 2b5387e3 build code coverage for sonarcloud

This branch includes the following new commits:

     new 2b5387e3 build code coverage for sonarcloud

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[logging-log4cxx] 01/01: build code coverage for sonarcloud

Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rmiddleton pushed a commit to branch sonarcloud-coverage
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 2b5387e33b4f0c59c56278bc571ebc11358c9f01
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sun Sep 11 14:38:42 2022 -0400

    build code coverage for sonarcloud
---
 .github/workflows/sonarcloud.yml | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
index bc4b40c8..7245b56d 100644
--- a/.github/workflows/sonarcloud.yml
+++ b/.github/workflows/sonarcloud.yml
@@ -28,7 +28,7 @@ jobs:
     name: Build
     runs-on: ubuntu-latest
     env:
-      SONAR_SCANNER_VERSION: 4.4.0.2170
+      SONAR_SCANNER_VERSION: 4.7.0.2747
       SONAR_SERVER_URL: "https://sonarcloud.io"
       BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
     steps:
@@ -42,6 +42,15 @@ jobs:
         with:
           java-version: 11
 
+      - name: Set up Python 3.8 for gcovr
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.8
+
+      - name: install gcovr 5.0
+        run: |
+          pip install gcovr==5.0 # 5.1 is not supported
+
       - name: 'Configure Dependencies - Ubuntu'
         run: |
           sudo apt-get update
@@ -68,14 +77,26 @@ jobs:
         run: |
           cd main
           mkdir build
-          cmake -DBUILD_TESTING=off -S . -B build
+          cmake -DBUILD_TESTING=on -DCMAKE_CXX_FLAGS=--coverage -D -S . -B build
           build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
 
+      - name: Run tests to generate coverage statistics
+        run: |
+          cd main/build
+          make test
+
+      - name: Collect coverage into one XML report
+        run: |
+          cd main/build
+          gcovr --sonarqube > coverage.xml
+
       - name: Run sonar-scanner
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
         run: |
           cd main
-          sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
-
+          sonar-scanner \
+            --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" \
+            --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
+            --define sonar.coverageReportPaths=build/coverage.xml