3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-06 22:23:52 +01:00

[cmake] Prepare packaging for 2.1.0 release

This commit is contained in:
Nils Wentzell 2019-04-26 14:25:58 -04:00
parent 816bdcb02d
commit a1ecfd883f
4 changed files with 30 additions and 14 deletions

View File

@ -1,6 +1,6 @@
# Start configuration
cmake_minimum_required(VERSION 2.8)
project(dft_tools C CXX Fortran)
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(triqs_dft_tools C CXX Fortran)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
@ -9,7 +9,7 @@ endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
endif()
message( STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} -------------")
message( STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
# Use shared libraries
set(BUILD_SHARED_LIBS ON)
@ -98,6 +98,7 @@ if(BUILD_DEBIAN_PACKAGE)
SET(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/dft_tools")
EXECUTE_PROCESS(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 2.1)")
SET(CPACK_DEBIAN_PACKAGE_CONFLICTS "dft_tools")
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
INCLUDE(CPack)

View File

@ -1,7 +1,7 @@
# See ../triqs/packaging for other options
FROM flatironinstitute/triqs:master-ubuntu-clang
ARG APPNAME=dft_tools
ARG APPNAME
COPY . $SRC/$APPNAME
WORKDIR $BUILD/$APPNAME
RUN chown build .

33
Jenkinsfile vendored
View File

@ -1,7 +1,11 @@
def projectName = "dft_tools"
def projectName = "dft_tools" /* set to app/repo name */
/* which platform to build documentation on */
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-")
properties([
@ -18,6 +22,8 @@ properties([
/* map of all builds to run, populated below */
def platforms = [:]
/****************** linux builds (in docker) */
/* Each platform must have a cooresponding Dockerfile.PLATFORM in triqs/packaging */
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
/* .each is currently broken in jenkins */
for (int i = 0; i < dockerPlatforms.size(); i++) {
@ -27,11 +33,11 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
checkout scm
/* construct a Dockerfile for this base */
sh """
( echo "FROM flatironinstitute/triqs:${triqsBranch}-${env.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
"""
/* build and tag */
def img = docker.build("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg BUILD_DOC=${platform==documentationPlatform} .")
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) */
sh "docker rmi --no-prune ${img.imageName()}"
@ -40,6 +46,7 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
} }
}
/****************** osx builds (on host) */
def osxPlatforms = [
["gcc", ['CC=gcc-7', 'CXX=g++-7']],
["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++) {
checkout scm
dir(buildDir) { withEnv(platformEnv[1].collect { it.replace('\$BREW', env.BREW) } + [
"PATH=$triqsDir/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin",
"CPATH=$triqsDir/include:${env.BREW}/include",
"CPLUS_INCLUDE_PATH=$triqsDir/include:${env.BREW}/include",
"LIBRARY_PATH=$triqsDir/lib:${env.BREW}/lib",
"CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) {
"CMAKE_PREFIX_PATH=$triqsDir/lib/cmake/triqs"]) {
deleteDir()
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir"
sh "make -j3"
@ -79,18 +86,22 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
} }
}
/****************** wrap-up */
try {
parallel platforms
if (publish) { node("docker") {
/* Publish results */
stage("publish") { timeout(time: 1, unit: 'HOURS') {
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()
/* Update documention on gh-pages branch */
dir("$workDir/gh-pages") {
def subdir = "${projectName}/${env.BRANCH_NAME}"
git(url: "ssh://git@github.com/TRIQS/TRIQS.github.io.git", branch: "master", credentialsId: "ssh", changelog: false)
sh "rm -rf ${subdir}"
docker.image("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${documentationPlatform}").inside() {
sh "cp -rp \$INSTALL/share/doc/${projectName} ${subdir}"
sh "cp -rp \$INSTALL/share/doc/triqs_${projectName} ${subdir}"
}
sh "git add -A ${subdir}"
sh """
@ -99,20 +110,24 @@ try {
// note: credentials used above don't work (need JENKINS-28335)
sh "git push origin master || { git pull --rebase origin master && git push origin master ; }"
}
dir("$workDir/docker") { try {
/* Update docker repo submodule */
if (release) { 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 "test -d ${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} ; }"
} catch (err) {
/* Ignore, non-critical -- might not exist on this branch */
echo "Failed to update docker repo"
} }
} } }
} }
} }
} catch (err) {
/* send email on build failure (declarative pipeline's post section would work better) */
if (env.BRANCH_NAME != "jenkins") emailext(
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
body: """\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED

View File

@ -10,7 +10,7 @@ A Docker image including the latest version of DFTTools is available `here <http
We further provide a Debian package for the Ubuntu LTS Versions 16.04 (xenial) and 18.04 (bionic), which can be installed by following the steps outlined :ref:`here <triqslibs:triqs_docker>`, and the subsequent command::
sudo apt-get install -y dft_tools
sudo apt-get install -y triqs_dft_tools
Compiling DFTTools from source