summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-02-08 15:38:24 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-02-08 15:42:11 +0100
commit095388a7c83dbffbe042f842789285f63996fc11 (patch)
treed3962c73f7c210a718e26f96ec32cce8ef6cf567 /.gitlab-ci
parent7bc20fe2d1225bebb2f4ec1faabf6a70e4e5a4e7 (diff)
downloadpygobject-095388a7c83dbffbe042f842789285f63996fc11.tar.gz
gitlab-ci: use pyenv in docker instead of the deadsnakes PPA
deadsnakes only provides packages for Ubuntu LTS versions and doesn't include versions present in that Ubuntu version. With Ubuntu zesty this happened to work, but now that that's EOL we have to switch to artful and no longer have a Python 3.5 available. Instead switch to using pyenv in docker and compiler our own Python versions. This should make it easier to swtich distros in the future. Also adds a run-docker.sh script which builds the image and runs it with the git repo mounted. This should make local testing easier in the future.
Diffstat (limited to '.gitlab-ci')
-rw-r--r--.gitlab-ci/Dockerfile60
-rw-r--r--.gitlab-ci/run-docker.sh7
-rwxr-xr-x.gitlab-ci/test-docker.sh11
3 files changed, 49 insertions, 29 deletions
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index 3943383c..8f83e3b5 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -1,32 +1,44 @@
-FROM ubuntu:zesty
+FROM ubuntu:artful
-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 \
+RUN apt-get update && apt-get install -y \
autoconf-archive \
- libglib2.0-dev \
- libcairo2-dev \
- virtualenv \
+ build-essential \
+ curl \
+ dbus \
+ dbus-x11 \
+ gir1.2-gtk-3.0 \
git \
- python2.7-dev \
- python3.4-dev \
- python3.5-dev \
- python3.6-dev \
- libtool \
- libffi-dev \
gobject-introspection \
+ libbz2-dev \
+ libcairo2-dev \
+ libffi-dev \
libgirepository1.0-dev \
+ libglib2.0-dev \
libgtk-3-0 \
- gir1.2-gtk-3.0 \
- dbus \
+ libreadline-dev \
+ libsqlite3-dev \
+ libssl-dev \
+ libtool \
+ locales \
xauth \
xvfb \
- locales
+ && rm -rf /var/lib/apt/lists/*
+
+ARG HOST_USER_ID=5555
+ENV HOST_USER_ID ${HOST_USER_ID}
+RUN useradd -u $HOST_USER_ID -ms /bin/bash user
+
+USER user
+WORKDIR /home/user
+
+ENV LANG C.UTF-8
+ENV CI true
+ENV PYENV_ROOT /home/user/.pyenv
+ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
+
+RUN curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
+
+RUN pyenv install 2.7.14
+RUN pyenv install 3.4.7
+RUN pyenv install 3.5.5
+RUN pyenv install 3.6.4
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
new file mode 100644
index 00000000..e06e4d15
--- /dev/null
+++ b/.gitlab-ci/run-docker.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+sudo docker build --build-arg HOST_USER_ID="$UID" --tag "pygobject" \
+ --file "Dockerfile" .
+sudo docker run -e PYENV_VERSION='3.6.4' --rm \
+ --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
+ --tty --interactive "pygobject" bash
diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh
index 32580047..da34d5db 100755
--- a/.gitlab-ci/test-docker.sh
+++ b/.gitlab-ci/test-docker.sh
@@ -2,24 +2,25 @@
set -e
-virtualenv --python="${PYTHON}" /tmp/venv
-source /tmp/venv/bin/activate
+python --version
python -m pip install git+https://github.com/pygobject/pycairo.git
python -m pip install flake8
-export PKG_CONFIG_PATH=/tmp/venv/lib/pkgconfig
+PY_PREFIX="$(python -c 'import sys; sys.stdout.write(sys.prefix)')"
+export PKG_CONFIG_PATH="${PY_PREFIX}/lib/pkgconfig"
export MALLOC_CHECK_=3
export MALLOC_PERTURB_=$((${RANDOM} % 255 + 1))
PYVER=$(python -c "import sys; sys.stdout.write(str(sys.version_info[0]))")
SOURCE_DIR="$(pwd)"
+rm -Rf /tmp/build
mkdir /tmp/build
cd /tmp/build
# BUILD
"${SOURCE_DIR}"/autogen.sh --with-python=python
-make
+make -j8
# TESTS
xvfb-run -a make check
@@ -30,7 +31,7 @@ make check.quality
cd "${SOURCE_DIR}"
# DOCUMENTATION CHECKS
-if [[ "${PYVER}" == "2" ]]; then
+if [[ "${PYENV_VERSION}" == "2.7.14" ]]; then
python -m pip install sphinx sphinx_rtd_theme
python -m sphinx -W -a -E -b html -n docs docs/_build
fi;