Skip to content

Fixes when including with CMake add_subdirectory() #17

Fixes when including with CMake add_subdirectory()

Fixes when including with CMake add_subdirectory() #17

Workflow file for this run

name: SonarCloud Analysis
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
workflow_dispatch:
env:
SONAR_SCANNER_VERSION: 4.4.0.2170
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Install dependencies
run: |
sudo apt install -y libyaml-cpp-dev
- name: Install the SonarCloud Client + build wrapper
run: |
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- name: Compile, Run and Analyse the tests
run: |
mkdir build
cd build
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage"
$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output cmake --build .
ctest
mkdir gcov
cd gcov
gcov -p ../test/CMakeFiles/testcerberus.dir/*.cc.gcno > /dev/null
cd ../..
$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}