|
1 | | -# The language in this case has no bearing - we are going to be making use of conda for a |
2 | | -# python distribution for the scientific python stack. |
3 | | -language: python |
4 | | - |
5 | | -sudo: false |
| 1 | +language: minimal |
| 2 | +dist: xenial |
6 | 3 |
|
7 | 4 | env: |
8 | | - global: |
9 | | - - CONDA_INSTALL_LOCN="${HOME}/conda" |
10 | | - matrix: |
11 | | - - PYTHON=2.7 |
12 | | - - PYTHON=3.6 |
13 | | - - PYTHON=3 |
| 5 | + matrix: |
| 6 | + - PYTHON_VERSION="2.7" |
| 7 | + - PYTHON_VERSION="3.6" |
| 8 | + - PYTHON_VERSION="3.7" |
14 | 9 |
|
15 | 10 | install: |
16 | | - - mkdir -p ${HOME}/cache/pkgs |
17 | | - - "[ ! -f ${HOME}/cache/miniconda.sh ] && wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ${HOME}/cache/miniconda.sh || :" |
18 | | - - bash ${HOME}/cache/miniconda.sh -b -p ${CONDA_INSTALL_LOCN} && export PATH=${CONDA_INSTALL_LOCN}/bin:$PATH |
19 | | - |
20 | | - # Re-use the pacakges in the cache, and download any new ones into that location. |
21 | | - - rm -rf ${CONDA_INSTALL_LOCN}/pkgs && ln -s ${HOME}/cache/pkgs ${CONDA_INSTALL_LOCN}/pkgs |
22 | | - |
23 | | - # Now do the things we need to do to install it. |
24 | | - - export EXTRA_DEPS='coveralls pip pytest pytest-cov' |
25 | | - - conda create -n test_env --file requirements.txt python=${PYTHON} ${EXTRA_DEPS} --yes --quiet |
26 | | - - source activate test_env |
27 | | - - conda list |
28 | | - |
29 | | - # Enable coverage of cython. |
30 | | - - export CYTHON_COVERAGE=1 |
31 | | - |
32 | | - # Install python-stratify. |
33 | | - - pip install -e . |
| 11 | + # Install miniconda |
| 12 | + # ----------------- |
| 13 | + - echo "Installing miniconda" |
| 14 | + - export CONDA_BASE="https://repo.continuum.io/miniconda/Miniconda" |
| 15 | + - if [[ "${PYTHON_VERSION}" == 2* ]]; then |
| 16 | + wget --quiet "${CONDA_BASE}2-latest-Linux-x86_64.sh" -O miniconda.sh; |
| 17 | + else |
| 18 | + wget --quiet "${CONDA_BASE}3-latest-Linux-x86_64.sh" -O miniconda.sh; |
| 19 | + fi |
| 20 | + - bash miniconda.sh -b -p ${HOME}/miniconda |
| 21 | + - export PATH="${HOME}/miniconda/bin:${PATH}" |
| 22 | + |
| 23 | + # Create the basic testing environment |
| 24 | + # ------------------------------------ |
| 25 | + - echo "Configure conda and create an environment" |
| 26 | + - conda config --set always_yes yes --set changeps1 no |
| 27 | + - conda config --set show_channel_urls True |
| 28 | + - conda config --add channels conda-forge |
| 29 | + - conda update --quiet conda |
| 30 | + - ENV_NAME="test-environment" |
| 31 | + - conda create --quiet -n ${ENV_NAME} python=${PYTHON_VERSION} pip |
| 32 | + - source activate ${ENV_NAME} |
| 33 | + |
| 34 | + # Customise the testing environment |
| 35 | + # --------------------------------- |
| 36 | + - echo "Install python-stratify dependencies" |
| 37 | + - conda install -n ${ENV_NAME} --file requirements.txt --file requirements-dev.txt |
| 38 | + |
| 39 | + # Output debug info. |
| 40 | + - conda list -n ${ENV_NAME} |
| 41 | + - conda list -n ${ENV_NAME} --explicit |
| 42 | + - conda info -a |
| 43 | + |
| 44 | + # Enable coverage for Cython. |
| 45 | + - export CYTHON_COVERAGE=1 |
| 46 | + |
| 47 | + # Install python-straty. |
| 48 | + - pip install -e . |
34 | 49 |
|
35 | 50 | script: |
36 | | - - pytest -ra --pyargs stratify --cov |
| 51 | + - pytest -ra --pyargs stratify --cov |
37 | 52 |
|
38 | 53 | after_success: coveralls |
39 | | - |
40 | | -# We store the files that are downloaded from continuum.io, but not the environments that are created. |
41 | | -cache: |
42 | | - directories: |
43 | | - - $HOME/cache |
44 | | -before_cache: |
45 | | - # Remove all untarred directories. |
46 | | - - find $CONDA_INSTALL_LOCN/pkgs/ -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \; |
|
0 commit comments