forked from project-chip/zap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
207 lines (204 loc) · 5.2 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
pipeline
{
agent { label 'Zap-Build' }
options { buildDiscarder(logRotator(artifactNumToKeepStr: '10')) }
stages
{
stage('Git setup')
{
steps
{
script
{
checkout scm
}
}
}
stage('Npm ci')
{
steps
{
script
{
sh 'uname -a'
sh 'npm --version'
sh 'node --version'
sh 'npm ci'
sh 'npm list || true'
sh 'npm rebuild canvas --update-binary || true'
}
}
}
stage('Initial checks') {
parallel {
stage('Version stamp') {
steps
{
script
{
sh 'npm run version-stamp'
}
}
}
stage('License check')
{
steps
{
script
{
sh 'npm run lic'
}
}
}
stage('Outdated packages report')
{
steps
{
script
{
sh 'npm outdated || true'
}
}
}
}
}
stage('Generate HTML documentation')
{
steps
{
script
{
sh 'npm run doc'
}
}
}
stage('Build SPA layout for unit tests')
{
steps
{
script
{
sh 'npm run build-spa'
}
}
}
stage('Unit test execution')
{
steps
{
script
{
// Temporarily comment this out: sh 'rm -rf ~/.zap'
sh 'npm run test'
}
}
}
stage('Self check')
{
steps
{
script
{
sh 'rm -rf ~/.zap'
sh 'npm run self-check'
}
}
}
stage('Test blank generation')
{
steps
{
script
{
sh 'npm run gen'
}
}
}
stage('Test CHIP generation')
{
steps
{
script
{
sh 'npm run genchip'
sh 'python ./test/resource/chip/compare.py'
}
}
}
stage('Linux distribution artifacts')
{
steps
{
script
{
sh 'npm run dist-linux'
sh 'npm run apack:linux'
}
}
}
stage('Mac distribution artifacts')
{
steps
{
script
{
sh 'npm run dist-mac'
sh 'npm run apack:mac'
}
}
}
stage('Windows distribution artifacts')
{
steps
{
script
{
sh 'npm run dist-win'
sh 'npm run apack:win'
}
}
}
stage('Artifact creation')
{
steps
{
script
{
archiveArtifacts artifacts:'dist/zap*', fingerprint: true
}
}
}
stage('Build status resolution')
{
steps
{
script
{
currentBuild.result = 'SUCCESS'
}
}
}
}
post {
always {
script
{
def committers = emailextrecipients([[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider']])
jobName = "${currentBuild.fullDisplayName}".replace('%2', '/')
if (currentBuild.result != 'SUCCESS') {
slackMessage = ":zap_failure: FAILED: <${env.RUN_DISPLAY_URL}|" + jobName + '>, changes by: ' + committers
slackColor = '#FF0000'
slackSend (color: slackColor, channel: '#zap', message: slackMessage)
}
else
{
slackMessage = ":zap_success: SUCCESS: <${env.RUN_DISPLAY_URL}|" + jobName + '>, changes by: ' + committers
slackColor = 'good'
slackSend (color: slackColor, channel: '#zap', message: slackMessage)
}
}
cleanWs()
}
}
}