-
Notifications
You must be signed in to change notification settings - Fork 4
48 lines (46 loc) · 1.63 KB
/
sonar.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
name: Sonar
on:
push:
branches:
- main
- sonar
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-and-scan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- { cc: clang, cxx: clang++ }
- { cc: gcc, cxx: g++ }
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Qt
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt update
sudo apt upgrade
sudo apt install lcov qtbase5-dev qtconnectivity5-dev qttools5-dev qttools5-dev-tools
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
env:
CC: ${{ matrix.env.cc }}
CXX: ${{ matrix.env.cxx }}
PROJECT_BUILD_ID: ${{ github.run_number }}.linux.x86-64.${{ matrix.env.cc }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_COVERAGE=${{ startsWith(matrix.env.cc, 'gcc') && 'ON' || 'OFF'}} -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
build-wrapper-linux-x86-64 --out-dir "$RUNNER_TEMP/sonar" cmake --build "$RUNNER_TEMP" --config Release
- name: Run sonar-scanner
# Generate only one report for now, since Sonar can only deal with one (could just as easily be clang).
if: matrix.env.cxx == 'g++' && github.actor != 'dependabot[bot]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define project.settings=.sonar.properties \
--define sonar.cfamily.build-wrapper-output="$RUNNER_TEMP/sonar"