From ea4ecc4f6b6e2a348fb1cfdd4dced4f89cb3eaf4 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Mon, 4 Dec 2017 14:04:38 +1030
Subject: [PATCH] Using custom docker images

---
 .ci/test_template.sh | 13 +-----------
 .gitlab-ci.yml       | 47 ++++++++++----------------------------------
 2 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/.ci/test_template.sh b/.ci/test_template.sh
index 3f6f82d1f..e79403cf3 100644
--- a/.ci/test_template.sh
+++ b/.ci/test_template.sh
@@ -2,17 +2,6 @@
 
 set -e
 
-# Install $PY_VERSION, xvfb, and all
-# of the wxpython dependencies.
-apt-get update -y || true
-apt-get install -y software-properties-common python-software-properties xvfb libgtk2.0-0 libnotify4 freeglut3 libsdl1.2debian
-add-apt-repository -y ppa:deadsnakes/ppa
-apt-get update -y || true
-apt-get install -y $PY_VERSION "$PY_VERSION"-dev $PY_PACKAGES
-$PY_VENV test.venv
-source test.venv/bin/activate
-pip install --upgrade pip setuptools
-
 # If running on a fork repository, we merge in the
 # upstream/master branch. This is done so that merge
 # requests from fork to the parent repository will
@@ -23,7 +12,7 @@ if [[ "$CI_PROJECT_PATH" != "$UPSTREAM_PROJECT" ]]; then
   git merge --no-commit --no-ff upstream/master;
 fi;
 
-$INSTALL_WX
+source /test.venv/bin/activate
 
 # All other deps can be installed as normal.
 # We install test dependenciesd through pip,
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 13bf9dbd2..e43678e38 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,6 +16,11 @@
 #    5. deploy: Uploading the build outputs to pypi/hosting servers, and the
 #               documentation to a hosting server.
 #
+# Custom docker images are used for several jobs - these images are
+# available at:
+#
+#    https://hub.docker.com/u/pauldmccarthy/
+#
 # The test and style stages are executed on all branches of upstream and fork
 # repositories.
 #
@@ -81,12 +86,6 @@ stages:
 #   - TWINE_PASSWORD:                - Password to use when uploading to pypi
 #
 #   - TWINE_REPOSITORY_URL:          - Pypi repository to upload to
-#
-#   - WXPYTHON_UBUNTU1404_URL:       - Url to a location containg binary wheels
-#                                      for wxPython/ubuntu 14.04
-#
-#   - WXPYTHON_UBUNTU1604_URL:       - Url to a location containg binary wheels
-#                                      for wxPython/ubuntu 16.04
 ###############################################################################
 
 
@@ -161,48 +160,26 @@ variables:
 
 test:2.7:
   stage: test
-  image: ubuntu:16.04
+  image: pauldmccarthy/fsleyes-py27-wxpy4-gtk2
   <<: *test_template
-  variables:
-    PY_VERSION:  "python2.7"
-    PY_PACKAGES: "python-pip python-virtualenv"
-    PY_VENV:     "virtualenv"
-    INSTALL_WX:  "pip install --only-binary wxpython -f $WXPYTHON_UBUNTU1604_URL wxpython"
 
 
-# we use ubuntu:14.04 for python 3.4, because
-# wxpython is not available for 16.04/3.4
 test:3.4:
   stage: test
-  image: ubuntu:14.04
+  image: pauldmccarthy/fsleyes-py34-wxpy4-gtk2
   <<: *test_template
-  variables:
-    PY_VERSION:  "python3.4"
-    PY_PACKAGES: "python3-pip python3.4-venv"
-    PY_VENV:     "python3.4 -m venv"
-    INSTALL_WX:  "pip install --pre -f $WXPYTHON_UBUNTU1404_URL wxpython"
 
 
 test:3.5:
   stage: test
-  image: ubuntu:16.04
+  image: pauldmccarthy/fsleyes-py35-wxpy4-gtk2
   <<: *test_template
-  variables:
-    PY_VERSION:  "python3.5"
-    PY_PACKAGES: "python3-pip python3-venv"
-    PY_VENV:     "python3.5 -m venv"
-    INSTALL_WX:  "pip install --only-binary wxpython -f $WXPYTHON_UBUNTU1604_URL wxpython"
 
 
 test:3.6:
   stage: test
-  image: ubuntu:16.04
+  image: pauldmccarthy/fsleyes-py36-wxpy4-gtk2
   <<: *test_template
-  variables:
-    PY_VERSION:  "python3.6"
-    PY_PACKAGES: "python3-pip python3.6-venv"
-    PY_VENV:     "python3.6 -m venv"
-    INSTALL_WX:  "pip install --only-binary wxpython -f $WXPYTHON_UBUNTU1604_URL wxpython"
 
 
 #############
@@ -212,13 +189,9 @@ test:3.6:
 
 style:
   stage: style
-  image: ubuntu:16.04
+  image: pauldmccarthy/fsleyes-py35-wxpy4-gtk2
   <<: *test_template
   variables:
-    PY_VERSION:  "python3.5"
-    PY_PACKAGES: "python3-pip python3-venv"
-    PY_VENV:     "python3.5 -m venv"
-    INSTALL_WX:  "pip install --only-binary wxpython -f $WXPYTHON_UBUNTU1604_URL wxpython"
     TEST_STYLE:  "true"
 
 
-- 
GitLab