-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathJenkinsfile
120 lines (107 loc) · 4.75 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
pipeline {
/*
* Defining where to run
*/
//// Any:
// agent any
//// By agent label:
// agent { label 'sandybridge' }
agent { label 'jenkinsfile' }
triggers {
pollSCM('H/10 * * * *')
}
environment {
XX="gcc"
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '50'))
timestamps()
}
stages {
stage ('build') {
steps {
sh '''#!/bin/bash -el
# The -x flags indicates to echo all commands, thus knowing exactly what is being executed.
# The -e flags indicates to halt on error, so no more processing of this script will be done
# if any command exits with value other than 0 (zero)
# loads modules
module load gcc/10.2.0
module load mkl/2020.0.166
module load openmpi/4.1.0-gcc-10.2.0
module load starpu/1.2.10-gcc-10.2.0-mkl-openmpi-4.1.0
module load gsl/2.6-gcc-10.2.0
module load cmake/3.21.2
# variables
BUILDDIR="$WORKSPACE/build/"
INSTALLDIR="$BUILDDIR/install-dir/"
set -x
# initialise git submodule
git submodule update --init
mkdir -p $BUILDDIR && cd $BUILDDIR && rm -rf ./CMake*
cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALLDIR # -DMPIEXEC=$(which mpirun)
# Build only
make
# Install
make install
'''
}
}
stage ('test') {
steps {
sh '''#!/bin/bash -el
# The -x flags indicates to echo all commands, thus knowing exactly what is being executed.
# The -e flags indicates to halt on error, so no more processing of this script will be done
# if any command exits with value other than 0 (zero)
# loads modules
module load gcc/10.2.0
module load mkl/2020.0.166
module load openmpi/4.1.0-gcc-10.2.0
module load starpu/1.2.10-gcc-10.2.0-mkl-openmpi-4.1.0
module load gsl/2.6-gcc-10.2.0
module load cmake/3.21.2
# variables
BUILDDIR="$WORKSPACE/build/"
INSTALLDIR="$BUILDDIR/install-dir/"
set -x
# Tests
# Set OMP number of threads to number of real cpu cores
# to avoid differences when HT enabled machines.
##nthreads=`lscpu | grep "^Thread" | cut -d: -f 2 | tr -d " "`
#nsockets=`grep "^physical id" /proc/cpuinfo | sort | uniq | wc -l`
#ncorepersocket=`grep "^core id" /proc/cpuinfo | sort | uniq | wc -l`
#export OMP_NUM_THREADS=$(( nsockets * ncorepersocket ))
# Delete previous CTest results and run tests
rm -rf $BUILDDIR/Testing
cd $BUILDDIR
if [ "master" == "$BRANCH_NAME" ]
then
# if master branch, run full set of tests
ctest --no-compress-output -T Test
else
# Run every fourth test
ctest --no-compress-output -T Test -I 1,,4
fi
# archive
cd $INSTALLDIR
rm -f starsh.tgz
tar -zcf starsh.tgz ./*
'''
archiveArtifacts allowEmptyArchive: true, artifacts: 'build/install-dir/starsh.tgz'
}
}
stage ('docs') {
steps {
sh "cd $WORKSPACE/build && make docs"
sh '''#!/bin/bash -ex
cd $WORKSPACE
rm -rf cppcheckhtml
cppcheck --enable=all --xml --xml-version=2 testing/ src/ examples/ -I include/ 2> cppcheck.xml
cppcheck-htmlreport --source-encoding="iso8859-1" --title="STARS-H" --source-dir=. --report-dir=cppcheckhtml --file=cppcheck.xml
'''
publishHTML( target: [allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/docs/html', reportFiles: 'index.html', reportName: 'Doxygen Documentation', reportTitles: ''] )
publishHTML( target: [allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'cppcheckhtml', reportFiles: 'index.html', reportName: 'CppCheckReport', reportTitles: ''] )
}
}
}
}