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 WORKSPACE=`cd $(dirname $0)/.. && pwd`
18 echo "Setting Workspace to $WORKSPACE"
21 if [ -z $ANDROID_HOME ]; then
22 if [ -e ~/.android/bashrc ]; then
25 echo "ANDROID_HOME must be set!"
32 #------------------------------------------------------------------------------#
33 # cache pypi downloads
34 if [ -z $PIP_DOWNLOAD_CACHE ]; then
35 export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
39 #------------------------------------------------------------------------------#
40 # required Java 7 or later keytool/jarsigner for :file support
42 export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
45 #------------------------------------------------------------------------------#
46 # run local tests, don't scan fdroidserver/ project for APKs
49 ./run-tests $apksource
51 #------------------------------------------------------------------------------#
52 # find pyvenv, to support Ubuntu/trusty's python3.4-venv
56 elif which pyvenv-3.4; then
59 echo "pyvenv required to run this test suite!"
64 #------------------------------------------------------------------------------#
65 # make sure that translations do not cause stacktraces
68 if [ ! -d $locale ]; then
71 for cmd in `sed -n 's/.*("\(.*\)", *_.*/\1/p' $WORKSPACE/fdroid`; do
72 LANGUAGE=$locale $WORKSPACE/fdroid $cmd --help > /dev/null
77 #------------------------------------------------------------------------------#
78 # test install using install direct from git repo
81 $pyvenv $WORKSPACE/env
82 . $WORKSPACE/env/bin/activate
83 # workaround https://github.com/pypa/setuptools/issues/937
84 pip3 install --quiet setuptools==33.1.1 Babel
85 pip3 install --quiet -e $WORKSPACE
86 python3 setup.py compile_catalog install
88 # make sure translation files were installed
89 test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
91 # run tests in new pip+pyvenv install
92 fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
95 #------------------------------------------------------------------------------#
96 # run git pre-commit hook for pep8, pyflakes, etc
100 #------------------------------------------------------------------------------#
103 # only run it where it will work, for example, the pyvenvs above don't have pylint
104 if which pylint3 && python3 -c "import pylint" 2> /dev/null; then
106 pylint3 --rcfile=.pylint-rcfile --output-format=colorized --reports=n \