forked from dealii/publication-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
127 lines (117 loc) · 3.71 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!groovy
pipeline
{
agent none
stages
{
stage("test")
{
agent
{
docker
{
image 'tjhei/dealii-doc-gen:v3'
}
}
post { cleanup { cleanWs() } }
stages
{
stage("permission")
{
when { not {branch 'master'}}
steps
{
githubNotify context: 'CI', description: 'need ready to test label and /rebuild', status: 'PENDING'
// For /rebuild to work you need to:
// 1) select "issue comment" to be delivered in the github webhook setting
// 2) install "GitHub PR Comment Build Plugin" on Jenkins
// 3) in project settings select "add property" "Trigger build on pr comment" with
// the phrase ".*/rebuild.*" (without quotes)
sh '''
wget -q -O - https://api.github.com/repos/dealii/publication-list/issues/${CHANGE_ID}/labels | grep 'ready to test' || \
{ echo "This commit will only be tested when it has the label 'ready to test'. Trigger a rebuild by adding a comment that contains '/rebuild'..."; exit 1; }
'''
githubNotify context: 'CI', description: 'running tests...', status: 'PENDING'
}
}
stage("check")
{
post {
failure {
githubNotify context: 'CI', description: 'invalid characters found', status: 'FAILURE'
}
}
steps
{
// check for non-ascii characters and fail if they are present:
sh '''#!/bin/bash
grep -P "[^\\x00-\\x7F]" publications*.bib || true
! { grep -q -P "[^\\x00-\\x7F]" publications*.bib && echo "ERROR: found non-ASCII characters!"; }
'''
}
}
stage("latex")
{
post {
failure {
githubNotify context: 'CI', description: 'latex failed', status: 'FAILURE'
}
}
steps
{
sh '''
cd offline
pdflatex -interaction=nonstopmode publication_list.tex
biber publication_list
pdflatex -interaction=nonstopmode publication_list.tex
'''
archiveArtifacts artifacts: 'offline/publication_list.pdf', fingerprint: true
githubNotify context: 'latex', description: '', status: 'SUCCESS'
}
}
}
}
stage('html')
{
agent
{
docker
{
image 'tjhei/dealii-java-jabref'
}
}
post {
cleanup { cleanWs() }
failure {
githubNotify context: 'CI', description: 'html failed', status: 'FAILURE'
}
}
steps
{
timeout(time: 6, unit: 'HOURS')
{
sh '''
mkdir ~/source
cat publications-*.bib >~/source/aspect.bib
cp jabref-template/* ~/source/
cd ~; ./script.sh
sed '/publications.include/q' ~/source/output.html >$WORKSPACE/output.html
cat $WORKSPACE/publications.include >>$WORKSPACE/output.html
sed -n '/publications.include/,$p' ~/source/output.html >>$WORKSPACE/output.html
sed -i '/publications.include/d' $WORKSPACE/output.html
'''
archiveArtifacts artifacts: 'output.html', fingerprint: true
githubNotify context: 'html', description: '', status: 'SUCCESS'
}
}
}
stage("finalize")
{
agent none
steps
{
githubNotify context: 'CI', description: 'OK', status: 'SUCCESS'
}
}
}
}