-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
234 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,123 @@ | ||
# 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 | ||
|
||
os: | ||
- linux | ||
language: python | ||
- linux | ||
|
||
python: | ||
- 2.7 | ||
# Setting sudo to false opts in to Travis-CI container-based builds. | ||
sudo: false | ||
|
||
virtualenv: | ||
system_site_packages: true | ||
# The apt packages below are needed for sphinx builds. A full list of packages | ||
# that can be included can be found here: | ||
# | ||
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise | ||
|
||
cache: | ||
apt: true | ||
addons: | ||
apt: | ||
packages: clang | ||
|
||
sudo: false | ||
cache: | ||
directories: | ||
- $HOME/miniconda | ||
- $HOME/tardis-refdata | ||
|
||
env: | ||
global: | ||
|
||
# The following versions are the 'default' for tests, unless | ||
# overridden underneath. They are defined here in order to save having | ||
# to repeat them for all configurations. | ||
- PYTHON_VERSION=2.7 | ||
- NUMPY_VERSION=stable | ||
- ASTROPY_VERSION=stable | ||
- MAIN_CMD='python setup.py' | ||
- SETUP_CMD='test' | ||
- PIP_DEPENDENCIES='' | ||
- EVENT_TYPE='pull_request push' | ||
|
||
|
||
# For this package-template, we include examples of Cython modules, | ||
# so Cython is required for testing. If your package does not include | ||
# Cython code, you can set CONDA_DEPENDENCIES='' | ||
- CONDA_DEPENDENCIES='Cython' | ||
|
||
# List other runtime dependencies for the package that are available as | ||
# pip packages here. | ||
# - PIP_DEPENDENCIES='' | ||
|
||
# Conda packages for affiliated packages are hosted in channel | ||
# "astropy" while builds for astropy LTS with recent numpy versions | ||
# are in astropy-ci-extras. If your package uses either of these, | ||
# add the channels to CONDA_CHANNELS along with any other channels | ||
# you want to use. | ||
- CONDA_CHANNELS='astropy-ci-extras astropy' | ||
|
||
# If there are matplotlib or other GUI tests, uncomment the following | ||
# line to use the X virtual framebuffer. | ||
# - SETUP_XVFB=True | ||
- COMPILER=gcc | ||
- PANDAS_VERSION=0.16 | ||
|
||
- TARDIS_REF_DATA_URL='https://github.com/tardis-sn/tardis-refdata.git' | ||
- ASTROPY_USE_SYSTEM_PYTEST=1 | ||
|
||
matrix: | ||
- COMPILER=gcc | ||
- COMPILER=clang | ||
- SETUP_CMD='test' | ||
- TEST_MODE='normal' | ||
- TARDIS_REF_DATA_URL='https://github.com/tardis-sn/tardis-refdata.git' | ||
- MINICONDA_URL='http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh' | ||
- SAVE_COVERAGE=false | ||
- SETUP_CMD='test --coverage --args="--tardis-refdata=$HOME/tardis-refdata/"' | ||
# Make sure that egg_info works without dependencies | ||
# - PYTHON_VERSION=2.7 SETUP_CMD='egg_info' | ||
# - PYTHON_VERSION=3.4 SETUP_CMD='egg_info' | ||
# - PYTHON_VERSION=3.5 SETUP_CMD='egg_info' | ||
# - PYTHON_VERSION=3.6 SETUP_CMD='egg_info' | ||
|
||
matrix: | ||
include: | ||
- python: 2.7 | ||
env: | ||
- COMPILER=gcc | ||
- SETUP_CMD='test --coverage --args="--tardis-refdata=$HOME/tardis-refdata/"' | ||
- TEST_MODE='spectrum' | ||
- SAVE_COVERAGE=true | ||
|
||
- python: 2.7 | ||
env: | ||
- COMPILER=clang | ||
- SETUP_CMD='test --args="--tardis-refdata=$HOME/tardis-refdata/"' | ||
- TEST_MODE='spectrum' | ||
|
||
- os: osx | ||
language: generic | ||
env: | ||
- COMPILER=clang | ||
- SETUP_CMD='test --args="--tardis-refdata=$HOME/tardis-refdata/"' | ||
- TEST_MODE='spectrum' | ||
- MINICONDA_URL='http://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh' | ||
# Don't wait for allowed failures | ||
fast_finish: true | ||
|
||
|
||
- python: 2.7 | ||
include: | ||
# Try MacOS X | ||
- os: osx | ||
env: SETUP_CMD='test' | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- clang | ||
|
||
|
||
|
||
|
||
before_install: | ||
# We do this to make sure we get the dependencies so pip works below | ||
- export PYTHONIOENCODING=UTF8 | ||
- wget $MINICONDA_URL -O miniconda.sh | ||
- chmod +x miniconda.sh | ||
- bash miniconda.sh -b -p $HOME/miniconda | ||
- export PATH=$HOME/miniconda/bin:$PATH | ||
- hash -r | ||
- conda update --yes conda | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then conda install -c conda-forge git-lfs=2.2.1 -y; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git lfs install --skip-smudge; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git clone $TARDIS_REF_DATA_URL $HOME/tardis-refdata; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then cd $HOME/tardis-refdata; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git fetch origin pull/3/head:carsus-ref; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git checkout carsus-ref; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git lfs pull --include="atom_data/kurucz_cd23_chianti_H_He.h5" origin; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git lfs pull --include="atom_data/chianti_He.h5" origin; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git lfs pull --include="plasma_reference/" origin; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then git lfs pull --include="unit_test_data.h5" origin; fi | ||
- if [[ $TEST_MODE == 'spectrum' ]]; then cd $TRAVIS_BUILD_DIR; fi | ||
# Do a coverage test. | ||
- os: linux | ||
env: SETUP_CMD='test --coverage --args="--tardis-refdata=$HOME/tardis-refdata/"' | ||
|
||
install: | ||
- cd $TRAVIS_BUILD_DIR | ||
- conda env create -f tardis_env27.yml | ||
- source activate tardis | ||
|
||
# We now use the ci-helpers package to set up our testing environment. | ||
# This is done by using Miniconda and then using conda and pip to install | ||
# dependencies. Which dependencies are installed using conda and pip is | ||
# determined by the CONDA_DEPENDENCIES and PIP_DEPENDENCIES variables, | ||
# which should be space-delimited lists of package names. See the README | ||
# in https://github.com/astropy/ci-helpers for information about the full | ||
# list of environment variables that can be used to customize your | ||
# environment. In some cases, ci-helpers may not offer enough flexibility | ||
# in how to install a package, in which case you can have additional | ||
# commands in the install: section below. | ||
|
||
- source travis/setup_conda.sh | ||
- source travis/before_install.sh | ||
|
||
# As described above, using ci-helpers, you should be able to set up an | ||
# environment with dependencies installed using conda and pip, but in some | ||
# cases this may not provide enough flexibility in how to install a | ||
# specific dependency (and it will not be able to install non-Python | ||
# dependencies). Therefore, you can also include commands below (as | ||
# well as at the start of the install section or in the before_install | ||
# section if they are needed before setting up conda) to install any | ||
# other dependencies. | ||
|
||
script: | ||
- echo CC=$COMPILER python setup.py $SETUP_CMD | ||
- CC=$COMPILER python setup.py $SETUP_CMD | ||
- echo CC=$COMPILER $MAIN_CMD $SETUP_CMD | ||
- CC=$COMPILER $MAIN_CMD $SETUP_CMD | ||
|
||
after_success: | ||
- if [[ "$SAVE_COVERAGE" = true ]]; then coveralls; fi | ||
|
||
after_failure: | ||
- cat /home/travis/.pip/pip.log | ||
# If coveralls.io is set up for this package, uncomment the line below. | ||
# The coveragerc file may be customized as needed for your package. | ||
# - if [[ $SETUP_CMD == *coverage* ]]; then coveralls --rcfile='packagename/tests/coveragerc'; fi | ||
- if [[ $SETUP_CMD == *coverage* ]]; then coveralls; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if [[ $SETUP_CMD == *coverage* ]]; then | ||
conda install -c conda-forge git-lfs=2.2.1 -y | ||
git lfs install --skip-smudge | ||
if [ ! "$(ls -A $HOME/tardis-refdata)" ]; then | ||
git clone $TARDIS_REF_DATA_URL $HOME/tardis-refdata | ||
fi | ||
cd $HOME/tardis-refdata | ||
|
||
# Checkout PR version of tardis-refdata, not master | ||
git fetch origin pull/3/head:carsus-ref | ||
git checkout carsus-ref | ||
|
||
# Pull the files | ||
git lfs pull --include="atom_data/kurucz_cd23_chianti_H_He.h5" origin | ||
git lfs pull --include="atom_data/chianti_He.h5" origin | ||
git lfs pull --include="plasma_reference/" origin | ||
git lfs pull --include="unit_test_data.h5" origin | ||
cd $TRAVIS_BUILD_DIR | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
# Note to the future: keep the conda scripts separate for each OS because many | ||
# packages call ci-helpers with: | ||
# | ||
# source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh | ||
# | ||
# The present script was added later. | ||
|
||
if [[ $DEBUG == True ]]; then | ||
set -x | ||
fi | ||
|
||
# First check: if the build should be run at all based on the event type | ||
|
||
if [[ ! -z $EVENT_TYPE ]]; then | ||
for event in $EVENT_TYPE; do | ||
if [[ $TRAVIS_EVENT_TYPE = $event ]]; then | ||
allow_to_build=True | ||
fi | ||
done | ||
if [[ $allow_to_build != True ]]; then | ||
travis_terminate 0 | ||
fi | ||
fi | ||
|
||
# Second check: if any of the custom tags are used to skip the build | ||
|
||
TR_SKIP="\[(skip travis|travis skip)\]" | ||
DOCS_ONLY="\[docs only|build docs\]" | ||
|
||
# Travis doesn't provide the commit message of the top of the branch for | ||
# PRs, only the commit message of the merge. Thus this ugly workaround is | ||
# needed for now. | ||
|
||
if [[ $TRAVIS_PULL_REQUEST == false ]]; then | ||
COMMIT_MESSAGE=${TRAVIS_COMMIT_MESSAGE} | ||
else | ||
COMMIT_MESSAGE=$(git show -s $TRAVIS_COMMIT_RANGE | awk 'BEGIN{count=0}{if ($1=="Author:") count++; if (count==1) print $0}') | ||
fi | ||
|
||
# Skip build if the commit message contains [skip travis] or [travis skip] | ||
# Remove workaround once travis has this feature natively | ||
# https://github.com/travis-ci/travis-ci/issues/5032 | ||
|
||
if [[ ! -z $(echo ${COMMIT_MESSAGE} | grep -E "${TR_SKIP}") ]]; then | ||
echo "Travis was requested to be skipped by the commit message, exiting." | ||
travis_terminate 0 | ||
elif [[ ! -z $(echo ${COMMIT_MESSAGE} | grep -E "${DOCS_ONLY}") ]]; then | ||
if [[ $SETUP_CMD != *build_docs* ]] && [[ $SETUP_CMD != *build_sphinx* ]]; then | ||
echo "Only docs build was requested by the commit message, exiting." | ||
travis_terminate 0 | ||
fi | ||
fi | ||
|
||
echo "==================== Starting executing ci-helpers scripts =====================" | ||
|
||
source travis/setup_conda_$TRAVIS_OS_NAME.sh; | ||
|
||
echo "================= Returning executing local .travis.yml script =================" | ||
|
||
set +x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Install conda | ||
# http://conda.pydata.org/docs/travis.html#the-travis-yml-file | ||
echo ls -la $HOME/miniconda | ||
ls -la $HOME/miniconda | ||
if [ ! "$(ls -A $HOME/miniconda)" ]; then | ||
echo "Cache is empty, installing miniconda and test environment." | ||
# Control will enter here if $HOME/miniconda is empty. | ||
rm -r $HOME/miniconda | ||
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 env create -f tardis_env27.yml | ||
else | ||
export PATH="$HOME/miniconda/bin:$PATH" | ||
fi | ||
|
||
source activate tardis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Workaround for https://github.com/travis-ci/travis-ci/issues/6307, which | ||
# caused the following error on MacOS X workers: | ||
# | ||
# /Users/travis/build.sh: line 109: shell_session_update: command not found | ||
# | ||
rvm get head | ||
|
||
# Install conda | ||
# http://conda.pydata.org/docs/travis.html#the-travis-yml-file | ||
echo ls -la $HOME/miniconda | ||
ls -la $HOME/miniconda | ||
if [ ! "$(ls -A $HOME/miniconda)" ]; then | ||
echo "Cache is empty, installing miniconda and test environment." | ||
# Control will enter here if $HOME/miniconda is empty. | ||
rm -r $HOME/miniconda | ||
# Control will enter here if $HOME/miniconda doesn't exist. | ||
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh | ||
|
||
export PATH="$HOME/miniconda/bin:$PATH" | ||
|
||
hash -r | ||
|
||
conda env create -f tardis_env27.yml | ||
else | ||
export PATH="$HOME/miniconda/bin:$PATH" | ||
fi | ||
|
||
source activate tardis |