.gitlab-ci.yml 5.03 KB
Newer Older
1 2 3 4 5
# 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.
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
6 7


8 9 10
# 1) Generic instructions (only change if you know what you're doing)
# -------------------------------------------------------------------

Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
11 12 13 14 15 16 17 18
# Definition of our build pipeline
stages:
  - build
  - test
  - docs
  - wheels


19 20 21 22
# Global variables
variables:
  CONDA_PREFIX: env

Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
23 24 25 26 27 28 29

# 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
30 31
    - curl --silent https://gitlab.idiap.ch/bob/bob/snippets/7/raw | tr -d '\r' > bootstrap-conda.sh
    - chmod 755 ./bootstrap-conda.sh
32
    - sed 1d -i requirements.txt # GAMBIT to remove pillow<3
33 34 35
    - ./bootstrap-conda.sh ${CONDA_FOLDER} ${PYTHON_VER} ${CONDA_PREFIX}
  variables: &build_variables
    BOB_DOCUMENTATION_SERVER: "http://www.idiap.ch/software/bob/docs/latest/bob/%s/master/"
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
36
  script:
37 38 39 40 41 42 43 44 45
    - ./bin/buildout -c buildout-before-patch.cfg
    - wget https://www.idiap.ch/software/bob/databases/latest/PythonFaceEvaluation.tar.bz2
    - mkdir PythonFaceEvaluation
    - tar -xjf PythonFaceEvaluation.tar.bz2 -C PythonFaceEvaluation
    - ./bin/patch_CSU.py PythonFaceEvaluation
    - ./bin/buildout buildout:csu-dir=./PythonFaceEvaluation
    - if [ -x ./bin/bob_dbmanage.py ]; then ./bin/bob_dbmanage.py all download --force; fi
    - ./bin/sphinx-build doc sphinx
    - ./bin/python setup.py bdist_wheel --python-tag ${WHEEL_TAG}
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
46
  after_script:
47
    - rm -rf ${CONDA_PREFIX}
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
48
  artifacts:
49
    expire_in: 1 day
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
50
    paths:
51
      - bootstrap-conda.sh
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
52 53
      - dist/
      - sphinx/
54
      - PythonFaceEvaluation/
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
55 56


57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
# Template for building on a Linux machine
.build_linux_template: &linux_build_job
  <<: *build_job
  variables: &linux_build_variables
    <<: *build_variables
    CONDA_FOLDER: "/local/conda"
    CFLAGS: "-D_GLIBCXX_USE_CXX11_ABI=0 -coverage"
    CXXFLAGS: "-D_GLIBCXX_USE_CXX11_ABI=0 -coverage"


# Template for building on a Mac OSX machine
.build_mac_template: &macosx_build_job
  <<: *build_job
  variables: &macosx_build_variables
    <<: *build_variables
    CONDA_FOLDER: "/opt/conda"
    MACOSX_DEPLOYMENT_TARGET: "10.9"
    CFLAGS: "-pthread -coverage"
    CXXFLAGS: "-pthread -coverage"
    LDFLAGS: "-lpthread"


# Template for the test stage - re-install from uploaded wheels
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
80 81 82 83
# Needs to run on all supported architectures, platforms and python versions
.test_template: &test_job
  stage: test
  before_script:
84
    - sed 1d -i requirements.txt # GAMBIT to remove pillow<3 
85 86
    - ./bootstrap-conda.sh ${CONDA_FOLDER} ${PYTHON_VER} ${CONDA_PREFIX}
    - source ${CONDA_FOLDER}/bin/activate ${CONDA_PREFIX}
87 88
    - conda install --yes -c conda-forge -p ${CONDA_PREFIX} jpeg==9b opencv==2.4.12
    - pip install --use-wheel --no-index --pre dist/*.whl    
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
89
  script:
90
    - cd ${CONDA_PREFIX}    
91
    - export PYTHONPATH="../PythonFaceEvaluation/src:$PYTHONPATH"
92
    - sed -i "\$apillow=2.9.0" ../requirements.txt
93
    - ../bin/buildout buildout:csu-dir=../PythonFaceEvaluation   
94 95 96 97
    - python -c "from ${CI_PROJECT_NAME} import get_config; print(get_config())"
    - coverage run --source=${CI_PROJECT_NAME} ./bin/nosetests -sv ${CI_PROJECT_NAME}
    - coverage report
    - sphinx-build -b doctest ../doc ../sphinx
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
98
  after_script:
99
    - rm -rf ${CONDA_PREFIX}
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
100 101 102


# Template for the wheel uploading stage
103 104 105
# 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)
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
106 107 108 109
.wheels_template: &wheels_job
  stage: wheels
  only:
    - master
110
    - tags
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
111
  before_script:
112 113
    - curl --silent https://gitlab.idiap.ch/bob/bob/snippets/8/raw | tr -d '\r' > upload-wheel.sh
    - chmod 755 upload-wheel.sh
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
114
  script:
115
    - ./upload-wheel.sh
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
116 117 118 119 120 121 122 123 124


# Template for (latest) documentation upload stage
# Only one real job needs to do this
.docs_template: &docs_job
  stage: docs
  only:
    - master
  before_script:
125 126
    - curl --silent https://gitlab.idiap.ch/bob/bob/snippets/9/raw | tr -d '\r' > upload-sphinx.sh
    - chmod 755 upload-sphinx.sh
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
127
  script:
128
    - ./upload-sphinx.sh
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
129 130


131 132
# 2) Package specific instructions (you may tune this if needed)
# --------------------------------------------------------------
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
133

134
# Linux + Python 2.7: Builds, tests, uploads wheel
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
135
build_linux_27:
136
  <<: *linux_build_job
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
137
  variables: &linux_27_build_variables
138 139
    <<: *linux_build_variables
    PYTHON_VER: "2.7"
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
140 141 142 143 144 145 146 147 148 149 150 151
    WHEEL_TAG: "py27"
  tags:
    - conda-linux

test_linux_27:
  <<: *test_job
  variables: *linux_27_build_variables
  dependencies:
    - build_linux_27
  tags:
    - conda-linux

152 153
docs_linux_27:
  <<: *docs_job
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
154
  dependencies:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
155
    - build_linux_27
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
156 157 158
  tags:
    - conda-linux

159 160
wheels_linux_27:
  <<: *wheels_job
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
161
  dependencies:
Tiago de Freitas Pereira's avatar
Tiago de Freitas Pereira committed
162
    - build_linux_27
Amir MOHAMMADI's avatar
Amir MOHAMMADI committed
163 164 165
  tags:
    - conda-linux