3 # this is the script run by the Jenkins server to run the build and tests. Be
4 # sure to always run it in its dir, i.e. ./jenkins-build.sh, otherwise it might
5 # remove things that you don't want it to.
7 if [ `dirname $0` != "." ]; then
8 echo "only run this script like ./`basename $0`"
15 if [ -z $WORKSPACE ]; then
16 export WORKSPACE=`pwd`
19 if [ -z $ANDROID_HOME ]; then
20 if [ -e ~/.android/bashrc ]; then
23 echo "ANDROID_HOME must be set!"
29 #------------------------------------------------------------------------------#
30 # cache pypi downloads
31 if [ -z $PIP_DOWNLOAD_CACHE ]; then
32 export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
36 #------------------------------------------------------------------------------#
37 # required Java 7 keytool/jarsigner for :file support
39 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
41 #------------------------------------------------------------------------------#
43 cd $WORKSPACE/fdroidserver/getsig
47 #------------------------------------------------------------------------------#
53 #------------------------------------------------------------------------------#
54 # test building the source tarball
59 #------------------------------------------------------------------------------#
60 # test install using site packages
63 virtualenv --system-site-packages $WORKSPACE/env
64 . $WORKSPACE/env/bin/activate
65 pip install -e $WORKSPACE
66 python setup.py install
68 # run tests in new pip+virtualenv install
69 . $WORKSPACE/env/bin/activate
70 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests
73 #------------------------------------------------------------------------------#
75 pyflakes fdroid makebuildserver fdroidserver/*.py setup.py
78 #------------------------------------------------------------------------------#
83 # use the virtualenv python so pylint checks against its installed libs
84 PYTHONPATH=$WORKSPACE/.pylint-plugins python /usr/bin/pylint \
85 --output-format=parseable --reports=n \
86 --load-plugins astng_hashlib \
87 fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable
89 # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these:
90 # running pylint in the virtualenv is causing this FATAL error, which is a bug:
91 # https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import
92 [ $(($? & 1)) = "1" ] && echo "FATALs found"
93 [ $(($? & 2)) = "2" ] && exit 2
94 [ $(($? & 4)) = "4" ] && exit 4