.gitlab-ci.yml 2.5 KB
Newer Older
Thomas Vincent's avatar
Thomas Vincent committed
1 2 3 4 5
stages:
  - build
  - test
  - deploy

6 7 8 9 10 11
variables:  # Global variables
  VENV_DIR: xsocs_venv
  http_proxy: http://proxy.esrf.fr:3128
  https_proxy: http://proxy.esrf.fr:3128
  no_proxy: .esrf.fr,localhost

Thomas Vincent's avatar
Thomas Vincent committed
12 13
# Target definitions
.build_template: &build_definition
Thomas Vincent's avatar
Thomas Vincent committed
14
  stage: build
Thomas Vincent's avatar
Thomas Vincent committed
15
  image: ${IMAGE}
Thomas Vincent's avatar
Thomas Vincent committed
16 17
  before_script:
    - rm -rf ${VENV_DIR}
Thomas Vincent's avatar
Thomas Vincent committed
18
    - pip install --upgrade virtualenv  # Make sure virtualenv is installed
Thomas Vincent's avatar
Thomas Vincent committed
19 20 21 22
    - virtualenv --python=${PYTHON} ${VENV_DIR}
    - source ${VENV_DIR}/bin/activate
    - pip install --upgrade pip setuptools
    - pip install --upgrade -r requirements-dev.txt
23
    - which python
Thomas Vincent's avatar
Thomas Vincent committed
24 25 26 27 28 29 30
    - python ./ci/info_platform.py
  script:
    - python setup.py bdist_wheel
    - python setup.py build build_doc
    - ls dist/
  after_script:
    - rm -rf ${VENV_DIR}
31 32 33 34 35 36
  artifacts:
    paths:
      - dist/
      - build/sphinx/html/
    when: on_success
    expire_in: 2h
Thomas Vincent's avatar
Thomas Vincent committed
37

Thomas Vincent's avatar
Thomas Vincent committed
38
.test_template: &test_definition
Thomas Vincent's avatar
Thomas Vincent committed
39
  stage: test
Thomas Vincent's avatar
Thomas Vincent committed
40
  image: ${IMAGE}
Thomas Vincent's avatar
Thomas Vincent committed
41 42
  before_script:
    - rm -rf ${VENV_DIR}
Thomas Vincent's avatar
Thomas Vincent committed
43
    - pip install --upgrade virtualenv  # Make sure virtualenv is installed
Thomas Vincent's avatar
Thomas Vincent committed
44 45 46 47
    - virtualenv --python=${PYTHON} ${VENV_DIR}
    - source ${VENV_DIR}/bin/activate
    - pip install --upgrade pip setuptools
    # TODO use requirements file - pip install -r requirements.txt
48 49
    # Install numpy first as it is needed to build xrayutilities
    - pip install numpy --only-binary numpy
Thomas Vincent's avatar
Thomas Vincent committed
50
    - pip install h5py fabio scipy silx xrayutilities --only-binary scipy,h5py,silx,fabio
51 52
    - which python
    - python ./ci/info_platform.py
Thomas Vincent's avatar
Thomas Vincent committed
53 54 55 56 57 58
  script:
    - pip install --pre --find-links dist/ --no-cache-dir --no-index xsocs
    - python run_tests.py --installed -v
  after_script:
    - rm -rf ${VENV_DIR}

Thomas Vincent's avatar
Thomas Vincent committed
59 60 61 62

# Python2 tasks
.python2_variables:
   variables: &python2_definition
Thomas Vincent's avatar
Thomas Vincent committed
63
    IMAGE: python:2.7-jessie
Thomas Vincent's avatar
Thomas Vincent committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
    PYTHON: python2

build_python2:
  <<: *build_definition
  variables: *python2_definition

test_python2:
  <<: *test_definition
  dependencies:
   - build_python2
  variables: *python2_definition


# Python3 tasks
.python3_variables:
   variables: &python3_definition
Thomas Vincent's avatar
Thomas Vincent committed
80
    IMAGE: python:3.4-jessie
Thomas Vincent's avatar
Thomas Vincent committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94
    PYTHON: python3

build_python3:
  <<: *build_definition
  variables: *python3_definition

test_python3:
  <<: *test_definition
  dependencies:
   - build_python3
  variables: *python3_definition


# Deploy documentation in gitlab (only for master branch)
Thomas Vincent's avatar
Thomas Vincent committed
95 96
pages:
  stage: deploy
Thomas Vincent's avatar
Thomas Vincent committed
97
  image: python:3.4-jessie
Thomas Vincent's avatar
Thomas Vincent committed
98
  dependencies:
Thomas Vincent's avatar
Thomas Vincent committed
99
    - build_python3
Thomas Vincent's avatar
Thomas Vincent committed
100 101 102
  script:
    - rm -rf public
    - mv build/sphinx/html public
Thomas Vincent's avatar
Thomas Vincent committed
103
  artifacts:
Thomas Vincent's avatar
Thomas Vincent committed
104 105 106 107
    paths:
      - public
  only:
    - master