Skip to content

libcyphal::config (#408) #723

libcyphal::config (#408)

libcyphal::config (#408) #723

Workflow file for this run

name: "libcyphal_sonar"
on:
push: # Further filtering is done in the jobs.
pull_request:
branches:
- main
- 'issue/*'
jobs:
sonarcloud:
if: >
contains(github.event.head_commit.message, '#sonar') ||
contains(github.ref, '/main') ||
contains(github.ref, '/issue/') ||
(github.event_name == 'pull_request')
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: get nunavut
run: >
pip install git+https://github.com/OpenCyphal/[email protected]
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run tests
env:
GTEST_COLOR: yes
run: >
./build-tools/bin/verify.py
--verbose
--online
--no-exceptions
--cpp-standard 14
--build-flavor Coverage
--toolchain gcc
test
- name: Generate XML coverage report
run: |
cd build
cmake --build . --target test/unittest/coverage.xml
cmake --build . --target docs/examples/coverage.xml
- name: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: Coverage-14-gcc
path: |
build/compile_commands.json
build/*/**/coverage.xml
build/*/**/*-sonarqube.xml
build/*/**/gcovr_html/*.*
if-no-files-found: error
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
sonar-scanner
-X
--define sonar.organization=opencyphal-garage
--define sonar.projectKey=OpenCyphal-Garage_libcyphal
--define sonar.projectName=libcyphal
--define sonar.projectVersion=1.0
--define sonar.sources=include,test/unittest/sonar.cpp
--define sonar.tests=test/unittest,docs/examples
--define sonar.test.inclusions=test_*.cpp,example_*.cpp
--define sonar.sourceEncoding=UTF-8
--define sonar.host.url=https://sonarcloud.io
--define sonar.cfamily.ignoreHeaderComments=false
--define sonar.coverage.exclusions="test/unittest/**/*,docs/examples/**/*,**/sonar.cpp"
--define sonar.cpd.exclusions="test/unittest/**/*,docs/examples/**/*,**/sonar.cpp"
--define sonar.cfamily.compile-commands="build/compile_commands.json"
--define sonar.cfamily.reportingCppStandardOverride=c++14
--define sonar.coverageReportPaths="build/test/unittest/coverage.xml,build/docs/examples/coverage.xml"
--define sonar.issue.ignore.multicriteria=r1
--define sonar.issue.ignore.multicriteria.r1.ruleKey=cpp:S3230
--define sonar.issue.ignore.multicriteria.r1.resourceKey=**