From adf5e51ccf9d9dbf938c0da496e0d4d81d3284f6 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 22 Dec 2017 16:34:53 +0100 Subject: [PATCH] Add gitlab CI tests Adds a Dockerfile which is available on the docker hub and gets used by the gitlab test runner. The tests get executed in an Ubuntu 17.04 image for various Python versions and consist of building, testing, code quality testing and documentation build testing. --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ .gitlab-ci/Dockerfile | 32 ++++++++++++++++++++++++++++++++ .gitlab-ci/README.rst | 1 + .gitlab-ci/test-docker.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 .gitlab-ci/Dockerfile create mode 100644 .gitlab-ci/README.rst create mode 100755 .gitlab-ci/test-docker.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..5408a38f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +services: + - docker + +image: lazka/pygobject:latest + +.defaults: &defaults + variables: + PYTHON: "$CI_JOB_NAME" + script: + - bash -x ./.gitlab-ci/test-docker.sh + +python2.7: + <<: *defaults + +python3.4: + <<: *defaults + +python3.5: + <<: *defaults + +python3.6: + <<: *defaults diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile new file mode 100644 index 00000000..3943383c --- /dev/null +++ b/.gitlab-ci/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:zesty + +ENV LANG C.UTF-8 +ENV PYTHONDONTWRITEBYTECODE 1 +ENV CI true + +RUN apt-get update +RUN apt-get install -y dirmngr +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776 +RUN echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main" >> /etc/apt/sources.list +RUN apt-get update + +RUN apt-get install -y \ + autoconf-archive \ + libglib2.0-dev \ + libcairo2-dev \ + virtualenv \ + git \ + python2.7-dev \ + python3.4-dev \ + python3.5-dev \ + python3.6-dev \ + libtool \ + libffi-dev \ + gobject-introspection \ + libgirepository1.0-dev \ + libgtk-3-0 \ + gir1.2-gtk-3.0 \ + dbus \ + xauth \ + xvfb \ + locales diff --git a/.gitlab-ci/README.rst b/.gitlab-ci/README.rst new file mode 100644 index 00000000..107abf0e --- /dev/null +++ b/.gitlab-ci/README.rst @@ -0,0 +1 @@ +The Dockerfile is available at https://hub.docker.com/r/lazka/pygobject/ diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh new file mode 100755 index 00000000..60a25761 --- /dev/null +++ b/.gitlab-ci/test-docker.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +virtualenv --python="${PYTHON}" /tmp/venv +source /tmp/venv/bin/activate + +python -m pip install git+https://github.com/pygobject/pycairo.git +python -m pip install pyflakes pycodestyle + +export PKG_CONFIG_PATH=/tmp/venv/share/pkgconfig +export MALLOC_CHECK_=3 +export MALLOC_PERTURB_=$((${RANDOM} % 255 + 1)) +PYVER=$(python -c "import sys; sys.stdout.write(str(sys.version_info[0]))") + +# BUILD +./autogen.sh --with-python=python +make + +# TESTS +xvfb-run -a make check + +# CODE QUALITY CHECKS +make check.quality + +# DOCUMENTATION CHECKS +if [[ "${PYVER}" == "2" ]]; then + python -m pip install sphinx sphinx_rtd_theme + python -m sphinx -W -a -E -b html -n docs docs/_build +fi; -- 2.11.4.GIT