Skip to content

Commit

Permalink
Add stage for C/C++ sonar analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
woodfell committed Nov 14, 2023
1 parent 12f7c44 commit df1d621
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,40 @@ jobs:
-Dsonar.exclusions=java/**
-Dsonar.verbose=true
-Dsonar.c.file.suffixes=- -Dsonar.cpp.file.suffixes=-
C:
name: C Code Coverage
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Setup
run: |
sudo apt-get install llvm -y
- name: Build and Run Tests
env:
CC: clang
CXX: clang++
run: |
cmake -S c -B build -DCODE_COVERAGE=ON -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage &&
build-wrapper-linux-x86-64 --out-dir ./bw-output cmake --build build -j4 --target ccov-all-export
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_C }}
run: sonar-scanner
-X
-Dsonar.organization=swift-nav
-Dsonar.projectName=libsbp-c
-Dsonar.projectKey=swift-nav_libsbp_c
-Dsonar.verbose=true
-Dsonar.login=${{ secrets.SONAR_TOKEN_C }}
-Dsonar.cfamily.threads=4
-Dsonar.cfamily.llvm-cov.reportPath=./build/ccov/coverage.txt
-Dsonar.sources=c/src/,c/include/
-Dsonar.tests=c/test/
-Dsonar.cfamily.build-wrapper-output=./bw-output

0 comments on commit df1d621

Please sign in to comment.