3 # this is the script run by the Jenkins and gitlab-ci continuous integration
4 # build services. It is a thorough set of tests that runs all the tests using
5 # the various methods of installing/running fdroidserver. It is separate from
6 # ./tests/run-tests because its too heavy for manual use.
8 if [ `dirname $0` != "." ]; then
9 echo "only run this script like ./`basename $0`"
16 if [ -z $WORKSPACE ]; then
17 export WORKSPACE=`pwd`/..
20 if [ -z $ANDROID_HOME ]; then
21 if [ -e ~/.android/bashrc ]; then
24 echo "ANDROID_HOME must be set!"
31 #------------------------------------------------------------------------------#
32 # cache pypi downloads
33 if [ -z $PIP_DOWNLOAD_CACHE ]; then
34 export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
38 #------------------------------------------------------------------------------#
39 # required Java 7 or later keytool/jarsigner for :file support
41 export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
44 #------------------------------------------------------------------------------#
45 # run local tests, don't scan fdroidserver/ project for APKs
48 ./run-tests $apksource
51 #------------------------------------------------------------------------------#
52 # test building the source tarball, then installing it
54 python3 setup.py sdist
58 . $WORKSPACE/env/bin/activate
59 # workaround https://github.com/pypa/setuptools/issues/937
60 pip3 install setuptools==33.1.1
61 pip3 install dist/fdroidserver-*.tar.gz
63 # run tests in new pip+pyvenv install
64 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
67 #------------------------------------------------------------------------------#
68 # test install using install direct from git repo
72 . $WORKSPACE/env/bin/activate
73 # workaround https://github.com/pypa/setuptools/issues/937
74 pip3 install setuptools==33.1.1
75 pip3 install -e $WORKSPACE
76 python3 setup.py install
78 # run tests in new pip+pyvenv install
79 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
82 #------------------------------------------------------------------------------#
83 # run git pre-commit hook for pep8, pyflakes, etc
87 #------------------------------------------------------------------------------#
92 # use the pyvenv so pylint checks against its installed libs
93 PYTHONPATH=$WORKSPACE/.pylint-plugins python3 /usr/bin/pylint \
94 --output-format=parseable --reports=n \
95 --load-plugins astng_hashlib \
96 fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable
98 # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these:
99 # running pylint in the pyvenv/virtualenv is causing this FATAL error, which is a bug:
100 # https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import
101 [ $(($? & 1)) = "1" ] && echo "FATALs found"
102 [ $(($? & 2)) = "2" ] && exit 2
103 [ $(($? & 4)) = "4" ] && exit 4