-
Notifications
You must be signed in to change notification settings - Fork 298
/
common.groovy
573 lines (519 loc) · 18.9 KB
/
common.groovy
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
def isWindows() {
return !isUnix()
}
void standardSetup() {
echo "${env.NODE_NAME}"
if (isWindows()) {
echo "PATH: ${env.PATH}"
bat "git clean -ffdx -e OMSetup && git submodule foreach --recursive \"git clean -ffdx\""
return
}
// Jenkins cleans with -fdx; --ffdx is needed to remove git repositories
sh "git clean -ffdx && git submodule foreach --recursive git clean -ffdx"
}
def numPhysicalCPU() {
if (env.JENKINS_NUM_PHYSICAL_CPU) {
return env.JENKINS_NUM_PHYSICAL_CPU
}
if (isWindows())
{
return env.NUMBER_OF_PROCESSORS.toInteger() / 2 ?: 1
}
def uname = sh script: 'uname', returnStdout: true
if (uname.startsWith("Darwin")) {
env.JENKINS_NUM_PHYSICAL_CPU = sh (
script: 'sysctl hw.physicalcpu_max | cut -d" " -f2',
returnStdout: true
).trim().toInteger() ?: 1
} else {
env.JENKINS_NUM_PHYSICAL_CPU = sh (
script: 'lscpu -p | egrep -v "^#" | sort -u -t, -k 2,4 | wc -l',
returnStdout: true
).trim().toInteger() ?: 1
}
return env.JENKINS_NUM_PHYSICAL_CPU
}
def numLogicalCPU() {
if (env.JENKINS_NUM_LOGICAL_CPU) {
return env.JENKINS_NUM_LOGICAL_CPU
}
if (isWindows())
{
return env.NUMBER_OF_PROCESSORS.toInteger() ?: 1
}
def uname = sh script: 'uname', returnStdout: true
if (uname.startsWith("Darwin")) {
env.JENKINS_NUM_LOGICAL_CPU = sh (
script: 'sysctl hw.logicalcpu_max | cut -d" " -f2',
returnStdout: true
).trim().toInteger() ?: 1
} else {
env.JENKINS_NUM_LOGICAL_CPU = sh (
script: 'lscpu -p | egrep -v "^#" | wc -l',
returnStdout: true
).trim().toInteger() ?: 1
}
return env.JENKINS_NUM_LOGICAL_CPU
}
void partest(partition=1,partitionmodulo=1,cache=true, extraArgs='') {
if (isWindows()) {
bat ("""
set OMDEV=C:\\OMDev
echo on
(
echo export MSYS_WORKSPACE="`cygpath '${WORKSPACE}'`"
echo echo MSYS_WORKSPACE: \${MSYS_WORKSPACE}
echo export OPENMODELICAHOME="\${MSYS_WORKSPACE}/build"
echo export OPENMODELICALIBRARY="${MSYS_WORKSPACE}\\build\\lib\\omlibrary"
echo cd ${MSYS_WORKSPACE}/testsuite/partest
echo time perl ./runtests.pl -nocolour -with-xml
echo CODE=\$?
echo if test "\$CODE\" = 0 -o "\$CODE" = 7; then
echo cp -f ../runtest.db.* "${env.RUNTESTDB}/"
echo fi
echo if test "\$CODE" = 0 -o "\$CODE" = 7; then
echo exit 0
echo else
echo exit $CODE
echo fi
) > runTestWindows.sh
set MSYSTEM=UCRT64
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath '${WORKSPACE}'` && chmod +x runTestWindows.sh && ./runTestWindows.sh && rm -f ./runTestWindows.sh"
""")
} else {
sh "rm -f omc-diff.skip && ${makeCommand()} -C testsuite/difftool clean && ${makeCommand()} --output-sync=recurse -C testsuite/difftool"
sh 'build/bin/omc-diff -v1.4'
sh ("""#!/bin/bash -x
ulimit -t 1500
ulimit -v 6291456 # Max 6GB per process
cd testsuite/partest
./runtests.pl -j${numPhysicalCPU()} -partition=${partition}/${partitionmodulo} -nocolour -with-xml ${extraArgs}
CODE=\$?
test \$CODE = 0 -o \$CODE = 7 || exit 1
"""
+ (cache ?
"""
if test \$CODE = 0; then
mkdir -p "${env.RUNTESTDB}/${cacheBranchEscape()}/"
cp ../runtest.db.* "${env.RUNTESTDB}/${cacheBranchEscape()}/"
fi
""" : ''))
}
junit 'testsuite/partest/result.xml'
}
void patchConfigStatus() {
if (isUnix())
{
// Running on nodes with different paths for the workspace
sh 'sed -i.bak -e "s,--with-ombuilddir=[A-Za-z0-9./_-]*,--with-ombuilddir=`pwd`/build," -e "s,--prefix=[A-Za-z0-9./_-]*,--prefix=`pwd`/install," config.status OMCompiler/config.status'
}
}
void makeLibsAndCache() {
if (isWindows())
{
// do nothing
} else {
sh "test ! -z '${env.LIBRARIES}'"
// If we don't have any result, copy to the master to get a somewhat decent cache
sh "cp -f ${env.RUNTESTDB}/${cacheBranchEscape()}/runtest.db.* testsuite/ || " +
"cp -f ${env.RUNTESTDB}/master/runtest.db.* testsuite/ || true"
// env.WORKSPACE is null in the docker agent, so link the svn/git cache afterwards
sh label: 'Create directory for omlibrary cache', script: """
mkdir -p '${env.LIBRARIES}/om-pkg-cache'
# Remove the symbolic link, or if it's a directory there... the entire thing
rm libraries/.openmodelica/cache || rm -rf libraries/.openmodelica/cache
mkdir -p libraries/.openmodelica/
test ! -e libraries/.openmodelica/cache
ln -s '${env.LIBRARIES}/om-pkg-cache' libraries/.openmodelica/cache
ls -lh libraries/.openmodelica/cache/
"""
generateTemplates()
sh "touch omc.skip"
def cmd = "${makeCommand()} -j${numLogicalCPU()} --output-sync=recurse libs-for-testing ReferenceFiles omc-diff ffi-test-lib"
if (env.SHARED_LOCK) {
lock(env.SHARED_LOCK) {
sh cmd
}
} else {
sh cmd
}
}
}
void buildOMC(CC, CXX, extraFlags, Boolean buildCpp, Boolean clean) {
standardSetup()
if (isWindows()) {
bat ("""
set OMDEV=C:\\OMDev
echo on
(
echo export MSYS_WORKSPACE="`cygpath '${WORKSPACE}'`"
echo echo MSYS_WORKSPACE: \${MSYS_WORKSPACE}
echo cd \${MSYS_WORKSPACE}
echo export MAKETHREADS=-j16
echo set -ex
echo export OPENMODELICAHOME="\${MSYS_WORKSPACE}/build"
echo export OPENMODELICALIBRARY="\${MSYS_WORKSPACE}/build/lib/omlibrary"
echo time make -f Makefile.omdev.mingw \${MAKETHREADS} omc testsuite-depends
echo cd \${MSYS_WORKSPACE}
echo make -f Makefile.omdev.mingw \${MAKETHREADS} BUILDTYPE=Release all-runtimes
echo echo Check that omc can be started and a model can be build for NF OF with runtimes C Cpp FMU
echo echo Unset OPENMODELICALIBRARY to make sure the default is used
echo unset OPENMODELICALIBRARY
echo echo Attempt to build things using \$OPENMODELICAHOME
echo ./build/bin/omc --version
echo mkdir .sanity-check
echo cd .sanity-check
echo cp ../testsuite/sanity-check/testSanity.mos .
echo ../build/bin/omc --linearizationDumpLanguage=matlab testSanity.mos
echo export PATH=\$PATH:../build/bin/:../build/lib/omc/omsicpp:../build/lib/omc/cpp
echo ./M
echo ./M -l=1.0
echo ls linearized_model.m
echo ls M.fmu
echo rm -rf ./M* ./OMCppM* ./linear_M* ./linearized_model.m
echo ../build/bin/omc --simCodeTarget=Cpp testSanity.mos
echo ./M
echo ls M.fmu
echo rm -rf ./M* ./OMCppM*
echo cd ..
echo rm -rf .sanity-check
echo echo Testing some models from testsuite, ffi, meta
echo cd testsuite/flattening/libraries/biochem
echo ../../../rtest --return-with-error-code EnzMM.mos
echo cd \${MSYS_WORKSPACE}
echo cd testsuite/flattening/modelica/ffi
echo ../../../rtest --return-with-error-code ModelicaInternal_countLines.mos
echo ../../../rtest --return-with-error-code Integer1.mos
echo cd \${MSYS_WORKSPACE}
echo cd testsuite/metamodelica/meta
echo ../../rtest --return-with-error-code AlgPatternm.mos
echo echo Testing if we can compile in a path with spaces
echo cd \${MSYS_WORKSPACE}
echo mkdir -p ./path\\ with\\ space/
echo mv build ./path\\ with\\ space/
echo export OPENMODELICAHOME="\${MSYS_WORKSPACE}/path with space/build"
echo echo Attempt to build things using \$OPENMODELICAHOME
echo ./path\\ with\\ space/build/bin/omc --version
echo cd ./path\\ with\\ space/
echo mkdir .sanity-check
echo cd .sanity-check
echo cp ../../testsuite/sanity-check/testSanity.mos .
echo ../build/bin/omc --linearizationDumpLanguage=matlab testSanity.mos
echo export PATH=\$PATH:../build/bin/:../build/lib/omc/omsicpp:../build/lib/omc/cpp
echo ./M
echo ./M -l=1.0
echo ls linearized_model.m
echo ls M.fmu
echo rm -rf ./M* ./OMCppM* ./linear_M* ./linearized_model.m
echo ../build/bin/omc --simCodeTarget=Cpp testSanity.mos
echo ./M
echo ls M.fmu
echo rm -rf ./M* ./OMCppM*
echo cd ..
echo rm -rf .sanity-check
echo mv build/ ../.
echo cd ../../
echo rm -rf ./path\\ with\\ space/
) > buildOMCWindows.sh
set MSYSTEM=UCRT64
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath '${WORKSPACE}'` && chmod +x buildOMCWindows.sh && ./buildOMCWindows.sh && rm -f ./buildOMCWindows.sh"
""")
} else {
sh 'autoreconf --install'
// Note: Do not use -march=native since we might use an incompatible machine in later stages
def withCppRuntime = buildCpp ? "--with-cppruntime":"--without-cppruntime"
sh "./configure CC='${CC}' CXX='${CXX}' FC=gfortran CFLAGS=-Os ${withCppRuntime} --without-omc --without-omlibrary --with-omniORB --enable-modelica3d --prefix=`pwd`/install ${extraFlags}"
// OMSimulator requires HOME to be set and writeable
if (clean) {
sh label: 'clean', script: "HOME='${env.WORKSPACE}' ${makeCommand()} -j${numPhysicalCPU()} ${outputSync()} clean"
}
sh label: 'build', script: "HOME='${env.WORKSPACE}' ${makeCommand()} -j${numPhysicalCPU()} ${outputSync()} omc omc-diff omsimulator"
sh 'find build/lib/*/omc/ -name "*.so" -exec strip {} ";"'
// Run sanity tests
sh '''
mv build build.sanity-check
mkdir .sanity-check
cd .sanity-check
cp ../testsuite/sanity-check/testSanity.mos .
cat testSanity.mos
../build.sanity-check/bin/omc --linearizationDumpLanguage=matlab testSanity.mos
./M
./M -l=1.0
ls linearized_model.m
ls M.fmu
rm -rf ./M* ./OMCppM* ./linear_M* ./linearized_model.m
'''
if (buildCpp) {
sh '''
cd .sanity-check
# do not do this on Mac as it doesn't work yet
# test `uname` = Darwin || ../build.sanity-check/bin/omc --simCodeTarget=Cpp testSanity.mos
# test `uname` = Darwin || ./M
# test `uname` = Darwin || ls M.fmu
# test `uname` = Darwin || rm -rf ./M* ./OMCppM*
cd ..
mv build.sanity-check build
rm -rf .sanity-check
'''
}
sh "cd OMCompiler/Compiler/boot && ./find-unused-import.sh ../*/*.mo"
}
}
void buildOMSens() {
if (isWindows()) {
bat ("""
set OMDEV=C:\\OMDev
echo on
(
echo export MSYS_WORKSPACE="`cygpath '${WORKSPACE}'`"
echo echo MSYS_WORKSPACE: \${MSYS_WORKSPACE}
echo cd \${MSYS_WORKSPACE}
echo export MAKETHREADS=-j16
echo set -e
echo time make -f Makefile.omdev.mingw \${MAKETHREADS} omsens
) > buildOMSensWindows.sh
set MSYSTEM=UCRT64
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath '${WORKSPACE}'` && chmod +x buildOMSensWindows.sh && ./buildOMSensWindows.sh && rm -f ./buildOMSensWindows.sh"
""")
}
}
void buildOMC_CMake(cmake_args, cmake_exe='cmake') {
standardSetup()
if (isWindows()) {
bat ("""
set OMDEV=C:\\OMDev
echo on
(
echo export MSYS_WORKSPACE="`cygpath '${WORKSPACE}'`"
echo echo MSYS_WORKSPACE: \${MSYS_WORKSPACE}
echo cd \${MSYS_WORKSPACE}
echo set -ex
echo mkdir build_cmake
echo ${cmake_exe} --version
echo ${cmake_exe} -S ./ -B ./build_cmake ${cmake_args}
echo time ${cmake_exe} --build ./build_cmake --parallel ${numPhysicalCPU()} --target install
) > buildOMCWindows.sh
set MSYSTEM=UCRT64
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath '${WORKSPACE}'` && chmod +x buildOMCWindows.sh && ./buildOMCWindows.sh && rm -f ./buildOMCWindows.sh"
""")
}
else {
sh "mkdir ./build_cmake"
sh "${cmake_exe} --version"
sh "${cmake_exe} -S ./ -B ./build_cmake ${cmake_args}"
sh "${cmake_exe} --build ./build_cmake --parallel ${numPhysicalCPU()} --target install"
sh "${cmake_exe} --build ./build_cmake --parallel ${numPhysicalCPU()} --target testsuite-depends"
}
}
void buildGUI(stash, isQt5) {
if (isWindows()) {
bat ("""
set OMDEV=C:\\OMDev
echo on
(
echo export MSYS_WORKSPACE="`cygpath '${WORKSPACE}'`"
echo echo MSYS_WORKSPACE: \${MSYS_WORKSPACE}
echo cd \${MSYS_WORKSPACE}
echo export MAKETHREADS=-j16
echo set -e
echo export OPENMODELICAHOME="\${MSYS_WORKSPACE}/build"
echo export OPENMODELICALIBRARY="\${MSYS_WORKSPACE}/build/lib/omlibrary"
echo time make -f Makefile.omdev.mingw \${MAKETHREADS} qtclients
echo echo Check that at least OMEdit can be started
echo ./build/bin/OMEdit --help
) > buildGUIWindows.sh
set MSYSTEM=UCRT64
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath '${WORKSPACE}'` && chmod +x buildGUIWindows.sh && ./buildGUIWindows.sh && rm -f ./buildGUIWindows.sh"
""")
} else {
if (stash) {
standardSetup()
unstash stash
}
sh 'autoreconf --install'
if (stash) {
patchConfigStatus()
}
sh 'echo ./configure `./config.status --config` > config.status.2 && bash ./config.status.2'
// compile OMSens_Qt for Qt5
if (isQt5) {
sh "touch omc.skip omc-diff.skip ReferenceFiles.skip omsimulator.skip && ${makeCommand()} -j${numPhysicalCPU()} omc omc-diff ReferenceFiles omsimulator omparser omsens_qt" // Pretend we already built omc since we already did so
} else {
sh "touch omc.skip omc-diff.skip ReferenceFiles.skip omsimulator.skip omsens_qt.skip && ${makeCommand()} -j${numPhysicalCPU()} omc omc-diff ReferenceFiles omsimulator omparser omsens_qt" // Pretend we already built omc since we already did so
}
sh "${makeCommand()} -j${numPhysicalCPU()} ${outputSync()}" // Builds the GUI files
// test make install after qt builds
sh label: 'install', script: "HOME='${env.WORKSPACE}' ${makeCommand()} -j${numPhysicalCPU()} ${outputSync()} install ${ignoreOnMac()}"
}
}
void buildAndRunOMEditTestsuite(stash) {
if (isWindows()) {
bat ("""
set OMDEV=C:\\OMDev
echo on
(
echo export MSYS_WORKSPACE="`cygpath '${WORKSPACE}'`"
echo echo MSYS_WORKSPACE: \${MSYS_WORKSPACE}
echo cd \${MSYS_WORKSPACE}
echo export MAKETHREADS=-j16
echo set -e
echo time make -f Makefile.omdev.mingw \${MAKETHREADS} omedit-testsuite
echo export "APPDATA=\${PWD}/libraries"
echo cd build/bin
echo ./RunOMEditTestsuite.sh
) > buildOMEditTestsuiteWindows.sh
set MSYSTEM=UCRT64
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath '${WORKSPACE}'` && chmod +x buildOMEditTestsuiteWindows.sh && ./buildOMEditTestsuiteWindows.sh && rm -f ./buildOMEditTestsuiteWindows.sh"
""")
} else {
if (stash) {
standardSetup()
unstash stash
}
sh 'autoreconf --install'
if (stash) {
patchConfigStatus()
}
sh 'echo ./configure `./config.status --config` > config.status.2 && bash ./config.status.2'
if (stash) {
makeLibsAndCache()
}
sh "touch omc.skip omc-diff.skip ReferenceFiles.skip omsimulator.skip omedit.skip omplot.skip && ${makeCommand()} -j${numPhysicalCPU()} omc omc-diff ReferenceFiles omsimulator omedit omplot omparser" // Pretend we already built omc since we already did so
sh "${makeCommand()} -j${numPhysicalCPU()} --output-sync=recurse omedit-testsuite" // Builds the OMEdit testsuite
sh label: 'RunOMEditTestsuite', script: '''
HOME="\$PWD/libraries"
cd build/bin
xvfb-run ./RunOMEditTestsuite.sh
'''
}
}
void generateTemplates() {
if (isWindows()) {
// do nothing
} else {
patchConfigStatus()
// Runs Susan again, for bootstrapping tests, etc
sh "${makeCommand()} -C OMCompiler/Compiler/Template/ -f Makefile.in OMC=\$PWD/build/bin/omc"
sh 'cd OMCompiler && ./config.status'
sh './config.status'
}
}
def getVersion() {
if (isWindows()) {
return (bat (script: 'set OMDEV=C:\\OMDev && set MSYSTEM=UCRT64 && set MSYS2_PATH_TYPE=inherit && %OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "build/bin/omc --version | grep -o \"v[0-9]\\+[.][0-9]\\+[.][0-9]\\+[^ ]*\""', returnStdout: true)).replaceAll("\\s","")
} else {
return (sh (script: 'build/bin/omc --version | grep -o "v[0-9]\\+[.][0-9]\\+[.][0-9]\\+[^ ]*"', returnStdout: true)).replaceAll("\\s","")
}
}
void compliance() {
if (isWindows()) {
// do nothing for now
} else {
standardSetup()
unstash 'omc-clang'
makeLibsAndCache()
sh 'HOME=$PWD/libraries/ build/bin/omc -g=MetaModelica build/share/doc/omc/testmodels/ComplianceSuite.mos'
sh "mv ${env.COMPLIANCEPREFIX}.html ${env.COMPLIANCEPREFIX}-current.html"
sh "test -f ${env.COMPLIANCEPREFIX}.xml"
// Only publish openmodelica-current.html if we are running master
sh "cp -p ${env.COMPLIANCEPREFIX}-current.html ${env.COMPLIANCEPREFIX}${cacheBranch()=='master' ? '' : ('-' + cacheBranchEscape())}-${getVersion()}.html"
sh "test ! '${cacheBranch()}' = 'master' || rm -f ${env.COMPLIANCEPREFIX}-current.html"
stash name: "${env.COMPLIANCEPREFIX}", includes: "${env.COMPLIANCEPREFIX}-*.html"
archiveArtifacts "${env.COMPLIANCEPREFIX}*${getVersion()}.html, ${env.COMPLIANCEPREFIX}.failures"
// get rid of freaking %
sh "sed -i.bak 's/%/\\%/g' ${env.COMPLIANCEPREFIX}.ignore.xml && sed -i.bak 's/[^[:print:]]/ /g' ${env.COMPLIANCEPREFIX}.ignore.xml"
junit "${env.COMPLIANCEPREFIX}.ignore.xml"
}
}
def cacheBranch() {
return "${env.CHANGE_TARGET ?: env.GIT_BRANCH}"
}
def cacheBranchEscape() {
def name = (cacheBranch()).replace('maintenance/v','')
name = name.replace('/','-')
return name
}
def tagName() {
def name = env.TAG_NAME ?: cacheBranchEscape()
return name == "master" ? "latest" : name
}
def makeCommand() {
// OSX uses gmake as the GNU make program
return env.GMAKE ?: "make"
}
def shouldWeBuildUCRT() {
if (isPR()) {
if (pullRequest.labels.contains("CI/Build MSYS2-UCRT64")) {
return true
}
}
return params.BUILD_MSYS2_UCRT64
}
def shouldWeDisableAllCMakeBuilds() {
if (isPR()) {
if (pullRequest.labels.contains("CI/CMake/Disable/All")) {
return true
}
}
return params.DISABLE_ALL_CMAKE_BUILDS
}
def shouldWeEnableUCRTCMakeBuild() {
if (isPR()) {
if (pullRequest.labels.contains("CI/CMake/Enable/MSYS2-UCRT64")) {
return true
}
}
return params.ENABLE_MSYS2_UCRT64_CMAKE_BUILD
}
def shouldWeEnableMacOSCMakeBuild() {
if (isPR()) {
if (pullRequest.labels.contains("CI/CMake/Enable/macOS")) {
return true
}
}
return params.ENABLE_MACOS_CMAKE_BUILD
}
def shouldWeRunTests() {
if (isPR()) {
def skipTestsFilesList = [".*[.]md",
"OMEdit/.*",
"OMNotebook/.*",
"OMPlot/.*",
"OMShell/.*"]
def runTest = false
for (commitFile in pullRequest.files) {
def results = skipTestsFilesList.findAll {element -> commitFile.filename.matches(element)}
if (results.size() > 0) {
continue
} else {
runTest = true
break;
}
}
return runTest
}
return true
}
def isPR() {
return env.CHANGE_ID ? true : false
}
def outputSync()
{
def osync = sh(script: "${makeCommand()} --version | grep -o -E '[0-9]+' | head -1 | sed -e 's/^0\\+//'", returnStdout: true).toInteger() >= 4 ? "--output-sync=recurse" : ""
return osync;
}
def ignoreOnMac() {
def uname = sh script: 'uname', returnStdout: true
def ignore = ""
if (uname.startsWith("Darwin")) {
ignore = "|| true"
}
return ignore;
}
return this