This repository has been archived by the owner on Jan 24, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
jenkins-build
executable file
·82 lines (64 loc) · 2.39 KB
/
jenkins-build
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
#!/bin/sh
#
# this is the script run by the Jenkins server to run the build and tests. Be
# sure to always run it in its dir, i.e. ./run-tests.sh, otherwise it might
# remove things that you don't want it to.
if [ `dirname $0` != "." ]; then
echo "only run this script like ./`basename $0`"
exit
fi
set -e
set -x
if [ -z $WORKSPACE ]; then
WORKSPACE=`pwd`
fi
#------------------------------------------------------------------------------#
# cache pypi downloads
if [ -z $PIP_DOWNLOAD_CACHE ]; then
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
fi
#------------------------------------------------------------------------------#
# run local tests
cd $WORKSPACE/tests
./run-tests.sh
#------------------------------------------------------------------------------#
# test install using site packages
rm -rf $WORKSPACE/env
virtualenv --system-site-packages $WORKSPACE/env
. $WORKSPACE/env/bin/activate
pip install -e $WORKSPACE
# run tests in new pip+virtualenv install
. $WORKSPACE/env/bin/activate
keysync=$WORKSPACE/env/bin/keysync $WORKSPACE/tests/run-tests.sh
#------------------------------------------------------------------------------#
# test install using packages from pypi
rm -rf $WORKSPACE/env
virtualenv --no-site-packages $WORKSPACE/env
. $WORKSPACE/env/bin/activate
pip install -e $WORKSPACE
# run tests in new pip+virtualenv install
. $WORKSPACE/env/bin/activate
keysync=$WORKSPACE/env/bin/keysync $WORKSPACE/tests/run-tests.sh
#------------------------------------------------------------------------------#
# run pyflakes
cd $WORKSPACE
# there are a couple warnings to work around in keysync and keysync-gui
#pyflakes keysync keysync-gui otrapps/*.py setup.py
pyflakes otrapps/*.py setup.py
#------------------------------------------------------------------------------#
# run pylint
cd $WORKSPACE
set +e
# disable E1101 until there is a plugin to handle this properly:
# Module 'sys' has no '_MEIPASS' member
# disable F0401 until there is a plugin to handle this properly:
# keysync-gui:25: [F] Unable to import 'ordereddict'
PYTHONPATH=$WORKSPACE/.pylint-plugins \
pylint --output-format=parseable --reports=n \
--disable=E1101,F0401 \
--load-plugins astng_hashlib \
otrapps/*.py keysync keysync-gui > $WORKSPACE/pylint.parseable
# only tell jenkins there was an error if we got ERROR or FATAL
[ $(($? & 1)) = "1" ] && exit 1
[ $(($? & 2)) = "2" ] && exit 2
set -e