mirror of
https://github.com/triqs/dft_tools
synced 2024-11-07 06:33:48 +01:00
[jenkins] Build PRs against upstream target branch
cleanup unused image tags; may want to switch away from Dockerfile to an explicit container run at some point.
This commit is contained in:
parent
4dc6aa513b
commit
0a84f48e43
27
Jenkinsfile
vendored
27
Jenkinsfile
vendored
@ -1,4 +1,5 @@
|
|||||||
def triqsProject = '/TRIQS/triqs/' + env.BRANCH_NAME.replaceAll('/', '%2F')
|
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
||||||
|
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
|
||||||
|
|
||||||
properties([
|
properties([
|
||||||
disableConcurrentBuilds(),
|
disableConcurrentBuilds(),
|
||||||
@ -16,22 +17,22 @@ def platforms = [:]
|
|||||||
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
|
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
|
||||||
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] = { ->
|
platforms[platform] = { -> stage(platform) {
|
||||||
stage(platform) {
|
|
||||||
timeout(time: 1, unit: 'HOURS') {
|
timeout(time: 1, unit: 'HOURS') {
|
||||||
node('docker') {
|
node('docker') {
|
||||||
checkout scm
|
checkout scm
|
||||||
/* construct a Dockerfile for this base */
|
/* construct a Dockerfile for this base */
|
||||||
sh '''
|
sh """
|
||||||
( echo "FROM flatironinstitute/triqs:$BRANCH_NAME-$STAGE_NAME" ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
|
( echo "FROM flatironinstitute/triqs:${triqsBranch}-${env.STAGE_NAME}" ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
|
||||||
mv -f Dockerfile.jenkins Dockerfile
|
mv -f Dockerfile.jenkins Dockerfile
|
||||||
'''
|
"""
|
||||||
/* build and tag */
|
/* build and tag */
|
||||||
def img = docker.build("flatironinstitute/dft_tools:${env.BRANCH_NAME}-${env.STAGE_NAME}")
|
def img = docker.build("flatironinstitute/dft_tools:${env.BRANCH_NAME}-${env.STAGE_NAME}")
|
||||||
|
/* but we don't need the tag so clean it up (alternatively, could refacter to run in container) */
|
||||||
|
sh "docker rmi ${img.imageName()}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def osxPlatforms = [
|
def osxPlatforms = [
|
||||||
@ -41,11 +42,10 @@ def osxPlatforms = [
|
|||||||
for (int i = 0; i < osxPlatforms.size(); i++) {
|
for (int i = 0; i < osxPlatforms.size(); i++) {
|
||||||
def platformEnv = osxPlatforms[i]
|
def platformEnv = osxPlatforms[i]
|
||||||
def platform = platformEnv[0]
|
def platform = platformEnv[0]
|
||||||
platforms["osx-$platform"] = { ->
|
platforms["osx-$platform"] = { -> stage("osx-$platform") {
|
||||||
stage("osx-$platform") {
|
|
||||||
timeout(time: 1, unit: 'HOURS') {
|
timeout(time: 1, unit: 'HOURS') {
|
||||||
node('osx && triqs') {
|
node('osx && triqs') {
|
||||||
def workDir = pwd()
|
def srcDir = pwd()
|
||||||
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"
|
||||||
@ -67,7 +67,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
|||||||
"LIBRARY_PATH=$installDir/lib",
|
"LIBRARY_PATH=$installDir/lib",
|
||||||
"CMAKE_PREFIX_PATH=$installDir/share/cmake"]) {
|
"CMAKE_PREFIX_PATH=$installDir/share/cmake"]) {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
sh "cmake $workDir -DTRIQS_ROOT=$installDir"
|
sh "cmake $srcDir -DTRIQS_ROOT=$installDir"
|
||||||
sh "make -j2"
|
sh "make -j2"
|
||||||
try {
|
try {
|
||||||
sh "make test"
|
sh "make test"
|
||||||
@ -80,8 +80,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
|||||||
// zip(zipFile: "osx-${platform}.zip", archive: true, dir: installDir)
|
// zip(zipFile: "osx-${platform}.zip", archive: true, dir: installDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parallel platforms
|
parallel platforms
|
||||||
|
Loading…
Reference in New Issue
Block a user