-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (40 loc) · 1.56 KB
/
analyze.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Run SonarCloud analysis
on:
workflow_dispatch:
jobs:
code_analysis:
runs-on: ubuntu-latest
defaults:
run:
working-directory: cpp
env:
PACKAGES: gcovr 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"
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: Install additional packages
run: sudo apt install --yes ${{ env.PACKAGES }}
- name: Generate coverage data
run: gcovr --sonarqube > coverage.xml
- 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/**"