.travis.yml
# We set the language to c because python isn't supported on the MacOS X nodes
# on Travis. However, the language ends up being irrelevant anyway, since we
# install Python ourselves using conda.
language: c
compiler: gcc
# Cache can be cleared from the travis settings menu, see docs currently at
# https://docs.travis-ci.com/user/caching#Clearing-Caches
cache:
- ccache
os:
- linux
stage: Comprehensive tests
# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false
# The apt packages below are needed for sphinx builds, which can no longer
# be installed with sudo apt-get.
addons:
apt:
packages:
- graphviz
- language-pack-de
env:
global:
# Set defaults to avoid repeating in most cases
- PYTHON_VERSION=3.6
- NUMPY_VERSION=stable
- PYTEST_VERSION=3.10
- MAIN_CMD='python setup.py'
- CONDA_DEPENDENCIES='Cython jinja2'
- CONDA_ALL_DEPENDENCIES='Cython jinja2 scipy h5py matplotlib pyyaml scikit-image pandas pytz beautifulsoup4 ipython mpmath bleach bottleneck'
- ASDF_PIP_DEP='asdf>=2.3'
- SETUP_XVFB=True
- EVENT_TYPE='push pull_request'
- SETUP_CMD='test'
# PEP8 errors/warnings:
# E101 - mix of tabs and spaces
# W191 - use of tabs
# W291 - trailing whitespace
# W292 - no newline at end of file
# W293 - trailing whitespace
# W391 - blank line at end of file
# E111 - 4 spaces per indentation level
# E112 - 4 spaces per indentation level
# E113 - 4 spaces per indentation level
# E502 - the backslash is redundant between brackets
# E722 - do not use bare except
# E901 - SyntaxError or IndentationError
# E902 - IOError
# E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
# # F821: undefined name # Note: Removed for now because of heavy use of units.si
# F822: undefined name in __all__
# F823: local variable name referenced before assignment
- FLAKE8_OPT="--select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E502,E722,E901,E902,E999,F822,F823"
stages:
# Do the style check and a single test job, don't proceed if it fails
- name: Initial tests
# Do the rest of the tests
- name: Comprehensive tests
- name: Cron tests
if: type = cron
matrix:
# Don't wait for allowed failures
fast_finish: true
include:
# Try MacOS X. Use a slightly old numpy version to help test against
# all supported numpy versions.
- os: osx
stage: Cron tests
env: SETUP_CMD='test --remote-data=astropy'
CONDA_DEPENDENCIES="$CONDA_ALL_DEPENDENCIES clang"
PIP_DEPENDENCIES="jplephem $ASDF_PIP_DEP"
CCOMPILER=clang
EVENT_TYPE='cron'
# Try all python versions and Numpy versions. Since we can assume that
# the Numpy developers have taken care of testing Numpy with different
# versions of Python, we can vary Python and Numpy versions at the same
# time.
# Run this test using native pytest
- os: linux
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.13
INSTALL_CMD='python setup.py build_ext --inplace'
PIP_DEPENDENCIES='pytest-astropy'
TEST_CMD='pytest --open-files --doctest-rst'
PYTEST_VERSION=3.7
script:
- $INSTALL_CMD
- $TEST_CMD
# Now try with all optional dependencies. We also include the --readonly
# flag to make sure no files are being written to the temporary install
# location during testing.
- os: linux
env: PYTHON_VERSION=3.5 SETUP_CMD='test --remote-data=astropy --readonly'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES="jplephem $ASDF_PIP_DEP"
LC_CTYPE=C.ascii LC_ALL=C
PYTEST_VERSION=3.7
- os: linux
stage: Initial tests
env: PYTHON_VERSION=3.7 CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES=$ASDF_PIP_DEP
SETUP_CMD='test -a "--durations=50"'
compiler: clang
# Full tests with coverage checks.
- os: linux
env: SETUP_CMD='test --coverage --remote-data=astropy --readonly'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES="codecov objgraph jplephem bintrees sortedcontainers $ASDF_PIP_DEP"
LC_CTYPE=C.ascii LC_ALL=C
CFLAGS='--coverage -fno-inline-functions -O0'
MATPLOTLIB_VERSION=2.0
EVENT_TYPE='push pull_request cron'
# Try pre-release version of Numpy without optional dependencies
- os: linux
env: NUMPY_VERSION=prerelease
EVENT_TYPE='push pull_request cron'
# Do a PEP8/pyflakes test with flake8
- os: linux
stage: Initial tests
env: MAIN_CMD="flake8 astropy --count $FLAKE8_OPT" SETUP_CMD=''
# Try developer version of Numpy with optional dependencies and also
# run all remote tests. Since both cases will be potentially
# unstable, we combine them into a single unstable build that we can
# mark as an allowed failure below.
- os: linux
env: NUMPY_VERSION=dev SETUP_CMD='test --remote-data'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES=$ASDF_PIP_DEP
MATPLOTLIB_VERSION=dev
# We check numpy-dev also in a job that only runs from cron, so that
# we can spot issues sooner. We do not use remote data here, since
# that gives too many false positives due to URL timeouts.
- os: linux
stage: Cron tests
env: NUMPY_VERSION=dev MATPLOTLIB_VERSION=dev EVENT_TYPE='cron'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES=$ASDF_PIP_DEP
allow_failures:
- os: linux
env: NUMPY_VERSION=dev SETUP_CMD='test --remote-data'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES=$ASDF_PIP_DEP
MATPLOTLIB_VERSION=dev
before_install:
# We need to use CCOMPILER otherwise Travis overwrites CC if we define it
# in env: above.
- if [ ! -z $CCOMPILER ]; then
export CC=$CCOMPILER;
fi
# Check CC variable
- echo $CC
install:
- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda.sh
script:
- $MAIN_CMD $SETUP_CMD
after_success:
- if [[ $SETUP_CMD == *--coverage* ]]; then
codecov --gcov-glob "*cextern*";
fi