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
50 #------------------------------------------------------------------------------#
51 # find pyvenv, to support Ubuntu/trusty's python3.4-venv
55 elif which pyvenv-3.4; then
58 echo "pyvenv required to run this test suite!"
63 #------------------------------------------------------------------------------#
64 # test building the source tarball, then installing it
66 python3 setup.py compile_catalog sdist
68 # make sure translation files got compiled and included
69 tar tzf dist/fdroidserver-*.tar.gz | grep locale/de/LC_MESSAGES/fdroidserver.mo
72 $pyvenv $WORKSPACE/env
73 . $WORKSPACE/env/bin/activate
74 # workaround https://github.com/pypa/setuptools/issues/937
75 pip3 install --quiet setuptools==33.1.1
76 pip3 install --quiet dist/fdroidserver-*.tar.gz
78 # make sure translation files were installed
79 test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
81 # run tests in new pip+pyvenv install
82 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
85 #------------------------------------------------------------------------------#
86 # test install using install direct from git repo
89 $pyvenv $WORKSPACE/env
90 . $WORKSPACE/env/bin/activate
91 # workaround https://github.com/pypa/setuptools/issues/937
92 pip3 install --quiet setuptools==33.1.1 Babel
93 pip3 install --quiet -e $WORKSPACE
94 python3 setup.py compile_catalog install
96 # make sure translation files were installed
97 test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
99 # run tests in new pip+pyvenv install
100 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
103 #------------------------------------------------------------------------------#
104 # run git pre-commit hook for pep8, pyflakes, etc
108 #------------------------------------------------------------------------------#
111 # only run it where it will work, for example, the pyvenvs above don't have pylint
112 if which pylint3 && python3 -c "import pylint" 2> /dev/null; then
114 pylint3 --rcfile=.pylint-rcfile --output-format=colorized --reports=n \