1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-07-07 09:50:07 +02:00
fdroidserver/tests/complete-ci-tests
Hans-Christoph Steiner 05abbfbabd gitlab-ci: move sdist test run to new fedora job
A full run of the test suite takes quite a bit of time.  This removes one
of the 3 runs from the main 'tests' job, and puts it into the Fedora job.
That test run is mostly to make sure the setup.py and source tarball are
correctly, so that doesn't affect merge requests very often.

This also tests `pip install --user`, which was not really being tested
before.
2017-12-06 20:20:17 +01:00

114 lines
3.2 KiB
Bash
Executable File

#!/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`"
exit 1
fi
set -e
set -x
if [ -z $WORKSPACE ]; then
WORKSPACE=`cd $(dirname $0)/.. && pwd`
echo "Setting Workspace to $WORKSPACE"
fi
if [ -z $ANDROID_HOME ]; then
if [ -e ~/.android/bashrc ]; then
. ~/.android/bashrc
else
echo "ANDROID_HOME must be set!"
exit 1
fi
fi
apksource=$1
#------------------------------------------------------------------------------#
# cache pypi downloads
if [ -z $PIP_DOWNLOAD_CACHE ]; then
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
fi
#------------------------------------------------------------------------------#
# required Java 7 or later keytool/jarsigner for :file support
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
#------------------------------------------------------------------------------#
# run local tests, don't scan fdroidserver/ project for APKs
cd $WORKSPACE/tests
./run-tests $apksource
#------------------------------------------------------------------------------#
# 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
#------------------------------------------------------------------------------#
# 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
#------------------------------------------------------------------------------#
# test install using install direct from git repo
cd $WORKSPACE
rm -rf $WORKSPACE/env
$pyvenv $WORKSPACE/env
. $WORKSPACE/env/bin/activate
# workaround https://github.com/pypa/setuptools/issues/937
pip3 install --quiet setuptools==33.1.1 Babel
pip3 install --quiet -e $WORKSPACE
python3 setup.py compile_catalog install
# make sure translation files were installed
test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
# run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
#------------------------------------------------------------------------------#
# run git pre-commit hook for pep8, pyflakes, etc
sh hooks/pre-commit
#------------------------------------------------------------------------------#
# run pylint
# 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