-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 2.04 KB
/
sonarcloud.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
name: SonarCloud Analysis
on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened
env:
SONAR_SCANNER_VERSION: 4.6.2.2472
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: 'recursive'
- name: Install the SonarCloud Client + build wrapper
run: |
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- name: Cache SonarCloud analysis results across runs
uses: actions/cache@v2
with:
path: $HOME/.sonarcache
key: sonar-${{ github.job }}-${{ runner.os }}-${{ github.sha }}
restore-keys: sonar-${{ github.job }}-${{ runner.os }}-
- name: Compile, Run and Analyse the tests
run: |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 10
sudo update-alternatives --set g++ /usr/bin/g++-9
mkdir build
cd build
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage" -DBUILD_DOCS=OFF
$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output cmake --build .
ctest
mkdir gcov
cd gcov
gcov -p ../tests//CMakeFiles/odevisualization_tests.dir/*.cpp.gcno > /dev/null
cd ../..
$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}