1
- def projectName = " dft_tools"
1
+ def projectName = " dft_tools" /* set to app/repo name */
2
+
3
+ /* which platform to build documentation on */
2
4
def documentationPlatform = " ubuntu-clang"
5
+ /* depend on triqs upstream branch/project */
3
6
def triqsBranch = env. CHANGE_TARGET ?: env. BRANCH_NAME
4
7
def triqsProject = ' /TRIQS/triqs/' + triqsBranch. replaceAll(' /' , ' %2F' )
8
+ /* whether to publish the results (disabled for template project) */
5
9
def publish = ! env. BRANCH_NAME . startsWith(" PR-" )
6
10
7
11
properties([
@@ -18,6 +22,8 @@ properties([
18
22
/* map of all builds to run, populated below */
19
23
def platforms = [:]
20
24
25
+ /* ***************** linux builds (in docker) */
26
+ /* Each platform must have a cooresponding Dockerfile.PLATFORM in triqs/packaging */
21
27
def dockerPlatforms = [" ubuntu-clang" , " ubuntu-gcc" , " centos-gcc" ]
22
28
/* .each is currently broken in jenkins */
23
29
for (int i = 0 ; i < dockerPlatforms. size(); i++ ) {
@@ -27,11 +33,11 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
27
33
checkout scm
28
34
/* construct a Dockerfile for this base */
29
35
sh """
30
- ( echo "FROM flatironinstitute/triqs:${ triqsBranch} -${ env.STAGE_NAME} " ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
36
+ ( echo "FROM flatironinstitute/triqs:${ triqsBranch} -${ env.STAGE_NAME} " ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
31
37
mv -f Dockerfile.jenkins Dockerfile
32
38
"""
33
39
/* build and tag */
34
- def img = docker. build(" flatironinstitute/${ projectName} :${ env.BRANCH_NAME} -${ env.STAGE_NAME} " , " --build-arg BUILD_DOC=${ platform==documentationPlatform} ." )
40
+ def img = docker. build(" flatironinstitute/${ projectName} :${ env.BRANCH_NAME} -${ env.STAGE_NAME} " , " --build-arg APPNAME= ${ projectName } --build-arg BUILD_DOC=${ platform==documentationPlatform} ." )
35
41
if (! publish || platform != documentationPlatform) {
36
42
/* but we don't need the tag so clean it up (except for documentation) */
37
43
sh " docker rmi --no-prune ${ img.imageName()} "
@@ -40,6 +46,7 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
40
46
} }
41
47
}
42
48
49
+ /* ***************** osx builds (on host) */
43
50
def osxPlatforms = [
44
51
[" gcc" , [' CC=gcc-7' , ' CXX=g++-7' ]],
45
52
[" clang" , [' CC=$BREW/opt/llvm/bin/clang' , ' CXX=$BREW/opt/llvm/bin/clang++' , ' CXXFLAGS=-I$BREW/opt/llvm/include' , ' LDFLAGS=-L$BREW/opt/llvm/lib' ]]
@@ -61,9 +68,9 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
61
68
checkout scm
62
69
dir(buildDir) { withEnv(platformEnv[1 ]. collect { it. replace(' \$ BREW' , env. BREW ) } + [
63
70
" PATH=$triqsDir /bin:${ env.BREW} /bin:/usr/bin:/bin:/usr/sbin" ,
64
- " CPATH =$triqsDir /include:${ env.BREW} /include" ,
71
+ " CPLUS_INCLUDE_PATH =$triqsDir /include:${ env.BREW} /include" ,
65
72
" LIBRARY_PATH=$triqsDir /lib:${ env.BREW} /lib" ,
66
- " CMAKE_PREFIX_PATH=$triqsDir /lib/cmake/triqs" ]) {
73
+ " CMAKE_PREFIX_PATH=$triqsDir /lib/cmake/triqs" ]) {
67
74
deleteDir()
68
75
sh " cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir "
69
76
sh " make -j3"
@@ -79,18 +86,22 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
79
86
} }
80
87
}
81
88
89
+ /* ***************** wrap-up */
82
90
try {
83
91
parallel platforms
84
92
if (publish) { node(" docker" ) {
93
+ /* Publish results */
85
94
stage(" publish" ) { timeout(time : 1 , unit : ' HOURS' ) {
86
95
def commit = sh(returnStdout : true , script : " git rev-parse HEAD" ). trim()
96
+ def release = env. BRANCH_NAME == " master" || env. BRANCH_NAME == " unstable" || sh(returnStdout : true , script : " git describe --exact-match HEAD || true" ). trim()
87
97
def workDir = pwd()
98
+ /* Update documention on gh-pages branch */
88
99
dir(" $workDir /gh-pages" ) {
89
100
def subdir = " ${ projectName} /${ env.BRANCH_NAME} "
90
101
git(
url :
" ssh://[email protected] /TRIQS/TRIQS.github.io.git" ,
branch :
" master" ,
credentialsId :
" ssh" ,
changelog :
false )
91
102
sh " rm -rf ${ subdir} "
92
103
docker. image(" flatironinstitute/${ projectName} :${ env.BRANCH_NAME} -${ documentationPlatform} " ). inside() {
93
- sh " cp -rp \$ INSTALL/share/doc/${ projectName} ${ subdir} "
104
+ sh " cp -rp \$ INSTALL/share/doc/triqs_ ${ projectName} ${ subdir} "
94
105
}
95
106
sh " git add -A ${ subdir} "
96
107
sh """
@@ -99,20 +110,24 @@ try {
99
110
// note: credentials used above don't work (need JENKINS-28335)
100
111
sh " git push origin master || { git pull --rebase origin master && git push origin master ; }"
101
112
}
102
- dir(" $workDir /docker" ) { try {
113
+ /* Update docker repo submodule */
114
+ if (release) { dir(" $workDir /docker" ) { try {
103
115
git(
url :
" ssh://[email protected] /TRIQS/docker.git" ,
branch : env
. BRANCH_NAME ,
credentialsId :
" ssh" ,
changelog :
false )
104
- sh " echo '160000 commit ${ commit} \t ${ projectName} ' | git update-index --index-info"
116
+ sh " test -d ${ projectName} "
117
+ sh " echo '160000 commit ${ commit} \t triqs_${ projectName} ' | git update-index --index-info"
105
118
sh """
106
119
git commit --author='Flatiron Jenkins <[email protected] >' --allow-empty -m 'Autoupdate ${ projectName} ' -m '${ env.BUILD_TAG} '
107
120
"""
108
121
// note: credentials used above don't work (need JENKINS-28335)
109
122
sh " git push origin ${ env.BRANCH_NAME} || { git pull --rebase origin ${ env.BRANCH_NAME} && git push origin ${ env.BRANCH_NAME} ; }"
110
123
} catch (err) {
124
+ /* Ignore, non-critical -- might not exist on this branch */
111
125
echo " Failed to update docker repo"
112
- } }
126
+ } } }
113
127
} }
114
128
} }
115
129
} catch (err) {
130
+ /* send email on build failure (declarative pipeline's post section would work better) */
116
131
if (env. BRANCH_NAME != " jenkins" ) emailext(
117
132
subject : " \$ PROJECT_NAME - Build # \$ BUILD_NUMBER - FAILED" ,
118
133
body : """ \$ PROJECT_NAME - Build # \$ BUILD_NUMBER - FAILED
0 commit comments