-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.49 KB
/
code_quality.yml
File metadata and controls
75 lines (64 loc) · 2.49 KB
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
name: Code quality analysis
on:
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- master
push:
branches:
- master
jobs:
coverage:
runs-on: ubuntu-latest
container: docker://jgeudens/qt-linux:6.8.3_build_1
steps:
- name: Checkout
uses: actions/checkout@v6.0.0
- name: Start display server
run: bash /start.sh &
- name: configure safe directory for git
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Prepare environment for Ninja build with coverage
run: |
cmake . -GNinja -DUSE_GCOV=ON
ninja
- name: Generate gcovr coverage report
run: |
ctest
gcovr --gcov-ignore-parse-errors --cobertura cobertura.xml
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
api-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
language: 'CPP'
coverage-reports: cobertura.xml
env:
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: ${{ !!env.PROJECT_TOKEN }}
sonarqube:
runs-on: ubuntu-latest
container: docker://jgeudens/qt-linux:6.8.3_build_1
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6.0.0
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v7.0
- name: Run build-wrapper
run: |
# here goes your compilation wrapped with build-wrapper; See https://docs.sonarcloud.io/advanced-setup/languages/c-c-objective-c/#analysis-steps-using-build-wrapper for more information
cmake . -GNinja
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja
if: ${{ !!env.SONAR_TOKEN && !!env.GITHUB_TOKEN }}
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v7.0
with:
# Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options
args: >
--define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
if: ${{ !!env.SONAR_TOKEN && !!env.GITHUB_TOKEN }}