This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
100 lines (92 loc) · 4.4 KB
/
sonarcloud.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: SonarCloud
on:
workflow_dispatch:
jobs:
sonar-cloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Create the SonarCloud tools directory
env:
TOOLS_PATH: ${{ runner.workspace }}/sonarcloud
run: |
mkdir "$TOOLS_PATH"
- name: Install Sonar Scanner CLI
env:
TOOLS_PATH: ${{ runner.workspace }}/sonarcloud
run: |
cd "$TOOLS_PATH"
curl --location \
-o scanner.zip \
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.4.0.2170-linux.zip
unzip scanner.zip
- name: Install SonarCloud Build Wrapper
env:
TOOLS_PATH: ${{ runner.workspace }}/sonarcloud
run: |
cd "$TOOLS_PATH"
curl --location \
-o build-wrapper-linux-x86.zip \
https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip build-wrapper-linux-x86.zip
- name: Create Build Environment
env:
BUILD_PATH: ${{ runner.workspace }}/build
run: cmake -E make_directory "$BUILD_PATH"
- name: Configure
env:
BUILD_PATH: ${{ runner.workspace }}/build
run: |
cd "$BUILD_PATH"
cmake -G "Unix Makefiles" \
-D PSTORE_COVERAGE=Yes \
-D PSTORE_EXAMPLES=Yes \
"$GITHUB_WORKSPACE"
- name: Build
env:
BUILD_PATH: ${{ runner.workspace }}/build
TOOLS_PATH: ${{ runner.workspace }}/sonarcloud
BW_PATH: ${{ runner.workspace }}/bw-output
THREADS: 2
run: |
cd "$BUILD_PATH"
"$TOOLS_PATH/build-wrapper-linux-x86/build-wrapper-linux-x86-64" \
--out-dir "$BW_PATH" \
make -j $THREADS clean all pstore-system-tests
- name: Gather Coverage
env:
BUILD_PATH: ${{ runner.workspace }}/build
TOOLS_PATH: ${{ runner.workspace }}/sonarcloud
run: |
cd "$BUILD_PATH"
find . -name \*.gcno -exec gcov {} \;
- name: Run Sonar Scanner
env:
BUILD_PATH: ${{ runner.workspace }}/build
TOOLS_PATH: ${{ runner.workspace }}/sonarcloud
LOGIN: ${{ secrets.SONAR_CLOUD_LOGIN }}
BW_PATH: ${{ runner.workspace }}/bw-output
THREADS: 2
run: |
cd "$GITHUB_WORKSPACE"
"$TOOLS_PATH/sonar-scanner-4.4.0.2170-linux/bin/sonar-scanner" -X \
-Dsonar.branch.name=$(git rev-parse --abbrev-ref HEAD) \
-Dsonar.cfamily.build-wrapper-output="$BW_PATH" \
-Dsonar.cfamily.cache.enabled=false \
-Dsonar.cfamily.gcov.reportsPath="$BUILD_PATH" \
-Dsonar.cfamily.threads=$THREADS \
-Dsonar.coverage.exclusions='system_tests/**/*' \
-Dsonar.cpd.exclusions='unittests/**/*,examples/**/*' \
-Dsonar.exclusions='build/**/*,3rd_party/**/*' \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$LOGIN \
-Dsonar.organization=snsystems \
-Dsonar.projectKey=SNSystems_pstore \
-Dsonar.projectName=pstore \
-Dsonar.projectVersion=$GITHUB_SHA \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.sources=include,lib,examples \
-Dsonar.tests=system_tests,unittests