-
Notifications
You must be signed in to change notification settings - Fork 7
117 lines (96 loc) · 3.19 KB
/
ci-code_analysis-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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Leka - LekaOS
# Copyright 2021 APF France handicap
# SPDX-License-Identifier: Apache-2.0
name: Code Analysis - Sonarcloud
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run:
runs-on: ubuntu-22.04
steps:
#
# Mark: - Setup
#
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup CI
uses: ./.github/actions/setup
with:
ccache_key: ${{ runner.os }}-ccache-code_analysis-sonarcloud
ccache_restore_keys: |
${{ runner.os }}-ccache-code_analysis-sonarcloud-
${{ runner.os }}-ccache-code_analysis-
${{ runner.os }}-ccache-
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
#
# Mark: - SonarCloud
#
- name: Download SonarCloud build wrapper
run: |
wget ${{ env.SONARCLOUD_BUILD_WRAPPER_URL }}
unzip ${{ env.SONARCLOUD_BUILD_WRAPPER_FILENAME }} && rm -rf ${{ env.SONARCLOUD_BUILD_WRAPPER_FILENAME }}
mv ${{ env.SONARCLOUD_BUILD_WRAPPER_EXTRACT_DIRECTORY }} ~/build-wrapper
echo "~/build-wrapper" >> $GITHUB_PATH
- name: Download sonar-scanner
run: |
wget ${{ env.SONARCLOUD_CLI_URL }}
unzip ${{ env.SONARCLOUD_CLI_FILENAME }} && rm -rf ${{ env.SONARCLOUD_CLI_FILENAME }}
mv ${{ env.SONARCLOUD_CLI_EXTRACT_DIRECTORY }} ~/sonar-scanner
echo "~/sonar-scanner/bin" >> $GITHUB_PATH
- name: Cache sonarcloud cache
id: global_cache-sonarcloud
uses: actions/cache@v4
with:
path: ${{ env.SONARCLOUD_CACHE_DIR}}
key: ${{ runner.os }}-global_cache-sonarcloud-${{ github.event.number }}-${{ env.CACHE_NOW_TIME }}
restore-keys: |
${{ runner.os }}-global_cache-sonarcloud-${{ github.event.number }}
${{ runner.os }}-global_cache-sonarcloud-
#
# Mark: - Build
#
- name: Ccache pre build
run: |
make ccache_prebuild
- name: Config, build LekaOS & al.
run: |
make config config_tools ENABLE_LOG_DEBUG=ON
build-wrapper-linux-x86-64 --out-dir bw-output make
- name: Ccache post build
run: |
make ccache_postbuild
ccache -z
- name: Ccache pre unit tests
run: |
make ccache_prebuild
- name: Config, build & run unit tests
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
make config_unit_tests
make unit_tests
make coverage_sonarqube GCOV_EXEC=/usr/bin/gcov-12
- name: Ccache post unit tests
run: |
make ccache_postbuild
ccache -z
- name: Run sonar-scanner
run: |
sonar-scanner -X -Dsonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}