mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 11:53:41 +01:00
[jenkins] Synchronize Jenkinsfile with app4triqs
This commit is contained in:
parent
2d491050cc
commit
9bca12d1ea
36
Jenkinsfile
vendored
36
Jenkinsfile
vendored
@ -5,18 +5,18 @@ def documentationPlatform = "ubuntu-clang"
|
||||
/* depend on triqs upstream branch/project */
|
||||
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
||||
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
|
||||
/* whether to publish the results (disabled for template project) */
|
||||
def publish = !env.BRANCH_NAME.startsWith("PR-")
|
||||
/* whether to keep and publish the results */
|
||||
def keepInstall = !env.BRANCH_NAME.startsWith("PR-")
|
||||
|
||||
properties([
|
||||
disableConcurrentBuilds(),
|
||||
buildDiscarder(logRotator(numToKeepStr: '10', daysToKeepStr: '30')),
|
||||
pipelineTriggers([
|
||||
pipelineTriggers(keepInstall ? [
|
||||
upstream(
|
||||
threshold: 'SUCCESS',
|
||||
upstreamProjects: triqsProject
|
||||
)
|
||||
])
|
||||
] : [])
|
||||
])
|
||||
|
||||
/* map of all builds to run, populated below */
|
||||
@ -38,8 +38,7 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
|
||||
"""
|
||||
/* build and tag */
|
||||
def img = docker.build("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_DOC=${platform==documentationPlatform} .")
|
||||
if (!publish || platform != documentationPlatform) {
|
||||
/* but we don't need the tag so clean it up (except for documentation) */
|
||||
if (!keepInstall) {
|
||||
sh "docker rmi --no-prune ${img.imageName()}"
|
||||
}
|
||||
} }
|
||||
@ -59,7 +58,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
||||
def srcDir = pwd()
|
||||
def tmpDir = pwd(tmp:true)
|
||||
def buildDir = "$tmpDir/build"
|
||||
def installDir = "$tmpDir/install"
|
||||
def installDir = keepInstall ? "${env.HOME}/install/${projectName}/${env.BRANCH_NAME}/${platform}" : "$tmpDir/install"
|
||||
def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}"
|
||||
dir(installDir) {
|
||||
deleteDir()
|
||||
@ -72,6 +71,8 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
||||
"LIBRARY_PATH=$triqsDir/lib:${env.BREW}/lib",
|
||||
"CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) {
|
||||
deleteDir()
|
||||
/* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */
|
||||
sh "pip install -r $srcDir/requirements.txt"
|
||||
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir"
|
||||
sh "make -j3"
|
||||
try {
|
||||
@ -89,12 +90,13 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
||||
/****************** wrap-up */
|
||||
try {
|
||||
parallel platforms
|
||||
if (publish) { node("docker") {
|
||||
if (keepInstall) { node("docker") {
|
||||
/* Publish results */
|
||||
stage("publish") { timeout(time: 1, unit: 'HOURS') {
|
||||
stage("publish") { timeout(time: 5, unit: 'MINUTES') {
|
||||
def commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||
def release = env.BRANCH_NAME == "master" || env.BRANCH_NAME == "unstable" || sh(returnStdout: true, script: "git describe --exact-match HEAD || true").trim()
|
||||
def workDir = pwd()
|
||||
lock('triqs_publish') {
|
||||
/* Update documention on gh-pages branch */
|
||||
dir("$workDir/gh-pages") {
|
||||
def subdir = "${projectName}/${env.BRANCH_NAME}"
|
||||
@ -108,22 +110,24 @@ try {
|
||||
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Generated documentation for ${subdir}' -m '${env.BUILD_TAG} ${commit}'
|
||||
"""
|
||||
// note: credentials used above don't work (need JENKINS-28335)
|
||||
sh "git push origin master || { git pull --rebase origin master && git push origin master ; }"
|
||||
sh "git push origin master"
|
||||
}
|
||||
/* Update packaging repo submodule */
|
||||
if (release) { dir("$workDir/packaging") { try {
|
||||
git(url: "ssh://git@github.com/TRIQS/packaging.git", branch: env.BRANCH_NAME, credentialsId: "ssh", changelog: false)
|
||||
sh "test -d triqs_${projectName}"
|
||||
sh "echo '160000 commit ${commit}\ttriqs_${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} || { git pull --rebase origin ${env.BRANCH_NAME} && git push origin ${env.BRANCH_NAME} ; }"
|
||||
sh """#!/bin/bash -ex
|
||||
dir="${projectName}"
|
||||
[[ -d triqs_\$dir ]] && dir=triqs_\$dir || [[ -d \$dir ]]
|
||||
echo "160000 commit ${commit}\t\$dir" | git update-index --index-info
|
||||
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' -m 'Autoupdate ${projectName}' -m '${env.BUILD_TAG}'
|
||||
git push origin ${env.BRANCH_NAME}
|
||||
"""
|
||||
} catch (err) {
|
||||
/* Ignore, non-critical -- might not exist on this branch */
|
||||
echo "Failed to update packaging repo"
|
||||
} } }
|
||||
}
|
||||
} }
|
||||
} }
|
||||
} catch (err) {
|
||||
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
# Required python packages for this application (these should also be added to Dockerfile for Jenkins)
|
Loading…
Reference in New Issue
Block a user