chiark / gitweb /
use Babel to compile localizations and include in source tarball
[fdroidserver.git] / tests / complete-ci-tests
index 558427e3bb870f926230b80a266855ac81da7f38..1959f858da8f420ca4a861bef2bd3ded881061d0 100755 (executable)
@@ -47,18 +47,36 @@ export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
 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
+
 
 #------------------------------------------------------------------------------#
 # test building the source tarball, then installing it
 cd $WORKSPACE
-python3 setup.py sdist
+python3 setup.py compile_catalog sdist
+
+# make sure translation files got compiled and included
+tar tzf dist/fdroidserver-*.tar.gz | grep locale/de/LC_MESSAGES/fdroidserver.mo
 
 rm -rf $WORKSPACE/env
-pyvenv $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
+pip3 install --quiet setuptools==33.1.1
+pip3 install --quiet dist/fdroidserver-*.tar.gz
+
+# 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
@@ -68,12 +86,15 @@ 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
+$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
+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
@@ -87,19 +108,14 @@ 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
-
+# 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