-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsonarqube.yml
More file actions
128 lines (105 loc) · 5.23 KB
/
Copy pathsonarqube.yml
File metadata and controls
128 lines (105 loc) · 5.23 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
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
118
119
120
121
122
123
124
125
126
127
128
#
# The MIT License
#
# Copyright 2024 Vector Informatik, GmbH.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
## Basic setup for sonarqube integration
name: Build
on: workflow_dispatch
env:
# Relative path from checkout to the VectorCAST Project
VC_Manage_Project="testing/Project.vcm"
# Basename of the VectorCAST Project
VC_Manage_Project_Basename="Project"
# Use "--jobs=##" to use parallel number of jobs per compiler node; otherwise, for serial build/execute set to "" or "--jobs=1"
VC_Job_Count="--jobs=4"
# Use "--incremental" to use VecteorCAST Change Based Testing; otherwise, set to ""
VC_useCBT="--incremental"
# Use CI licenses for VectorCAST Continuous Integration (headless) licenses
# set to 1 to use CI licenses and 0 to not user CI License
VCAST_USE_CI_LICENSES=0
# Build command so SQ can track the build
VC_SQ_BUILD_COMMAND="make build/Makefile"
# SQ URL
VC_SQ_URL="http://sonarqube.corp:9900/"
# SQ token
VC_SQ_Token="sqp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# SQ inclusions
VC_SQ_Include="Project_Source"
# SQ exclusions
VC_SQ_Exclude="Project_Source/generated_code/**"
# maybe left over from gitlab integration
CI_PROJECT_DIR: ${{ github.workspace }}
jobs:
build:
name: Build
runs-on: self-hosted
permissions: read-all
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# Use for only generating Junit and Cobertura metrics
- name: VectorCAST Generate Metrics
run: ${VECTORCAST_DIR}/vpython vc_scripts/vcast_exec.py ${VC_Manage_Project} --sonarqube --build-execute --junit --cobertura --exit_with_failed_count=10 ${VC_Job_Count} ${VC_useCBT}
# Cobertura reporting
- name: Publish Cobertura Report
uses: 5monkeys/cobertura-action@master
with:
path: '**/xml_data/cobertura/coverage_results*.xml'
minimum_coverage: 0
# Junit reporting
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/xml_data/junit/test_results*.xml'
detailed_summary: true
fail_on_failure: true
include_passed: true
- name: Download and install the build wrapper
shell: powershell
run: |
$path = "$HOME/.sonar/build-wrapper-win-x86.zip"
mkdir $HOME/.sonar
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-win-x86.zip", $path)
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- name: Download and install the SonarScanner
shell: powershell
run: |
$path = "$HOME/.sonar/sonar-scanner-cli-5.0.1.3006-windows.zip"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-windows.zip", $path)
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
- name: Build and analyse the project
shell: powershell
run: |
$env:Path += ";$HOME/.sonar/build-wrapper-win-x86;$HOME/.sonar/sonar-scanner-5.0.1.3006-windows/bin"
build-wrapper-win-x86-64 --out-dir bw-output ${VC_SQ_BUILD_COMMAND}
sonar-scanner -Dsonar.projectKey=Post_AVT -Dsonar.cfamily.build-wrapper-output=CurrentRelease/bw-output -Dsonar.host.url=${VC_SQ_URL} -Dsonar.token=${VC_SQ_Token} -Dsonar.lauguage=c -Dsonar.sources=${VC_SQ_Include} -Dsonar.exclusions=${VC_SQ_Exclude} -Dsonar.cfamily.cppunit.reportsPath=xml_data/sonarqube -Dsonar.cfamily.cobertura.reportPaths=xml_data/cobertura/coverage_results_${VC_Manage_Project_Basename}.xml
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}