1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 14:30:11 +01:00
fdroidserver/tests/complete-ci-tests
Hans-Christoph Steiner 12c80f9062 update outdated pylint setup
The logilab-astng lib is dead, replaced by python-astroid.  The crazy astng
plugin is no longer needed also.

#281
2017-05-23 22:34:16 +02:00

101 lines
2.8 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
export WORKSPACE=`pwd`/..
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
#------------------------------------------------------------------------------#
# test building the source tarball, then installing it
cd $WORKSPACE
python3 setup.py sdist
rm -rf $WORKSPACE/env
pyvenv $WORKSPACE/env
. $WORKSPACE/env/bin/activate
# workaround https://github.com/pypa/setuptools/issues/937
pip3 install setuptools==33.1.1
pip3 install dist/fdroidserver-*.tar.gz
# run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
#------------------------------------------------------------------------------#
# 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 setuptools==33.1.1
pip3 install -e $WORKSPACE
python3 setup.py install
# 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