-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
106 lines (100 loc) · 2.83 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
pipeline {
agent {
label "cp2k-libint"
}
stages {
stage('prepare'){
steps{
sh "./autogen.sh"
}
}
stage('build') {
parallel {
stage("lmax-4"){
steps {
script {
configure_libint(4)
}
}
}
stage("lmax-5"){
steps {
script {
configure_libint(5)
}
}
}
stage("lmax-6"){
steps {
script {
configure_libint(6)
}
}
}
stage("lmax-7"){
steps {
script {
configure_libint(7)
}
}
}
}
}
}
post {
success {
script {
tarballs = findFiles(glob: '**/*.tgz')
upload_tarballs(tarballs)
}
}
}
}
def configure_libint(lmax) {
dir("lmax-${lmax}") {
withEnv(["LMAX=${lmax}"]){
sh '''../configure \
--enable-eri=1 --enable-eri2=1 --enable-eri3=1 \
--with-max-am=${LMAX} \
--with-eri-max-am=${LMAX},$((LMAX-1)) \
--with-eri2-max-am=$((LMAX+2)),$((LMAX+1)) \
--with-eri3-max-am=$((LMAX+2)),$((LMAX+1)) \
--with-opt-am=3 \
--enable-generic-code --disable-unrolling \
--with-libint-exportdir=libint-${TAG_NAME}-cp2k-lmax-${LMAX}
make export
'''
}
}
}
def upload_tarballs(tarballs) {
def release_name = "Libint ${TAG_NAME} CP2K"
withCredentials([usernamePassword(credentialsId: 'cp2k-libint_github', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) {
withEnv(["RELEASE_NAME=${release_name}"]) {
def id = sh(script:
'''curl \
-sS \
-X POST \
-H "Authorization:token ${GITHUB_TOKEN}" \
--data "{\\"tag_name\\": \\"${TAG_NAME}\\", \\"target_commitish\\": \\"master\\", \\"name\\": \\"${RELEASE_NAME}\\", \\"body\\": \\"libint ${TAG_NAME} configured for use with CP2K\\", \\"draft\\": false, \\"prerelease\\": true}" \
"https://api.github.com/repos/cp2k/libint-cp2k/releases" \
| jq -r .id \
''',
returnStdout: true)
for ( tb in tarballs ) {
def tarball_name = tb.name.replace(".tgz", "")
withEnv(["TARBALL=${tb.path}", "TARBALL_NAME=${tarball_name}", "ID=${id.trim()}"]) {
sh '''
curl \
-X POST \
-H "Authorization:token ${GITHUB_TOKEN}" \
-H "Content-Type:application/octet-stream" \
--data-binary "@${TARBALL}" \
"https://uploads.github.com/repos/cp2k/libint-cp2k/releases/${ID}/assets?name=${TARBALL_NAME}.tgz"
'''
}
}
}
}
}
// vim: set filetype=groovy ts=2 sw=2 tw=0 :