Skip to content

Commit

Permalink
Workflow update
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Nov 30, 2023
1 parent 876f04c commit 8dd6f9e
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
working-directory: cpp

env:
PACKAGES: gcovr protobuf-compiler libspdlog-dev libpcap-dev libprotobuf-dev libgmock-dev
PACKAGES: protobuf-compiler libspdlog-dev libpcap-dev libprotobuf-dev libgmock-dev
BUILD_WRAPPER_OUT_DIR: "$HOME/.build_wrapper_out"
SONAR_SERVER_URL: "https://sonarcloud.io"
SONAR_PROJECT_KEY: "uweseimet_scsi2pi"
Expand All @@ -28,23 +28,38 @@ jobs:
- name: Install additional packages
run: sudo apt install --yes ${{ env.PACKAGES }}

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin

- name: Set up Python for gcovr
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Build and run tests
run: make -j $(nproc) coverage DEBUG=1
- name: Install gcovr
run: pip install gcovr==5.0 # 5.1 is not supported

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1

- name: Run build-wrapper
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -j $(nproc) coverage DEBUG=1
- name: Generate coverage data
run: gcovr --sonarqube > coverage.xml

- name: Run sonar-scanner
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: cpp
args: >
-Dsonar.host.url=${{ env.SONAR_SERVER_URL }}
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }}
-Dsonar.cfamily.build-wrapper-output=${{ env.BUILD_WRAPPER_OUT_DIR }}
-Dsonar.coverageReportPaths=coverage.xml
-Dsonar.exclusions="obj/**,bin/**,generated/**"
-Dsonar.coverage.exclusions="test/**"
-Dsonar.cpd.exclusions="test/**"
run: |
sonar-scanner \
--define sonar.host.url=${{ env.SONAR_SERVER_URL }} \
--define sonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \
--define sonar.organization=${{ env.SONAR_ORGANIZATION }} \
--define sonar.cfamily.build-wrapper-output=${{ env.BUILD_WRAPPER_OUT_DIR }} \
--define sonar.coverageReportPaths=coverage.xml \
--define sonar.exclusions="obj/**,bin/**,generated/**" \
--define sonar.coverage.exclusions="test/**" \
--define sonar.cpd.exclusions="test/**"

0 comments on commit 8dd6f9e

Please sign in to comment.