summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: d81d89fabbab7545c4e3653f8d1ca34ea019bfc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
80
81
82
83
language: python

branches:
  # prevent bors temporary branches to be built
  except:
  - staging.tmp
  - trying.tmp

env:
  # This project adheres to NEP-29
  # https://numpy.org/neps/nep-0029-deprecation_policy.html

  # Refer to https://docs.scipy.org/doc/numpy/release.html for
  # min/max Python version supported by numpy
  # Refer to history of https://github.com/lebigot/uncertainties/blob/master/setup.py
  # for min/max Python versions supported by uncertainties

  - PKGS="python=3.8 pre-commit"
  # Pinned packages to match readthedocs CI https://readthedocs.org/projects/pint/
  - PKGS="python=3.7 ipython matplotlib nbsphinx numpy pandas==1.1.3 jupyter_client ipykernel python-graphviz graphviz xarray sparse dask[complete] sphinx Pygments==2.3.1 docutils==0.14 alabaster commonmark==0.8.1 recommonmark==0.5.0 babel==2.8"
  - PKGS="python=3.6"
  - PKGS="python=3.7"
  - PKGS="python=3.8"
  - PKGS="python=3.6 uncertainties=3.0"
  - PKGS="python=3.7 uncertainties=3.0"
  - PKGS="python=3.6 numpy=1.14 matplotlib"
  - PKGS="python=3.7 numpy=1.14 matplotlib"
  - PKGS="python=3.8 numpy=1.17 matplotlib"
  - PKGS="python=3.6 numpy=1.14 uncertainties=3.0"
  - PKGS="python=3.7 numpy=1.14 uncertainties=3.0"
  - PKGS="python=3.6 numpy uncertainties"
  - PKGS="python=3.7 numpy uncertainties"
  - PKGS="python=3.8 numpy uncertainties"
  - PKGS="python=3.8 numpy uncertainties sparse xarray netCDF4"

  # TODO: pandas tests
  # - PKGS="python=3.7 numpy pandas uncertainties pandas"

before_install:
  - sudo apt-get update
  - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - hash -r
  - conda config --set always_yes yes --set changeps1 no
  - conda config --add channels conda-forge
  - conda update -q conda
  # Useful for debugging any issues with conda
  - conda info -a

  # The next couple lines fix a crash with multiprocessing on Travis and are not specific to using Miniconda
  # But broke travis 2019-08
  # - sudo rm -rf /dev/shm
  # - sudo ln -s /run/shm /dev/shm
  - export TEST_OPTS="-rfsxEX -s --cov=pint --cov-config=.coveragerc"

install:
  - conda create -n travis $PKGS pytest pytest-cov coveralls pytest-subtests
  - source activate travis
  - if [[ $PKGS =~ pandas ]]; then PANDAS=1; else PANDAS=0; fi
  - if [[ $PKGS =~ pre-commit ]]; then LINT=1; else LINT=0; fi
  - if [[ $PKGS =~ sphinx ]]; then DOCS=1; else DOCS=0; fi
  - if [[ $PKGS =~ matplotlib && $DOCS == 0 ]]; then pip install pytest-mpl; export TEST_OPTS="$TEST_OPTS --mpl"; fi
  - if [[ $DOCS == 1 ]]; then pip install pint-pandas; fi
  # this is superslow but suck it up until updates to pandas are made
  # - if [[ $PANDAS == '1' ]]; then pip install numpy cython pytest pytest-cov nbval; pip install git+https://github.com/pandas-dev/pandas.git@bdb7a1603f1e0948ca0cab011987f616e7296167; python -c 'import pandas; print(pandas.__version__)'; fi
  - conda list
  - pip install .

script:
  # if we're doing the pandas tests and hence have pytest available, we can
  # simply use it to run all the tests
  # - if [[ $PANDAS == '1' ]]; then python -bb -m coverage run -p --source=pint --omit="*test*","*compat*" -m py.test -rfsxEX; fi
  # test notebooks too if pandas available
  # - if [[ $PANDAS == '1' ]]; then pip install -e .; pytest --nbval notebooks/*; fi
  - if [[ $PANDAS == 0 && $LINT == 0 && $DOCS == 0 ]]; then python -bb -m pytest $TEST_OPTS; fi
  - if [[ $LINT == 1 ]]; then pre-commit run --all-files; fi
  - if [[ $DOCS == 1 ]]; then PYTHONPATH=$PWD sphinx-build -n -j auto -b html -d build/doctrees docs build/html; fi
  - if [[ $DOCS == 1 ]]; then PYTHONPATH=$PWD sphinx-build -a -j auto -b doctest -d build/doctrees docs build/doctest; fi
  - if [[ $LINT == 0 && $DOCS == 0 ]]; then coverage report -m; fi

after_success:
  - coveralls --verbose