Skip to content

Commit

Permalink
ci: add sonarcloud integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasDebrunner committed Dec 11, 2023
1 parent 0eaac49 commit 226af4f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,38 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
platform:
- runner: ubuntu-latest
sonarcloud-build-wrapper : build-wrapper-linux-x86-64
- runner: macos-latest
sonarcloud-build-wrapper : build-wrapper-macosx-x86
runs-on: ${{ matrix.platform.runner }}
steps:
- uses: actions/checkout@v3

- name: Install gcovr
run: pip3 install gcovr

- name: Setup sonar cloud
uses: SonarSource/[email protected]

- name: Build tests
run: cmake -B build -S .

- name: Build tests
run: mkdir build && cd build && cmake .. && make tests
- name: Run tests
run: ./tests/tests
working-directory: build
run: ${{ matrix.platform.sonarcloud-build-wrapper }} --out-dir bw-output cmake --build build

- name: Run tests and coverage
run: ./build/tests/tests

- name: Generate coverage report
run: gcovr --sonarqube -o coverage.xml build

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.AUTERION_CI_SONAR_TOKEN }}
run: |
sonar-scanner \
--define sonar.cfamily.build-wrapper-output="bw-output" \
--define sonar.coverageReportPaths=coverage.xml
13 changes: 13 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sonar.projectKey = Auterion_libmav
sonar.organization = auterion

sonar.projectName = libmav

sonar.sources = include/,tests/

sonar.exclusions = include/mav/rapidxml/,tests/doctest.h

sonar.coverage.exclusions = tests/**/*
sonar.cpd.exclusions = tests/**/*

sonar.sourceEncoding = UTF-8

0 comments on commit 226af4f

Please sign in to comment.