🎉 Added test coverage to sonarscan

This commit is contained in:
2022-05-12 13:50:09 +02:00
parent f508e54ab0
commit 0dc0920b22
6 changed files with 153 additions and 7 deletions

View File

@ -3,8 +3,9 @@ on:
push:
branches:
- master
- dev
pull_request:
types: [opened, synchronize, reopened]
types: [ opened, synchronize, reopened ]
jobs:
build:
name: sonarcloud scan
@ -15,6 +16,8 @@ jobs:
BUILD_WRAPPER_OUT_DIR: sonar-out # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
@ -38,18 +41,23 @@ jobs:
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Configure
run: cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=ON .
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TEST=ON -DENABLE_COVERAGE=ON .
- name: Run build-wrapper
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -j4
- name: Test
run: ctest .
run: ctest --output-on-failure .
- name: Generate coverage
run: make gcov
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
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 }}"