-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathJenkinsfile
188 lines (185 loc) · 3.89 KB
/
Jenkinsfile
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!groovy
@Library('jenkins-pipeline-lib@pj/new-bs') _
pipeline
{
agent any
environment
{
GIT_CHANGE_LOG = gitChangeLog(currentBuild.changeSets)
}
parameters
{
string(defaultValue: '1', description: 'Major version number (x.0.0)', name: 'MAJOR_VERSION')
string(defaultValue: '1', description: 'Minor version number (0.x.0)', name: 'MINOR_VERSION')
}
triggers
{
//At 04:00 on every day-of-week from Monday through Friday.
pollSCM('H 4 * * 1-5')
}
stages
{
stage('Setup')
{
steps
{
gitTagPreBuild "${params.MAJOR_VERSION}.${params.MINOR_VERSION}.${BUILD_NUMBER}"
echo 'Removing existing build results'
sh 'make distclean'
}
}
stage('Build')
{
steps
{
sh 'make'
}
}
stage('Test')
{
steps
{
sh 'make test'
}
post
{
always
{
// Report Tests
junit 'buildresults/test/*.xml'
}
}
}
stage('Cross compile for ARM')
{
steps
{
sh 'make CROSS=arm:cortex-m4_hardfloat BUILDRESULTS=buildresults/arm'
}
}
stage('Documentation')
{
steps
{
sh 'make docs'
}
post
{
success
{
dir('buildresults')
{
sh 'tar cf documentation.tgz docs/'
}
}
}
}
stage('CppCheck')
{
steps
{
sh 'make cppcheck-xml'
}
}
stage('Clang Tidy')
{
steps
{
sh 'make tidy'
}
}
stage('Clang Analyzer')
{
steps
{
sh 'make scan-build'
}
}
/*
stage('Coverage')
{
steps
{
sh 'make coverage'
}
post
{
success
{
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'buildresults/coverage/meson-logs/coverage.xml', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
}
}
}
*/
stage('Archive')
{
steps
{
echo 'Archiving artifacts'
dir('buildresults')
{
archiveArtifacts 'documentation.tgz'
}
}
post
{
failure
{
sendNotifications 'ARCHIVE_ERROR'
}
}
}
}
post
{
always
{
// Scan for open tasks, warnings, issues, etc.
recordIssues(
enabledForFailure: true,
healthy: 5,
unhealthy: 10,
qualityGates: [
// 3 new issue: unstable
//[threshold: 3, type: 'DELTA', unstable: true],
// 5 new issues: failed build
//[threshold: 5, type: 'DELTA', unstable: false],
// 10 total issues: unstable
//[threshold: 55, type: 'TOTAL', unstable: true],
// 20 total issues: fail
//[threshold: 75, type: 'TOTAL', unstable: false]
],
tools: [
clang(),
taskScanner(
excludePattern: 'buildresults/**, printf/**, openlibm/**, gdtoa/**',
includePattern: '**/*.c, **/*.cpp, **/*.h, **/*.hpp, **/*.lua, **/*.sh, **/*.build',
normalTags: 'TODO, to do, WIP',
highTags: 'FIXME, FIX',
ignoreCase: true,
),
cppCheck(
pattern: 'buildresults/**/cppcheck.xml',
),
]
)
// Report Status
// slackNotify(currentBuild.currentResult)
gitTagCleanup "${params.MAJOR_VERSION}.${params.MINOR_VERSION}.${BUILD_NUMBER}"
}
success
{
gitTagSuccess "${params.MAJOR_VERSION}.${params.MINOR_VERSION}.${BUILD_NUMBER}"
}
failure
{
/*
* This job does not have a GitHub configuration,
* so we need to create a dummy config
*/
githubSetConfig('69e4682e-2951-492f-b828-da06364c322d')
githubFileIssue()
emailNotify(currentBuild.currentResult)
}
}
}