-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
executable file
·86 lines (85 loc) · 2.63 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
#!/usr/bin/env groovy Jenkinsfile
pipeline {
agent {
node {
label 'master'
customWorkspace 'workspace/lotus'
}
}
triggers {
pollSCM('* * * * *')
}
stages {
stage('env init') {
steps {
sh '''
source ~/.bash_profile>/dev/null 2>&1
if [ -n "`pyenv versions | grep lotus`" ]; then pyenv virtualenv-delete -f lotus; fi
pyenv virtualenv system lotus
'''
}
}
stage('pull package') {
steps {
sh '''
if [ -n "`ls | grep lotus`" ]; then rm -rf lotus; fi
git clone https://github.com/leannmak/lotus.git
'''
}
}
stage('test') {
steps {
sh '''
source ~/.bash_profile>/dev/null 2>&1
pyenv activate lotus
pip install --upgrade pip
pip install tox
cd lotus
tox
'''
}
}
stage('dependencies install') {
steps {
sh '''
source ~/.bash_profile>/dev/null 2>&1
pyenv activate lotus
cd lotus
pip install -r requirements.txt
'''
}
}
stage('build') {
steps {
sh '''
source ~/.bash_profile>/dev/null 2>&1
pyenv activate lotus
cd lotus
python setup.py clean --all >/dev/null
python setup.py install
python -c "import lotus"
'''
}
}
}
post {
always {
junit 'lotus/nosetests.xml'
step([
$class: 'CoberturaPublisher', autoUpdateHealth: false,
autoUpdateStability: false, coberturaReportFile: 'lotus/coverage.xml',
failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0,
onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
cleanWs()
}
success {
sh '''
source ~/.bash_profile>/dev/null 2>&1
pyenv virtualenv-delete -f lotus
'''
}
failure {
emailext body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', to: '[email protected]'
}
}
}