From b5cddd6373a303c20f11511df9bfe05bb162d662 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Sat, 24 Sep 2016 09:41:41 +0200
Subject: [PATCH 1/2] Improved CI

---
 .gitlab-ci.yml | 80 +++++++++++++++++++++++++++-----------------------
 1 file changed, 44 insertions(+), 36 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 84dcfa0..fa11e07 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,8 @@
-# This build file is defined in two parts: 1) a generic set of instructions you
-# probably **don't** need to change and 2) a part you may have to tune to your
-# project. It heavily uses template features from YAML to help you in only
-# changing a minimal part of it and avoid code duplication to a maximum while
-# still providing a nice pipeline display on your package.
+# This build file heavily uses template features from YAML so it is generic
+# enough for any Bob project. Don't modify it unless you know what you're
+# doing.
 
 
-# 1) Generic instructions (only change if you know what you're doing)
-# -------------------------------------------------------------------
-
 # Definition of our build pipeline
 stages:
   - build
@@ -17,33 +12,39 @@ stages:
   - deploy
 
 
+# ---------
+# Templates
+# ---------
+
 # Template for the build stage
 # Needs to run on all supported architectures, platforms and python versions
 .build_template: &build_job
   stage: build
   before_script:
     - git clean -ffdx
-    - curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > install.sh
-    - chmod 755 ./install.sh
-    - ./install.sh _ci
+    - mkdir _ci
+    - curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > _ci/install.sh
+    - chmod 755 _ci/install.sh
+    - ./_ci/install.sh _ci #updates
     - ./_ci/before_build.sh
   script:
     - ./_ci/build.sh
   after_script:
     - ./_ci/after_build.sh
   artifacts:
-    expire_in: 1 day
+    expire_in: 1 week
     paths:
       - _ci/
       - dist/
       - sphinx/
 
 
-# Template for the test stage - re-install from uploaded wheels
+# Template for the test stage - re-installs from uploaded wheels
 # Needs to run on all supported architectures, platforms and python versions
 .test_template: &test_job
   stage: test
   before_script:
+    - ./_ci/install.sh _ci #updates
     - ./_ci/before_test.sh
   script:
     - ./_ci/test.sh
@@ -52,9 +53,7 @@ stages:
 
 
 # Template for the wheel uploading stage
-# Needs to run against one combination of python 2.x and 3.x if it is a python
-# only package, otherwise, needs to run in both pythons to all supported
-# architectures (Linux and Mac OSX 64-bit)
+# Needs to run against one supported architecture, platform and python version
 .wheels_template: &wheels_job
   stage: wheels
   environment: intranet
@@ -62,6 +61,7 @@ stages:
     - master
     - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
   before_script:
+    - ./_ci/install.sh _ci #updates
     - ./_ci/before_wheels.sh
   script:
     - ./_ci/wheels.sh
@@ -77,6 +77,7 @@ stages:
   only:
     - master
   before_script:
+    - ./_ci/install.sh _ci #updates
     - ./_ci/before_docs.sh
   script:
     - ./_ci/docs.sh
@@ -84,8 +85,10 @@ stages:
     - ./_ci/after_docs.sh
 
 
-# Template for the pypi stage - re-install from uploaded wheels
-# Needs to run on a single architecture
+# Template for the deployment stage - re-installs from uploaded wheels
+# Needs to run on a single architecture only
+# Will deploy your package to PyPI and other required services
+# Only runs for tags
 .deploy_template: &deploy_job
   stage: deploy
   environment: internet
@@ -94,21 +97,23 @@ stages:
   except:
     - branches
   before_script:
+    - ./_ci/install.sh _ci #updates
     - ./_ci/before_deploy.sh
   script:
     - ./_ci/deploy.sh
   after_script:
-    - ./_ci/after_deply.sh
+    - ./_ci/after_deploy.sh
 
 
-# 2) Package specific instructions (you may tune this if needed)
-# --------------------------------------------------------------
+# -------------
+# Build Targets
+# -------------
 
-# Linux + Python 2.7: Builds, tests, uploads wheel
+# Linux + Python 2.7: Builds, tests, uploads wheel and deploys (if needed)
 build_linux_27:
   <<: *build_job
   variables: &linux_27_build_variables
-    PYTHON_VER: "2.7"
+    PYTHON_VERSION: "2.7"
     WHEEL_TAG: "py27"
   tags:
     - conda-linux
@@ -123,6 +128,15 @@ test_linux_27:
 
 wheels_linux_27:
   <<: *wheels_job
+  variables: *linux_27_build_variables
+  dependencies:
+    - build_linux_27
+  tags:
+    - conda-linux
+
+deploy_linux_27:
+  <<: *deploy_job
+  variables: *linux_27_build_variables
   dependencies:
     - build_linux_27
   tags:
@@ -133,7 +147,7 @@ wheels_linux_27:
 build_linux_34:
   <<: *build_job
   variables: &linux_34_build_variables
-    PYTHON_VER: "3.4"
+    PYTHON_VERSION: "3.4"
     WHEEL_TAG: "py3"
   tags:
     - conda-linux
@@ -147,11 +161,11 @@ test_linux_34:
     - conda-linux
 
 
-# Linux + Python 3.5: Builds, tests, uploads wheel and deploys
+# Linux + Python 3.5: Builds, tests and uploads wheel
 build_linux_35:
   <<: *build_job
   variables: &linux_35_build_variables
-    PYTHON_VER: "3.5"
+    PYTHON_VERSION: "3.5"
     WHEEL_TAG: "py3"
   tags:
     - conda-linux
@@ -166,6 +180,7 @@ test_linux_35:
 
 wheels_linux_35:
   <<: *wheels_job
+  variables: *linux_35_build_variables
   dependencies:
     - build_linux_35
   tags:
@@ -173,13 +188,6 @@ wheels_linux_35:
 
 docs_linux_35:
   <<: *docs_job
-  dependencies:
-    - build_linux_35
-  tags:
-    - conda-linux
-
-deploy_linux_35:
-  <<: *deploy_job
   variables: *linux_35_build_variables
   dependencies:
     - build_linux_35
@@ -191,7 +199,7 @@ deploy_linux_35:
 build_macosx_27:
   <<: *build_job
   variables: &macosx_27_build_variables
-    PYTHON_VER: "2.7"
+    PYTHON_VERSION: "2.7"
     WHEEL_TAG: "py27"
   tags:
     - conda-macosx
@@ -209,7 +217,7 @@ test_macosx_27:
 build_macosx_34:
   <<: *build_job
   variables: &macosx_34_build_variables
-    PYTHON_VER: "3.4"
+    PYTHON_VERSION: "3.4"
     WHEEL_TAG: "py3"
   tags:
     - conda-macosx
@@ -227,7 +235,7 @@ test_macosx_34:
 build_macosx_35:
   <<: *build_job
   variables: &macosx_35_build_variables
-    PYTHON_VER: "3.5"
+    PYTHON_VERSION: "3.5"
     WHEEL_TAG: "py3"
   tags:
     - conda-macosx
-- 
GitLab


From 03ccc2ceb714991a161826ab2bdadce807b0d191 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Sat, 24 Sep 2016 09:45:32 +0200
Subject: [PATCH 2/2] Fix test

---
 bob/buildout/test_envwrapper.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/bob/buildout/test_envwrapper.py b/bob/buildout/test_envwrapper.py
index 7eb558e..9e23c9c 100644
--- a/bob/buildout/test_envwrapper.py
+++ b/bob/buildout/test_envwrapper.py
@@ -12,6 +12,15 @@ import platform
 
 from .envwrapper import EnvironmentWrapper
 
+def cleanup():
+  '''Removes weird variables from the user environment just for the tests'''
+
+  remove = ['CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'BOB_PREFIX_PATH',
+      'PKG_CONFIG_PATH', 'CMAKE_PREFIX_PATH', 'MACOSX_DEPLOYMENT_TARGET']
+  for key in remove:
+    if key in os.environ: del os.environ[key]
+
+@nose.with_setup(cleanup)
 def test_default():
 
   e = EnvironmentWrapper(logging.getLogger())
@@ -32,14 +41,6 @@ def test_default():
     assert key in before, "key `%s' was not on os.environ before" % (key,)
   nose.tools.eq_(before, os.environ)
 
-def cleanup():
-  '''Removes weird variables from the user environment just for the tests'''
-
-  remove = ['CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'BOB_PREFIX_PATH',
-      'PKG_CONFIG_PATH', 'CMAKE_PREFIX_PATH', 'MACOSX_DEPLOYMENT_TARGET']
-  for key in remove:
-    if key in os.environ: del os.environ[key]
-
 @nose.with_setup(cleanup)
 def test_set_debug_true():
 
-- 
GitLab