1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-05 06:50:10 +01:00
fdroidserver/tests/complete-ci-tests
Daniel Martí 5de678e48b all: switch to jdk8 as default
Also, remove jdk7 as it will become unused. We added jdk8 for
retrolambda, and now that we will use jdk8 as the default, jdk7 is
unnecessary as retrolambda can work fine with just jdk8.

This removes it from the buildserver, and the new CI image also only has
jdk8 from jessie-backports.

Fixes #185.
2016-06-21 11:47:37 +01:00

102 lines
2.9 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
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
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
cd $WORKSPACE
set +e
# use the pyvenv so pylint checks against its installed libs
PYTHONPATH=$WORKSPACE/.pylint-plugins python3 /usr/bin/pylint \
--output-format=parseable --reports=n \
--load-plugins astng_hashlib \
fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable
# to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these:
# running pylint in the pyvenv/virtualenv is causing this FATAL error, which is a bug:
# https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import
[ $(($? & 1)) = "1" ] && echo "FATALs found"
[ $(($? & 2)) = "2" ] && exit 2
[ $(($? & 4)) = "4" ] && exit 4
set -e