forked from DOI-USGS/ISIS3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
122 lines (104 loc) · 4.18 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
// vim: ft=groovy
def NUM_CORES = 8
def errors = []
def labels = ['CentOS', 'Fedora', 'Ubuntu', 'Mac'] // labels for Jenkins node types we will build on
def nodes = [:]
for (lbl in labels) {
def label = lbl
def envFile = (label == "CentOS") ? "environment_gcc4.yml" : "environment.yml"
nodes[label] = {
stage(label) {
isisNode(label) {
def isisEnv = [
"ISISDATA=/isisData/isis_data",
"ISISTESTDATA=/isisData/isis_testData",
"ISIS3MGRSCRIPTS=/isisData/data/isis3mgr_scripts",
"MALLOC_CHECK_=1"
]
def cmakeFlags = [
"-DJP2KFLAG=ON",
"-DKAKADU_INCLUDE_DIR=/isisData/kakadu",
"-Dpybindings=OFF",
"-DCMAKE_BUILD_TYPE=RELEASE"
]
def stageStatus = "Checking out ISIS on ${label}"
// Checkout
checkout scm
condaEnv("isis3") {
// Environment
loginShell """
conda install -c conda-forge python=3 findutils
conda env update -f ${envFile} --prune
mkdir build install
"""
def osFailed = false
isisEnv.add("ISISROOT=${pwd()}/build")
isisEnv.add("PATH=${pwd()}/install/bin:${env.PATH}")
cmakeFlags.add("-DCMAKE_INSTALL_PREFIX=${pwd()}/install")
withEnv(isisEnv) {
dir(env.ISISROOT) {
// Build
stageStatus = "Building ISIS on ${label}"
try {
loginShell """
cmake -GNinja ${cmakeFlags.join(' ')} ../isis
ninja -j${NUM_CORES} install
"""
} catch(e) {
// Die right here
error stageStatus
}
// Unit tests
stageStatus = "Running unit tests on ${label}"
try {
loginShell "ctest -R _unit_ -j${NUM_CORES} -VV"
} catch(e) {
errors.add(stageStatus)
osFailed = true
}
// App tests
stageStatus = "Running app tests on ${label}"
try {
loginShell "ctest -R _app_ -j${NUM_CORES} -VV"
} catch(e) {
errors.add(stageStatus)
osFailed = true
}
try {
loginShell "ctest -R _module_ -j${NUM_CORES} -VV"
} catch(e) {
errors.add(stageStatus)
osFailed = true
}
// Gtests
stageStatus = "Running gtests on ${label}"
try {
loginShell "ctest -R '.' -E '(_app_|_unit_|_module_)' -j${NUM_CORES} -VV"
} catch(e) {
errors.add(stageStatus)
osFailed = true
}
if (osFailed) {
error "Failed on ${label}"
}
}
}
}
}
}
}
}
// Run the builds in parallel
node {
try {
parallel nodes
} catch(e) {
// Report result to GitHub
currentBuild.result = "FAILURE"
def comment = "Failed during:\n"
errors.each {
comment += "- ${it}\n"
}
setGithubStatus(comment)
}
}