chiark / gitweb /
use the virtualenv python so pylint checks against its installed libs
[fdroidserver.git] / jenkins-build
1 #!/bin/bash
2 #
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.
6
7 if [ `dirname $0` != "." ]; then
8     echo "only run this script like ./`basename $0`"
9     exit
10 fi
11
12 set -e
13 set -x
14
15 if [ -z $WORKSPACE ]; then
16     export WORKSPACE=`pwd`
17 fi
18
19 if [ -z $ANDROID_HOME ]; then
20     if [ -e ~/.android/bashrc ]; then
21         . ~/.android/bashrc
22     else
23         echo "ANDROID_HOME must be set!"
24         exit
25     fi
26 fi
27
28 #------------------------------------------------------------------------------#
29 # required Java 7 keytool/jarsigner for :file support
30
31 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
32
33 #------------------------------------------------------------------------------#
34 # run local build
35 cd $WORKSPACE/fdroidserver/getsig
36 ./make.sh
37
38
39 #------------------------------------------------------------------------------#
40 # run local tests
41 cd $WORKSPACE/tests
42 ./run-tests.sh
43
44
45 #------------------------------------------------------------------------------#
46 # test building the source tarball
47 cd $WORKSPACE
48 python setup.py sdist
49
50
51 #------------------------------------------------------------------------------#
52 # test install using site packages
53 cd $WORKSPACE
54 rm -rf $WORKSPACE/env
55 virtualenv --system-site-packages $WORKSPACE/env
56 . $WORKSPACE/env/bin/activate
57 pip install -e $WORKSPACE
58 python setup.py install
59
60 # run tests in new pip+virtualenv install
61 . $WORKSPACE/env/bin/activate
62 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests.sh
63
64
65 #------------------------------------------------------------------------------#
66 # run pyflakes
67 pyflakes fdroid makebuildserver fdroidserver/*.py setup.py
68
69
70 #------------------------------------------------------------------------------#
71 # run pylint
72
73 cd $WORKSPACE
74 set +e
75 # disable E1101 until there is a plugin to handle this properly:
76 #   Module 'sys' has no '_MEIPASS' member
77 # disable F0401 until there is a plugin to handle this properly:
78 #   keysync-gui:25: [F] Unable to import 'ordereddict'
79 # use the virtualenv python so pylint checks against its installed libs
80 python /usr/bin/pylint --output-format=parseable --reports=n \
81     fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable
82
83 # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these:
84 [ $(($? & 1)) = "1" ] && echo "FATALs found"
85 [ $(($? & 2)) = "2" ] && echo "ERRORs found"
86 [ $(($? & 4)) = "4" ] && echo "WARNINGs found"
87 set -e
88