-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (48 loc) · 1.76 KB
/
analyze_k8s.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
50
51
52
53
54
55
56
name: Run Sonar analysis on kubernetes
on:
workflow_dispatch:
inputs:
branch:
required: true
type: string
description: Branch to analyze
jobs:
code_analysis:
runs-on: [k8s]
defaults:
run:
working-directory: cpp
env:
BUILD_WRAPPER_OUT_DIR: ".build_wrapper_out"
SONAR_SERVER_URL: "https://sonarcloud.io"
SONAR_PROJECT_KEY: "uweseimet_scsi2pi"
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SCANNER_PATH: ../../../../sonar-scanner-5.0.1.3006-linux
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: Run build-wrapper
run: |
export PATH=$SCANNER_PATH:$PATH &&
ls -al $SCANNER_PATH &&
build-wrapper-linux-x86-64 --out-dir $BUILD_WRAPPER_OUT_DIR \
make -j $(nproc) coverage DEBUG=1
- name: Generate coverage data
run: gcovr --sonarqube > coverage.xml
- name: Run sonar-scanner
run: |
export PATH=$SCANNER_PATH:$PATH &&
sonar-scanner \
--define sonar.host.url=$SONAR_SERVER_URL \
--define sonar.projectKey=$SONAR_PROJECT_KEY \
--define sonar.organization=$SONAR_ORGANIZATION \
--define sonar.cfamily.build-wrapper-output=$BUILD_WRAPPER_OUT_DIR \
--define sonar.coverageReportPaths=coverage.xml \
--define sonar.exclusions="obj/**,lib/**,bin/**,generated/**" \
--define sonar.coverage.exclusions="test/**" \
--define sonar.cpd.exclusions="test/**"