forked from stan-dev/stanc3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
112 lines (102 loc) · 3.72 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
@Library('StanUtils')
import org.stan.Utils
def utils = new org.stan.Utils()
/* Functions that runs a sh command and returns the stdout */
def runShell(String command){
def output = sh (returnStdout: true, script: "${command}").trim()
return "${output}"
}
pipeline {
agent none
stages {
stage("Run end-to-end tests") {
agent {
dockerfile {
filename 'docker/debian/Dockerfile'
//Forces image to ignore entrypoint
args "-u root --entrypoint=\'\'"
}
}
steps {
sh """
git clone --recursive https://github.com/stan-dev/cmdstan
cd cmdstan && make -j${env.PARALLEL} build && cd ..
"""
sh """
eval \$(opam env)
dune --version
ls cmdstan
ls "`pwd`/cmdstan"
CMDSTAN="`pwd`/cmdstan" dune runtest test/integration/good/code-gen
"""
}
post { always { runShell("rm -rf ./*")} }
}
stage("Build & Test") {
agent {
dockerfile {
filename 'docker/debian/Dockerfile'
//Forces image to ignore entrypoint
args "-u root --entrypoint=\'\'"
}
}
steps {
/* runs 'dune build @install'*/
runShell("""
eval \$(opam env)
dune build @install
""")
/*Logs the start time of tests*/
runShell("echo \$(date +'%s') > time.log")
/* runs 'dune runtest' */
echo runShell("""
eval \$(opam env)
dune runtest --verbose
""")
/*Echoes time elapsed for tests*/
echo runShell("echo \"It took \$((\$(date +'%s') - \$(cat time.log))) seconds to run the tests\"")
}
post { always { runShell("rm -rf ./*")} }
}
stage("Build & Test windows binary") {
agent { label 'windows' }
steps {
bat "bash -cl \"cd test/integration\""
bat "bash -cl \"find . -type f -name \"*.expected\" -print0 | xargs -0 dos2unix\""
bat "bash -cl \"cd ..\""
bat "bash -cl \"eval \$(opam env) make clean; dune build -x windows; dune runtest\""
}
}
stage("Build & Test static linux binary") {
agent {
dockerfile {
filename 'docker/static/Dockerfile'
//Forces image to ignore entrypoint
args "-u root --entrypoint=\'\'"
}
}
steps {
/* runs 'dune build @install' command and then outputs the stdout*/
runShell("""
eval \$(opam env)
dune build @install --profile static
""")
/*Logs the start time of tests*/
runShell("echo \$(date +'%s') > time.log")
/* runs 'dune runtest' command and then outputs the stdout*/
echo runShell("""
eval \$(opam env)
dune runtest --profile static --verbose
""")
/*Echoes time elapsed for tests*/
echo runShell("echo \"It took \$((\$(date +'%s') - \$(cat time.log))) seconds to run the tests\"")
}
post { always { runShell("rm -rf ./*")} }
}
}
post {
always {
script {utils.mailBuildResults()}
}
}
}