Skip to content

Move test fixture to seperate repo #138

Move test fixture to seperate repo

Move test fixture to seperate repo #138

Workflow file for this run

name: Sonarcloud Analysis Pipeline
on:
push:
branches:
- master
pull_request:
branches:
- '*'
env:
BUILD_DEPENDENCIES: cmake build-essential checkinstall zlib1g-dev libssl-dev libfmt-dev
BUILD_DIRECTORY: build
jobs:
sonar-cloud:
name: Sonarcloud Analysis
runs-on: ubuntu-22.04
timeout-minutes: 30
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get install -y ${{ env.BUILD_DEPENDENCIES }} gcc-11 gcovr
- name: Install sonar-scanner & build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
env:
CC: gcc-11
CXX: g++-11
run: |
cmake -S . -B ${{ env.BUILD_DIRECTORY }} \
-Dlibcore_TESTING_ENABLED=ON \
-DCODE_COVERAGE=ON \
-DCMAKE_C_FLAGS=--coverage \
-DCMAKE_CXX_FLAGS=--coverage
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{ env.BUILD_DIRECTORY }} -j10
- name: Generate coverage information
run: |
# Run tests to generate coverage information
cd ${{ env.BUILD_DIRECTORY }} && ctest -j8 -T test --no-compress-output
gcovr -r .. --sonarqube -o coverage.xml --exclude '../third_party/.*' --exclude '../coding_problems/.*'
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
-Dsonar.projectKey=lucasle-sn_libcore \
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} \
-Dsonar.projectName=libcore \
-Dsonar.projectVersion=1.0 \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" \
-Dsonar.coverageReportPaths=${{ env.BUILD_DIRECTORY }}/coverage.xml \
-Dsonar.sources=./ \
-Dsonar.tests=./ \
-Dsonar.test.inclusions=**/test/**/* \
-Dsonar.exclusions=**/test/**/*,coding_problems/**/*