-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: static-analysis | ||
on: | ||
workflow_call: | ||
secrets: | ||
SONAR_TOKEN: | ||
required: true | ||
jobs: | ||
sonar-cloud: | ||
name: Analyze with SonarCloud | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python for gcovr | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- name: install gcovr | ||
run: | | ||
pip install gcovr | ||
- name: Install sonar-scanner and build-wrapper | ||
uses: SonarSource/sonarcloud-github-c-cpp@v2 | ||
- name: Run cmake/ctest with sonar build-wrapper | ||
run: | | ||
cmake --preset gcc-ci --fresh -G "Unix Makefiles" | ||
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset gcc-ci | ||
ctest --preset gcc-ci | ||
gcovr --sonarqube > coverage.xml | ||
- name: Run sonar-scanner | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: | | ||
sonar-scanner \ | ||
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ | ||
--define sonar.coverageReportPaths=coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sonar.projectKey=LecrisUT_CMake-Template | ||
sonar.organization=lecris | ||
|
||
sonar.projectName="CMake Template" | ||
sonar.coverage.exclusions=test/** |