forked from dealii/dealii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
227 lines (202 loc) · 6.73 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!groovy
// load library https://github.com/tjhei/jenkins-stuff to provide
// killold.killOldBuilds() function:
@Library('tjhei') _
pipeline
{
agent none
stages
{
stage("abort old")
{
agent none
steps
{
// kill older builds in this PR:
script { killold.killOldBuilds() }
}
}
stage("check")
{
agent
{
docker
{
image 'dealii/indent'
}
}
post { cleanup { cleanWs() } }
stages
{
stage("permission")
{
// skip permission check on master and release branches
when {
not {
anyOf {
branch 'master'
branch pattern: "dealii-*", comparator: "GLOB"
}
}
}
steps
{
githubNotify context: 'CI', description: 'need ready to test label and /rebuild', status: 'PENDING'
// For /rebuild to work you need to:
// 1) select "issue comment" to be delivered in the github webhook setting
// 2) install "GitHub PR Comment Build Plugin" on Jenkins
// 3) in project settings select "add property" "Trigger build on pr comment" with
// the phrase ".*/rebuild.*" (without quotes)
sh '''
wget -q -O - https://api.github.com/repos/dealii/dealii/issues/${CHANGE_ID}/labels | grep 'ready to test' || \
{ echo "This commit will only be tested when it has the label 'ready to test'. Trigger a rebuild by adding a comment that contains '/rebuild'..."; exit 1; }
'''
githubNotify context: 'CI', description: 'running tests...', status: 'PENDING'
}
}
stage("indent")
{
post {
failure {
githubNotify context: 'indent', description: 'failed', status: 'FAILURE'
}
}
steps
{
// we are finally running, so we can mark the 'ready' context from Jenkinsfile.mark as success:
githubNotify context: 'ready', description: ':-)', status: 'SUCCESS'
// We can not use 'indent' because we are missing the master branch:
// "fatal: ambiguous argument 'master': unknown revision or path"
sh '''
./contrib/utilities/indent-all
'''
sh 'git diff > changes.diff'
archiveArtifacts artifacts: 'changes.diff', fingerprint: true
sh '''
git diff --exit-code || \
{ echo "Please check indentation, see artifacts at the top right!"; exit 1; }
'''
githubNotify context: 'indent', description: '', status: 'SUCCESS'
}
}
}
}
stage('Build and Test')
{
parallel
{
stage('gcc-serial')
{
agent
{
docker
{
image 'tjhei/candi:v9.0.1-r4'
}
}
post {
always {
sh "cp /home/dealii/build/Testing/*/*.xml $WORKSPACE/serial.xml || true"
xunit tools: [CTest(pattern: '*.xml')]
sh "cp /home/dealii/build/detailed.log $WORKSPACE/detailed-serial.log || true"
archiveArtifacts artifacts: 'detailed-serial.log', fingerprint: true
}
cleanup {
cleanWs()
}
failure {
githubNotify context: 'CI', description: 'serial build failed', status: 'FAILURE'
}
}
steps
{
timeout(time: 6, unit: 'HOURS')
{
sh "echo \"building on node ${env.NODE_NAME}\""
sh '''#!/bin/bash
set -e
set -x
export NP=`grep -c ^processor /proc/cpuinfo`
export TEST_TIME_LIMIT=1200
mkdir -p /home/dealii/build
cd /home/dealii/build
cmake -G "Ninja" \
-D DEAL_II_CXX_FLAGS='-Werror' \
-D DEAL_II_CXX_FLAGS_DEBUG='-Og' \
-D DEAL_II_EARLY_DEPRECATIONS=ON \
-D CMAKE_BUILD_TYPE=Debug \
-D DEAL_II_WITH_MPI=OFF \
-D DEAL_II_UNITY_BUILD=ON \
$WORKSPACE/
time ninja -j $NP
time ninja test # quicktests
time ninja setup_tests
time ctest --output-on-failure -DDESCRIPTION="CI-$JOB_NAME" -j $NP --no-compress-output -T test
'''
}
}
}
stage('gcc-mpi')
{
agent
{
docker
{
image 'tjhei/candi:v9.0.1-r4'
}
}
post {
always {
sh "cp /home/dealii/build/Testing/*/*.xml $WORKSPACE/mpi.xml || true"
xunit tools: [CTest(pattern: '*.xml')]
sh "cp /home/dealii/build/detailed.log $WORKSPACE/detailed-mpi.log || true"
archiveArtifacts artifacts: 'detailed-mpi.log', fingerprint: true
}
cleanup {
cleanWs()
}
failure {
githubNotify context: 'CI', description: 'mpi build failed', status: 'FAILURE'
}
}
steps
{
timeout(time: 6, unit: 'HOURS')
{
sh "echo \"building on node ${env.NODE_NAME}\""
sh '''#!/bin/bash
set -e
set -x
export NP=`grep -c ^processor /proc/cpuinfo`
mkdir -p /home/dealii/build
cd /home/dealii/build
cmake -G "Ninja" \
-D DEAL_II_CXX_FLAGS='-Werror' \
-D DEAL_II_CXX_FLAGS_DEBUG='-Og' \
-D DEAL_II_EARLY_DEPRECATIONS=ON \
-D CMAKE_BUILD_TYPE=Debug \
-D DEAL_II_WITH_MPI=ON \
-D DEAL_II_UNITY_BUILD=OFF \
$WORKSPACE/
time ninja -j $NP
time ninja test # quicktests
time ninja setup_tests
time ctest -R "all-headers|multigrid/transfer|matrix_free/matrix_" --output-on-failure -DDESCRIPTION="CI-$JOB_NAME" -j $NP --no-compress-output -T test
'''
}
}
}
}
}
stage("finalize")
{
agent none
steps
{
githubNotify context: 'CI', description: 'OK', status: 'SUCCESS'
// In case the Jenkinsfile.mark job started after we did, make sure we don't leave a pending status around:
githubNotify context: 'ready', description: ':-)', status: 'SUCCESS'
}
}
}
}