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!"
28 #------------------------------------------------------------------------------#
29 # required Java 7 keytool/jarsigner for :file support
31 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
33 #------------------------------------------------------------------------------#
35 cd $WORKSPACE/fdroidserver/getsig
39 #------------------------------------------------------------------------------#
45 #------------------------------------------------------------------------------#
46 # test building the source tarball
51 #------------------------------------------------------------------------------#
52 # test install using site packages
55 virtualenv --system-site-packages $WORKSPACE/env
56 . $WORKSPACE/env/bin/activate
57 pip install -e $WORKSPACE
58 python setup.py install
60 # run tests in new pip+virtualenv install
61 . $WORKSPACE/env/bin/activate
62 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests.sh
65 #------------------------------------------------------------------------------#
67 pyflakes fdroid makebuildserver fdroidserver/*.py setup.py
70 #------------------------------------------------------------------------------#
75 # use the virtualenv python so pylint checks against its installed libs
76 PYTHONPATH=$WORKSPACE/.pylint-plugins python /usr/bin/pylint \
77 --output-format=parseable --reports=n \
78 --load-plugins astng_hashlib \
79 fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable
81 # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these:
82 # running pylint in the virtualenv is causing this FATAL error, which is a bug:
83 # https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import
84 [ $(($? & 1)) = "1" ] && echo "FATALs found"
85 [ $(($? & 2)) = "2" ] && exit 2
86 [ $(($? & 4)) = "4" ] && exit 4