mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 20:03:41 +01:00
[jenkins] build osx against persistent triqs; dockerhub
Also sync with app4triqs
This commit is contained in:
parent
dae191720c
commit
6ef318d4b9
@ -1,11 +1,12 @@
|
|||||||
# See ../triqs/packaging for other options
|
# See ../triqs/packaging for other options
|
||||||
FROM flatironinstitute/triqs:master-ubuntu-clang
|
FROM flatironinstitute/triqs:master-ubuntu-clang
|
||||||
|
|
||||||
COPY . ${SRC}/dft_tools
|
ARG APPNAME=dft_tools
|
||||||
WORKDIR ${BUILD}/dft_tools
|
COPY . $SRC/$APPNAME
|
||||||
|
WORKDIR $BUILD/$APPNAME
|
||||||
RUN chown build .
|
RUN chown build .
|
||||||
USER build
|
USER build
|
||||||
ARG Build_Documentation=0
|
ARG BUILD_DOC=0
|
||||||
RUN cmake ${SRC}/dft_tools -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${Build_Documentation} && make -j2 && make test
|
RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} && make -j2 && make test
|
||||||
USER root
|
USER root
|
||||||
RUN make install
|
RUN make install
|
||||||
|
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@ -1,7 +1,8 @@
|
|||||||
def projectName = "dft_tools"
|
def projectName = "dft_tools"
|
||||||
|
def documentationPlatform = "ubuntu-clang"
|
||||||
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
||||||
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
|
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
|
||||||
def documentationPlatform = "ubuntu-clang"
|
def publish = !env.BRANCH_NAME.startsWith("PR-")
|
||||||
|
|
||||||
properties([
|
properties([
|
||||||
disableConcurrentBuilds(),
|
disableConcurrentBuilds(),
|
||||||
@ -14,9 +15,11 @@ properties([
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
/* map of all builds to run, populated below */
|
||||||
def platforms = [:]
|
def platforms = [:]
|
||||||
|
|
||||||
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
|
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
|
||||||
|
/* .each is currently broken in jenkins */
|
||||||
for (int i = 0; i < dockerPlatforms.size(); i++) {
|
for (int i = 0; i < dockerPlatforms.size(); i++) {
|
||||||
def platform = dockerPlatforms[i]
|
def platform = dockerPlatforms[i]
|
||||||
platforms[platform] = { -> node('docker') {
|
platforms[platform] = { -> node('docker') {
|
||||||
@ -28,10 +31,10 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
|
|||||||
mv -f Dockerfile.jenkins Dockerfile
|
mv -f Dockerfile.jenkins Dockerfile
|
||||||
"""
|
"""
|
||||||
/* build and tag */
|
/* build and tag */
|
||||||
def img = docker.build("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg Build_Documentation=${platform==documentationPlatform} .")
|
def img = docker.build("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg BUILD_DOC=${platform==documentationPlatform} .")
|
||||||
if (env.BRANCH_NAME.startsWith("PR-") || platform != documentationPlatform) {
|
if (!publish || platform != documentationPlatform) {
|
||||||
/* but we don't need the tag so clean it up (except for documentation) */
|
/* but we don't need the tag so clean it up (except for documentation) */
|
||||||
sh "docker rmi ${img.imageName()}"
|
sh "docker rmi --no-prune ${img.imageName()}"
|
||||||
}
|
}
|
||||||
} }
|
} }
|
||||||
} }
|
} }
|
||||||
@ -50,26 +53,20 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
|||||||
def tmpDir = pwd(tmp:true)
|
def tmpDir = pwd(tmp:true)
|
||||||
def buildDir = "$tmpDir/build"
|
def buildDir = "$tmpDir/build"
|
||||||
def installDir = "$tmpDir/install"
|
def installDir = "$tmpDir/install"
|
||||||
|
def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}"
|
||||||
dir(installDir) {
|
dir(installDir) {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
copyArtifacts(projectName: triqsProject, selector: upstream(fallbackToLastSuccessful: true), filter: "osx-${platform}.zip")
|
|
||||||
unzip(zipFile: "osx-${platform}.zip", dir: installDir)
|
|
||||||
/* fixup zip-stripped permissions (JENKINS-13128) */
|
|
||||||
sh "chmod +x $installDir/bin/*"
|
|
||||||
|
|
||||||
checkout scm
|
checkout scm
|
||||||
|
|
||||||
dir(buildDir) { withEnv(platformEnv[1]+[
|
dir(buildDir) { withEnv(platformEnv[1]+[
|
||||||
"PATH=$installDir/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin",
|
"PATH=$triqsDir/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin",
|
||||||
"CPATH=$installDir/include",
|
"CPATH=$triqsDir/include",
|
||||||
"LIBRARY_PATH=$installDir/lib",
|
"LIBRARY_PATH=$triqsDir/lib",
|
||||||
"CMAKE_PREFIX_PATH=$installDir/share/cmake"]) {
|
"CMAKE_PREFIX_PATH=$triqsDir/share/cmake"]) {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
sh "cmake $srcDir -DTRIQS_ROOT=$installDir"
|
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir"
|
||||||
sh "make -j2"
|
sh "make -j3"
|
||||||
try {
|
try {
|
||||||
sh "make test"
|
sh "make test"
|
||||||
} catch (exc) {
|
} catch (exc) {
|
||||||
@ -78,16 +75,15 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
|||||||
}
|
}
|
||||||
sh "make install"
|
sh "make install"
|
||||||
} }
|
} }
|
||||||
// zip(zipFile: "osx-${platform}.zip", archive: true, dir: installDir)
|
|
||||||
} }
|
} }
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
parallel platforms
|
parallel platforms
|
||||||
if (!env.BRANCH_NAME.startsWith("PR-")) {
|
if (publish) { node("docker") {
|
||||||
node("docker") {
|
stage("publish") { timeout(time: 1, unit: 'HOURS') {
|
||||||
stage("documentation") { timeout(time: 1, unit: 'HOURS') {
|
def commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||||
def workDir = pwd()
|
def workDir = pwd()
|
||||||
dir("$workDir/gh-pages") {
|
dir("$workDir/gh-pages") {
|
||||||
def subdir = env.BRANCH_NAME
|
def subdir = env.BRANCH_NAME
|
||||||
@ -98,14 +94,24 @@ try {
|
|||||||
}
|
}
|
||||||
sh "git add -A ${subdir}"
|
sh "git add -A ${subdir}"
|
||||||
sh """
|
sh """
|
||||||
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Generated documentation for ${env.BRANCH_NAME}' -m "`git --git-dir ${workDir}/.git rev-parse HEAD`"
|
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Generated documentation for ${env.BRANCH_NAME}' -m '${env.BUILD_TAG} ${commit}'
|
||||||
"""
|
"""
|
||||||
// note: credentials used above don't work (need JENKINS-28335)
|
// note: credentials used above don't work (need JENKINS-28335)
|
||||||
sh "git push origin gh-pages"
|
sh "git push origin gh-pages"
|
||||||
}
|
}
|
||||||
|
dir("$workDir/docker") { try {
|
||||||
|
git(url: "ssh://git@github.com/TRIQS/docker.git", branch: env.BRANCH_NAME, credentialsId: "ssh", changelog: false)
|
||||||
|
sh "echo '160000 commit ${commit}\t${projectName}' | git update-index --index-info"
|
||||||
|
sh """
|
||||||
|
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Autoupdate ${projectName}' -m '${env.BUILD_TAG}'
|
||||||
|
"""
|
||||||
|
// note: credentials used above don't work (need JENKINS-28335)
|
||||||
|
sh "git push origin ${env.BRANCH_NAME}"
|
||||||
|
} catch (err) {
|
||||||
|
echo "Failed to update docker repo"
|
||||||
|
} }
|
||||||
|
} }
|
||||||
} }
|
} }
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (env.BRANCH_NAME != "jenkins") emailext(
|
if (env.BRANCH_NAME != "jenkins") emailext(
|
||||||
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
|
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
|
||||||
|
Loading…
Reference in New Issue
Block a user