chiark / gitweb /
add script for running build and tests in Jenkins
authorHans-Christoph Steiner <hans@eds.org>
Tue, 1 Apr 2014 20:17:03 +0000 (16:17 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 2 Apr 2014 21:54:21 +0000 (17:54 -0400)
.gitignore
jenkins-build.sh [new file with mode: 0755]

index 47fd9ce8e797d554d4a52a88709f57636e31b8be..2a4e5024ffe039c26f706c764a67098e4342da80 100644 (file)
@@ -9,3 +9,4 @@ build/
 dist/
 env/
 fdroidserver.egg-info/
+pylint.parseable
diff --git a/jenkins-build.sh b/jenkins-build.sh
new file mode 100755 (executable)
index 0000000..ccd9492
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# this is the script run by the Jenkins server to run the build and tests.  Be
+# sure to always run it in its dir, i.e. ./jenkins-build.sh, otherwise it might
+# remove things that you don't want it to.
+
+if [ `dirname $0` != "." ]; then
+    echo "only run this script like ./`basename $0`"
+    exit
+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
+    fi
+fi
+
+#------------------------------------------------------------------------------#
+# required Java 7 keytool/jarsigner for :file support
+
+export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
+
+#------------------------------------------------------------------------------#
+# run local build
+cd $WORKSPACE/fdroidserver/getsig
+./make.sh
+
+
+#------------------------------------------------------------------------------#
+# run local tests
+cd $WORKSPACE/tests
+./run-tests.sh
+
+
+#------------------------------------------------------------------------------#
+# test building the source tarball
+cd $WORKSPACE
+python setup.py sdist
+
+
+#------------------------------------------------------------------------------#
+# test install using site packages
+cd $WORKSPACE
+rm -rf $WORKSPACE/env
+virtualenv --system-site-packages $WORKSPACE/env
+. $WORKSPACE/env/bin/activate
+pip install -e $WORKSPACE
+python setup.py install
+
+# run tests in new pip+virtualenv install
+. $WORKSPACE/env/bin/activate
+fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests.sh
+
+
+#------------------------------------------------------------------------------#
+# run pyflakes
+pyflakes fdroid makebuildserver fdroidserver/*.py setup.py
+
+
+#------------------------------------------------------------------------------#
+# run pylint
+
+cd $WORKSPACE
+set +e
+# disable E1101 until there is a plugin to handle this properly:
+#   Module 'sys' has no '_MEIPASS' member
+# disable F0401 until there is a plugin to handle this properly:
+#   keysync-gui:25: [F] Unable to import 'ordereddict'
+pylint --output-format=parseable --reports=n \
+    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:
+#[ $(($? & 1)) = "1" ] && exit 1
+#[ $(($? & 2)) = "2" ] && exit 2
+set -e
+