-
-
Notifications
You must be signed in to change notification settings - Fork 13
86 lines (75 loc) · 2.41 KB
/
test-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
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
name: Test SonarCloud
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
# schedule:
# cron: "0 13 * * 1" # Every monday at 13h
env:
SONAR_SCANNER_VERSION: 4.6.2.2472
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: "Dependencies: APT"
run: |
sudo apt update
sudo apt install -y \
qt6-base-dev \
libqt6opengl6-dev
# texlive-xetex
# gcovr
- name: "Dependencies: Sonar"
run: |
mkdir -p /tmp/sonar
wget \
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip \
-O /tmp/sonar/sonar-scanner.zip
unzip \
-o /tmp/sonar/sonar-scanner.zip \
-d /tmp/sonar/
wget \
https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip \
-O /tmp/sonar/build-wrapper-linux-x86.zip
unzip \
-o /tmp/sonar/build-wrapper-linux-x86.zip \
-d /tmp/sonar/
# - name: "Dependencies: Catch2"
# run: |
# git clone https://github.com/catchorg/Catch2.git
# cd Catch2
# cmake -Bbuild -H. -DBUILD_TESTING=OFF
# sudo cmake --build build/ --target install
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure
run: |
cmake \
-S. \
-Bbuild
# -DCMAKE_BUILD_TYPE=Coverage \
# -DCMAKE_CXX_COMPILER=g++ \
# -DSONAR=ON
- name: Build
run: |
/tmp/sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 \
--out-dir build_wrapper_output_directory \
cmake --build build
# --target unittest
# - name: Coverage
# run: cmake --build build --target coverage
- name: Scan
run: |
/tmp/sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin/sonar-scanner \
-Dproject.settings=.sonar-project.properties \
-Dsonar.cfamily.build-wrapper-output=build_wrapper_output_directory \
-Dsonar.host.url="https://sonarcloud.io" \
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
-Dsonar.cfamily.threads=4 \
-Dsonar.cfamily.cache.enabled=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}