-
Notifications
You must be signed in to change notification settings - Fork 12
85 lines (76 loc) · 2.55 KB
/
sonarqube_build.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
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
---
# Configuration script for github continuous integration service
name: SonarScanner
on:
push:
branches: [master]
paths-ignore:
- "*.md"
- "*.cff"
- "env/csv/*.csv"
- "env/maze/*.txt"
- "cfg/*.json"
- "python/*.py"
- "python/notebooks/*.ipynb"
pull_request:
branches: [master]
paths-ignore:
- "*.md"
- "*.cff"
- "env/csv/*.csv"
- "env/maze/*.txt"
- "cfg/*.json"
- "python/*.py"
- "python/notebooks/*.ipynb"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CC: gcc-9
CXX: g++-9
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Configure and Build
working-directory: build
run: |
sudo apt install lcov gcovr
cmake .. -DCMAKE_BUILD_TYPE=Debug -DXCSF_PYLIB=OFF -DENABLE_TESTS=ON -DPARALLEL=ON -DUSE_GCOV=ON
wget -q https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -q build-wrapper-linux-x86.zip
cp ./build-wrapper-linux-x86/libinterceptor-x86_64.so ./build-wrapper-linux-x86/libinterceptor-haswell.so
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make clean all
- name: Report code coverage
run: |
lcov --directory . --capture --output-file lcov.info
lcov --remove lcov.info '/usr/*' '*/extlib/*' '*/lib/*' '*/test/*' --output-file coverage.info
lcov --list coverage.info;
gcovr -r ./ -x > report.xml
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov
- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v3
- name: Sonarqube coverage
run: |
gcovr --sonarqube > coverage.xml
- name: Run sonarqube
run: sonar-scanner
-Dsonar.host.url=https://sonarcloud.io/
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
-Dsonar.projectKey=rpreen_xcsf
-Dsonar.organization=rpreen
-Dsonar.projectVersion=1.0
-Dsonar.projectBaseDir=./
-Dsonar.cfamily.build-wrapper-output=build/bw-output
-Dsonar.cfamily.cache.enabled=false
-Dsonar.cfamily.threads=1
-Dsonar.coverage.exclusions="python/**,test/**,lib/**,doc/**"
-Dsonar.exclusions="python/**,test/**,lib/**,doc/**"
-Dsonar.sourceEncoding=UTF-8
-Dsonar.coverageReportPaths=coverage.xml
...