forked from logicalclocks/hops-util-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
72 lines (70 loc) · 2.13 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
pipeline {
agent {
node {
label 'platform_testing'
}
}
stages {
stage ('setup') {
steps {
// Creates the virtualenv before proceeding
sh """
if [ ! -d $WORKSPACE/../hops-util-py-env ];
then
virtualenv --python=/usr/bin/python3.6 $WORKSPACE/../hops-util-py-env
fi
$WORKSPACE/../hops-util-py-env/bin/pip install twine sphinx sphinx-autobuild recommonmark sphinx_rtd_theme jupyter_sphinx_theme hops readme_renderer[md] boto3
rm -rf dist/*
"""
}
}
stage ('build') {
steps {
sh """
source $WORKSPACE/../hops-util-py-env/bin/activate
python ./setup.py sdist
"""
}
}
stage ('build-doc') {
steps {
sh """
source $WORKSPACE/../hops-util-py-env/bin/activate
cd docs; sphinx-apidoc -f -o source/ ../hops ../hops/distribute/ ../hops/launcher.py ../hops/grid_search.py ../hops/differential_evolution.py ../hops/random_search.py ../hops/version.py ../hops/constants.py ../hops/featurestore_impl/; make html; cd ..
"""
}
}
stage ('update-it-notebook') {
steps {
sh 'scp it_tests/integration_tests.ipynb snurran:/var/www/hops/hops-util-py_tests'
}
}
stage ('deploy-bin') {
environment {
PYPI = credentials('977daeb0-e1c8-43a0-b35a-fc37bb9eee9b')
}
steps {
sh """
source $WORKSPACE/../hops-util-py-env/bin/activate
twine upload -u $PYPI_USR -p $PYPI_PSW --skip-existing dist/*
"""
}
}
stage ('deploy-doc') {
steps {
sh """
set -x
version=`curl http://hops-py.logicalclocks.com/ --silent | grep -A1 "\\"version\\"" | tail -1`
current_version=`cat hops/version.py | head -1 | awk -F '=' {'print \$2'}`
current_version=`echo \${current_version//\\'}`
if [ `printf '%s\n' "\$version" "\$current_version" | sort -V | tail -1` == \$current_version ];
then
echo "Ignored"
else
scp -r docs/_build/html/* [email protected]:/var/www/hops-py;
fi
"""
}
}
}
}