forked from EUDAT-B2HANDLE/B2HANDLE
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
124 lines (124 loc) · 4.43 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
pipeline {
agent any
options {
checkoutToSubdirectory('B2HANDLE')
}
environment {
PROJECT_DIR="B2HANDLE"
GH_USER = 'newgrnetci'
GH_EMAIL = '<argo@grnet.gr>'
}
stages {
stage ('Run tests for each python version') {
parallel {
stage ('Test python 2.7') {
agent {
dockerfile {
filename "b2handle/tests/Dockerfile"
dir "$PROJECT_DIR"
additionalBuildArgs "-t eudat-b2handle"
args "-u root:root"
}
}
steps {
sh '''
cd $WORKSPACE/$PROJECT_DIR/b2handle/tests
./docker-entrypoint.sh coverage
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
stage ('Test python 3.5') {
agent {
dockerfile {
filename "b2handle/tests/Dockerfile-py3.5"
dir "$PROJECT_DIR"
additionalBuildArgs "-t eudat-b2handle:py3.5"
args "-u root:root"
}
}
steps {
sh '''
cd $WORKSPACE/$PROJECT_DIR/b2handle/tests
./docker-entrypoint.sh coverage
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
stage ('Test python 3.6') {
agent {
dockerfile {
filename "b2handle/tests/Dockerfile-py3.6"
dir "$PROJECT_DIR"
additionalBuildArgs "-t eudat-b2handle:py3.6"
args "-u root:root"
}
}
steps {
sh '''
cd $WORKSPACE/$PROJECT_DIR/b2handle/tests
./docker-entrypoint.sh coverage
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
stage ('Test python 3.7') {
agent {
dockerfile {
filename "b2handle/tests/Dockerfile-py3.7"
dir "$PROJECT_DIR"
additionalBuildArgs "-t eudat-b2handle:py3.7"
args "-u root:root"
}
}
steps {
sh '''
cd $WORKSPACE/$PROJECT_DIR/b2handle/tests
./docker-entrypoint.sh coverage
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
}
}
stage ('Deploy Docs') {
when {
changeset 'docs/**'
}
agent {
docker {
image 'python:3.7'
args "-u root:root"
}
}
steps {
echo 'Building docs...'
sh '''
cd $WORKSPACE/$PROJECT_DIR
pip install sphinx
python setup.py build_sphinx
'''
dir ("${WORKSPACE}/b2handle-pages") {
git branch: "gh-pages",
credentialsId: 'jenkins-master',
url: "git@github.com:EUDAT-B2SAFE/B2HANDLE.git"
sh """
cd ${WORKSPACE}/b2handle-pages
cp -R $WORKSPACE/$PROJECT_DIR/docs/build/html/* .
git add .
git config --global user.email ${GH_EMAIL}
git config --global user.name ${GH_USER}
git commit -m 'Update docs'
git push origin gh-pages
"""
deleteDir()
}
}
}
}
post {
always {
cleanWs()
}
}
}