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

Thomas Vincent's avatar
Thomas Vincent committed
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 14

### Linux ###

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

Thomas Vincent's avatar
Thomas Vincent committed
41
.linux_test_template: &linux_test_definition
Thomas Vincent's avatar
Thomas Vincent committed
42
  stage: test
Thomas Vincent's avatar
Thomas Vincent committed
43 44
  tags:
    - linux
Thomas Vincent's avatar
Thomas Vincent committed
45
  image: ${IMAGE}
Thomas Vincent's avatar
Thomas Vincent committed
46 47
  before_script:
    - rm -rf ${VENV_DIR}
Thomas Vincent's avatar
Thomas Vincent committed
48
    - pip install --upgrade virtualenv  # Make sure virtualenv is installed
Thomas Vincent's avatar
Thomas Vincent committed
49 50 51 52
    - virtualenv --python=${PYTHON} ${VENV_DIR}
    - source ${VENV_DIR}/bin/activate
    - pip install --upgrade pip setuptools
    # TODO use requirements file - pip install -r requirements.txt
53
    # Install numpy first as it is needed to build xrayutilities
Thomas Vincent's avatar
Thomas Vincent committed
54 55
    - pip install --pre numpy --only-binary numpy
    - pip install --pre h5py fabio scipy silx xrayutilities --only-binary scipy,h5py,silx,fabio
56 57
    - which python
    - python ./ci/info_platform.py
Thomas Vincent's avatar
Thomas Vincent committed
58 59 60 61 62 63
  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
64 65

# Python2 tasks
Thomas Vincent's avatar
Thomas Vincent committed
66 67
.linux_python2_variables:
   variables: &linux_python2_definition
Thomas Vincent's avatar
Thomas Vincent committed
68
    IMAGE: python:2.7-jessie
Thomas Vincent's avatar
Thomas Vincent committed
69 70
    PYTHON: python2

Thomas Vincent's avatar
Thomas Vincent committed
71 72 73
linux_build_python2:
  <<: *linux_build_definition
  variables: *linux_python2_definition
Thomas Vincent's avatar
Thomas Vincent committed
74

Thomas Vincent's avatar
Thomas Vincent committed
75 76
linux_test_python2:
  <<: *linux_test_definition
Thomas Vincent's avatar
Thomas Vincent committed
77
  dependencies:
Thomas Vincent's avatar
Thomas Vincent committed
78 79
   - linux_build_python2
  variables: *linux_python2_definition
Thomas Vincent's avatar
Thomas Vincent committed
80 81 82


# Python3 tasks
Thomas Vincent's avatar
Thomas Vincent committed
83 84
.linux_python3_variables:
   variables: &linux_python3_definition
Thomas Vincent's avatar
Thomas Vincent committed
85
    IMAGE: python:3.5-stretch
Thomas Vincent's avatar
Thomas Vincent committed
86 87
    PYTHON: python3

Thomas Vincent's avatar
Thomas Vincent committed
88 89 90
linux_build_python3:
  <<: *linux_build_definition
  variables: *linux_python3_definition
Thomas Vincent's avatar
Thomas Vincent committed
91

Thomas Vincent's avatar
Thomas Vincent committed
92 93
linux_test_python3:
  <<: *linux_test_definition
Thomas Vincent's avatar
Thomas Vincent committed
94
  dependencies:
Thomas Vincent's avatar
Thomas Vincent committed
95 96
   - linux_build_python3
  variables: *linux_python3_definition
Thomas Vincent's avatar
Thomas Vincent committed
97 98


Thomas Vincent's avatar
Thomas Vincent committed
99 100
### Documentation ###

Thomas Vincent's avatar
Thomas Vincent committed
101
# Deploy documentation in gitlab (only for master branch)
Thomas Vincent's avatar
Thomas Vincent committed
102 103
pages:
  stage: deploy
Thomas Vincent's avatar
Thomas Vincent committed
104 105 106
  tags:
    - linux
  image: python:2.7-jessie
Thomas Vincent's avatar
Thomas Vincent committed
107
  dependencies:
Thomas Vincent's avatar
Thomas Vincent committed
108
    - windows_build_python3
Thomas Vincent's avatar
Thomas Vincent committed
109 110 111
  script:
    - rm -rf public
    - mv build/sphinx/html public
Thomas Vincent's avatar
Thomas Vincent committed
112
  artifacts:
Thomas Vincent's avatar
Thomas Vincent committed
113 114 115 116
    paths:
      - public
  only:
    - master
Thomas Vincent's avatar
Thomas Vincent committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137


### Windows ###

.windows_template: &windows_definition
  tags:
    - win
  before_script:
    - SET "PATH=C:\\miniconda3;C:\\miniconda3\\Scripts;%PATH%"
    - python -m venv --clear %VENV_DIR%
    - call "%VENV_DIR%\\Scripts\\activate.bat"
    - python -m pip install --upgrade pip
    - python ci\info_platform.py
  script:
  after_script:
    - rmdir %VENV_DIR% /s /q

windows_build_python3:
  <<: *windows_definition
  stage: build
  script:
138
    - pip install --upgrade --pre -r requirements-dev.txt
Thomas Vincent's avatar
Thomas Vincent committed
139 140 141
    - python ci\info_platform.py
    # Build the wheel
    - python setup.py bdist_wheel
142
    # Build the doc (dependencies are needed)
143
    - pip install --upgrade --pre -r requirements.txt
144
    - python setup.py build build_doc
Thomas Vincent's avatar
Thomas Vincent committed
145 146 147 148
    - dir dist
  artifacts:
    paths:
      - dist
149
      - build/sphinx/html/
Thomas Vincent's avatar
Thomas Vincent committed
150 151 152 153 154 155 156 157 158 159
    when: on_success
    expire_in: 2h

windows_test_python3:
  <<: *windows_definition
  stage: test
  dependencies:
    - windows_build_python3
  script:
    # Install numpy first as it is needed to build xrayutilities
160 161
    - pip install --pre numpy --only-binary numpy
    - pip install --pre h5py fabio scipy silx xrayutilities --only-binary scipy,h5py,silx,fabio
Thomas Vincent's avatar
Thomas Vincent committed
162 163 164 165
    - python ci\info_platform.py
    # Install wheel and run the tests
    - pip install --pre --find-links dist/ --no-cache-dir --no-index xsocs
    - python run_tests.py --installed -v