2015-09-01 12:28:58 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# this is the script run by the Jenkins and gitlab-ci continuous integration
|
|
|
|
# build services. It is a thorough set of tests that runs all the tests using
|
|
|
|
# the various methods of installing/running fdroidserver. It is separate from
|
|
|
|
# ./tests/run-tests because its too heavy for manual use.
|
|
|
|
|
|
|
|
if [ `dirname $0` != "." ]; then
|
|
|
|
echo "only run this script like ./`basename $0`"
|
2016-02-15 11:40:35 +01:00
|
|
|
exit 1
|
2015-09-01 12:28:58 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
if [ -z $WORKSPACE ]; then
|
2017-11-13 13:08:22 +01:00
|
|
|
WORKSPACE=`cd $(dirname $0)/.. && pwd`
|
|
|
|
echo "Setting Workspace to $WORKSPACE"
|
2015-09-01 12:28:58 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $ANDROID_HOME ]; then
|
|
|
|
if [ -e ~/.android/bashrc ]; then
|
|
|
|
. ~/.android/bashrc
|
|
|
|
else
|
|
|
|
echo "ANDROID_HOME must be set!"
|
2016-02-15 11:40:35 +01:00
|
|
|
exit 1
|
2015-09-01 12:28:58 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
apksource=$1
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# cache pypi downloads
|
|
|
|
if [ -z $PIP_DOWNLOAD_CACHE ]; then
|
|
|
|
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2016-06-21 12:41:25 +02:00
|
|
|
# required Java 7 or later keytool/jarsigner for :file support
|
2015-09-01 12:28:58 +02:00
|
|
|
|
2016-06-21 12:41:25 +02:00
|
|
|
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
|
2015-09-01 12:28:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# run local tests, don't scan fdroidserver/ project for APKs
|
|
|
|
|
|
|
|
cd $WORKSPACE/tests
|
|
|
|
./run-tests $apksource
|
|
|
|
|
2017-09-15 23:25:07 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# find pyvenv, to support Ubuntu/trusty's python3.4-venv
|
|
|
|
|
|
|
|
if which pyvenv; then
|
|
|
|
pyvenv=pyvenv
|
|
|
|
elif which pyvenv-3.4; then
|
|
|
|
pyvenv=pyvenv-3.4
|
|
|
|
else
|
|
|
|
echo "pyvenv required to run this test suite!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-09-01 12:28:58 +02:00
|
|
|
|
2017-11-13 13:08:22 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# make sure that translations do not cause stacktraces
|
|
|
|
cd $WORKSPACE/locale
|
|
|
|
for locale in *; do
|
|
|
|
if [ ! -d $locale ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
for cmd in `sed -n 's/.*("\(.*\)", *_.*/\1/p' $WORKSPACE/fdroid`; do
|
|
|
|
LANGUAGE=$locale $WORKSPACE/fdroid $cmd --help > /dev/null
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2015-09-01 12:28:58 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# test install using install direct from git repo
|
|
|
|
cd $WORKSPACE
|
|
|
|
rm -rf $WORKSPACE/env
|
2017-09-15 23:25:07 +02:00
|
|
|
$pyvenv $WORKSPACE/env
|
2015-09-01 12:28:58 +02:00
|
|
|
. $WORKSPACE/env/bin/activate
|
2017-02-06 17:28:07 +01:00
|
|
|
# workaround https://github.com/pypa/setuptools/issues/937
|
2017-10-19 18:00:04 +02:00
|
|
|
pip3 install --quiet setuptools==33.1.1 Babel
|
2017-10-18 14:58:07 +02:00
|
|
|
pip3 install --quiet -e $WORKSPACE
|
2017-10-19 18:00:04 +02:00
|
|
|
python3 setup.py compile_catalog install
|
|
|
|
|
|
|
|
# make sure translation files were installed
|
|
|
|
test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
|
2015-09-01 12:28:58 +02:00
|
|
|
|
2016-04-06 19:46:21 +02:00
|
|
|
# run tests in new pip+pyvenv install
|
2015-09-01 12:28:58 +02:00
|
|
|
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# run pylint
|
|
|
|
|
2017-04-13 11:57:02 +02:00
|
|
|
# only run it where it will work, for example, the pyvenvs above don't have pylint
|
|
|
|
if which pylint3 && python3 -c "import pylint" 2> /dev/null; then
|
|
|
|
cd $WORKSPACE
|
|
|
|
pylint3 --rcfile=.pylint-rcfile --output-format=colorized --reports=n \
|
|
|
|
fdroid \
|
|
|
|
makebuildserver \
|
|
|
|
setup.py \
|
|
|
|
fdroidserver/*.py \
|
|
|
|
tests/*.py \
|
|
|
|
tests/*.TestCase
|
|
|
|
fi
|