forked from stan-dev/cmdstan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
185 lines (168 loc) · 6.92 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
@Library('StanUtils')
import org.stan.Utils
def utils = new org.stan.Utils()
def setupCXX(CXX = env.CXX) {
unstash 'CmdStanSetup'
writeFile(file: "make/local", text: "CXX = ${CXX}\n")
}
def runTests(String prefix = "") {
""" make -j${env.PARALLEL} build
${prefix}runCmdStanTests.py -j${env.PARALLEL} src/test/interface
"""
}
def runWinTests(String prefix = "") {
""" mingw32-make -j${env.PARALLEL} build
${prefix}runCmdStanTests.py -j${env.PARALLEL} src/test/interface
"""
}
def deleteDirWin() {
bat "attrib -r -s /s /d"
deleteDir()
}
pipeline {
agent none
options { skipDefaultCheckout() }
parameters {
string(defaultValue: '', name: 'stan_pr',
description: "Stan PR to test against. Will check out this PR in the downstream Stan repo.")
string(defaultValue: '', name: 'math_pr',
description: "Math PR to test against. Will check out this PR in the downstream Math repo.")
}
stages {
stage('Kill previous builds') {
when {
not { branch 'develop' }
not { branch 'master' }
not { branch 'downstream_tests' }
}
steps { script { utils.killOldBuilds() } }
}
stage('Clean & Setup') {
agent any
steps {
retry(3) { checkout scm }
sh 'git clean -xffd'
sh 'make stan-revert'
script {
utils.checkout_pr("stan", "stan", params.stan_pr)
utils.checkout_pr("math", "stan/lib/stan_math", params.math_pr)
}
stash 'CmdStanSetup'
}
post { always { deleteDir() }}
}
stage('Parallel tests') {
parallel {
stage('Windows interface tests') {
agent { label 'windows' }
steps {
setupCXX()
bat runWinTests()
}
post {
always {
recordIssues id: "Windows",
name: "Windows interface tests",
enabledForFailure: true,
aggregatingResults : true,
tools: [
gcc4(id: "Windows_gcc4", name: "Windows interface tests@GCC4"),
clang(id: "Windows_clang", name: "Windows interface tests@CLANG")
],
blameDisabled: false,
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]],
healthy: 10, unhealthy: 100, minimumSeverity: 'HIGH',
referenceJobName: env.BRANCH_NAME
deleteDirWin()
}
}
}
stage('Linux interface tests with MPI') {
agent {label 'linux && mpi'}
steps {
setupCXX("${MPICXX}")
sh "echo STAN_MPI=true >> make/local"
sh "echo CXX_TYPE=gcc >> make/local"
sh "make build-mpi > build-mpi.log 2>&1"
sh runTests("./")
}
post {
always {
recordIssues id: "Linux_mpi",
name: "Linux interface tests with MPI",
enabledForFailure: true,
aggregatingResults : true,
tools: [
gcc4(id: "Linux_mpi_gcc4", name: "Linux interface tests with MPI@GCC4"),
clang(id: "Linux_mpi_clang", name: "Linux interface tests with MPI@CLANG")
],
blameDisabled: false,
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]],
healthy: 10, unhealthy: 100, minimumSeverity: 'HIGH',
referenceJobName: env.BRANCH_NAME
deleteDir()
}
}
}
stage('Mac interface tests') {
agent {label 'osx'}
steps {
setupCXX()
sh runTests("./")
}
post {
always {
recordIssues id: "Mac",
name: "Mac interface tests",
enabledForFailure: true,
aggregatingResults : true,
tools: [
gcc4(id: "Mac_gcc4", name: "Mac interface tests@GCC4"),
clang(id: "Mac_clang", name: "Mac interface tests@CLANG")
],
blameDisabled: false,
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]],
healthy: 10, unhealthy: 100, minimumSeverity: 'HIGH',
referenceJobName: env.BRANCH_NAME
deleteDir()
}
}
}
stage('Upstream CmdStan Performance tests') {
when {
expression {
env.BRANCH_NAME ==~ /PR-\d+/ ||
env.BRANCH_NAME == "downstream_tests" ||
env.BRANCH_NAME == "downstream_hotfix"
}
}
steps {
script{
build(
job: "CmdStan Performance Tests/downstream_tests",
parameters: [
string(name: 'cmdstan_pr', value: env.BRANCH_NAME),
string(name: 'stan_pr', value: params.stan_pr),
string(name: 'math_pr', value: params.math_pr)
],
wait:false
)
}
}
}
}
}
}
post {
success {
script {
if (env.BRANCH_NAME == "develop") {
build job: "CmdStan Performance Tests/master", wait:false
}
utils.mailBuildResults("SUCCESSFUL")
}
}
unstable { script { utils.mailBuildResults("UNSTABLE", "[email protected]") } }
failure { script { utils.mailBuildResults("FAILURE", "[email protected]") } }
}
}