Skip to content

Commit

Permalink
Merge pull request #131 from brittonsmith/circle
Browse files Browse the repository at this point in the history
Bump caches and python versions on master
  • Loading branch information
brittonsmith committed Apr 25, 2020
2 parents 17ad12d + 8b86b31 commit a5ed5bd
Showing 1 changed file with 115 additions and 119 deletions.
234 changes: 115 additions & 119 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ version: 2.1

commands:
set-env:
description: "Set environment variables."
description:
steps:
- run: |
echo 'export YT_DIR=$HOME/yt-git' >> $BASH_ENV
echo 'TRIDENT_ION_DATA=$HOME/.trident' >> $BASH_ENV
echo 'TRIDENT_ANSWER_DATA=$HOME/answer_test_data' >> $BASH_ENV
echo 'TRIDENT_CONFIG=$HOME/.trident/config.tri' >> $BASH_ENV
echo 'YT_GOLD=8dcc2fa135dfe7a62438507066527caf5cb379c1' >> $BASH_ENV
echo 'YT_HEAD=yt-4.0' >> $BASH_ENV
echo 'TRIDENT_GOLD=test-standard-sph-viz-v6' >> $BASH_ENV
echo 'TRIDENT_HEAD=tip' >> $BASH_ENV
- run:
name: "Set environment variables."
command: |
echo 'export YT_DIR=$HOME/yt-git' >> $BASH_ENV
echo 'TRIDENT_ION_DATA=$HOME/.trident' >> $BASH_ENV
echo 'TRIDENT_ANSWER_DATA=$HOME/answer_test_data' >> $BASH_ENV
echo 'TRIDENT_CONFIG=$HOME/.trident/config.tri' >> $BASH_ENV
echo 'YT_GOLD=8dcc2fa135dfe7a62438507066527caf5cb379c1' >> $BASH_ENV
echo 'YT_HEAD=yt-4.0' >> $BASH_ENV
echo 'TRIDENT_GOLD=test-standard-sph-viz-v6' >> $BASH_ENV
echo 'TRIDENT_HEAD=tip' >> $BASH_ENV
install-dependencies:
description: "Install dependencies."
Expand All @@ -21,37 +23,40 @@ commands:
type: string
default: YT_GOLD
steps:
- run: |
# add git user info so we can commit
git config --global user.email "fake@nothing.nothing"
git config --global user.name "C.I. Circle"
# tag the tip so we can get back to it
git tag tip
sudo apt-get update
sudo apt-get install -y texlive-latex-extra dvipng
if [ ! -d $HOME/venv ]; then
python3 -m venv $HOME/venv
fi
source $BASH_ENV
source $HOME/venv/bin/activate
pip install --upgrade pip
pip install --upgrade wheel
pip install --upgrade setuptools
pip install Cython numpy
if [ << parameters.yttag >> != "None" ]; then
if [ ! -f $YT_DIR/README.md ]; then
git clone --branch=${YT_HEAD} https://github.com/yt-project/yt $YT_DIR
fi
pushd $YT_DIR
# return to yt tip before pulling
git checkout ${YT_HEAD}
git pull origin ${YT_HEAD}
# checkout changeset we're actually testing
git checkout ${<< parameters.yttag >>}
pip install -e .
popd
fi
pip install -e .[dev]
- run:
name: "Install dependencies."
no_output_timeout: 20m
command: |
# add git user info so we can commit
git config --global user.email "fake@nothing.nothing"
git config --global user.name "C.I. Circle"
# tag the tip so we can get back to it
git tag tip
sudo apt-get update
sudo apt-get install -y texlive-latex-extra dvipng
if [ ! -d $HOME/venv ]; then
python3 -m venv $HOME/venv
fi
source $BASH_ENV
source $HOME/venv/bin/activate
pip install --upgrade pip
pip install --upgrade wheel
pip install --upgrade setuptools
pip install Cython numpy
if [ << parameters.yttag >> != "None" ]; then
if [ ! -f $YT_DIR/README.md ]; then
git clone --branch=${YT_HEAD} https://github.com/yt-project/yt $YT_DIR
fi
pushd $YT_DIR
# return to yt tip before pulling
git checkout ${YT_HEAD}
git pull origin ${YT_HEAD}
# checkout changeset we're actually testing
git checkout ${<< parameters.yttag >>}
pip install -e .
popd
fi
pip install -e .[dev]
install-trident:
description: "Install trident."
Expand All @@ -60,43 +65,49 @@ commands:
type: string
default: TRIDENT_HEAD
steps:
- run: |
source $BASH_ENV
source $HOME/venv/bin/activate
git checkout ${<< parameters.tridenttag >>}
pip install -e .[dev]
- run:
name: "Install trident."
command: |
source $BASH_ENV
source $HOME/venv/bin/activate
git checkout ${<< parameters.tridenttag >>}
pip install -e .[dev]
configure-trident:
description: "Configure trident."
steps:
- run: |
source $BASH_ENV
# configure trident
mkdir -p $TRIDENT_ION_DATA
echo "[Trident]" > $TRIDENT_CONFIG
echo "ion_table_dir = $TRIDENT_ION_DATA" >> $TRIDENT_CONFIG
echo "ion_table_file = hm2012_lr.h5" >> $TRIDENT_CONFIG
echo "answer_test_data_dir = $TRIDENT_ANSWER_DATA" >> $TRIDENT_CONFIG
- run:
name: "Configure trident."
command: |
source $BASH_ENV
# configure trident
mkdir -p $TRIDENT_ION_DATA
echo "[Trident]" > $TRIDENT_CONFIG
echo "ion_table_dir = $TRIDENT_ION_DATA" >> $TRIDENT_CONFIG
echo "ion_table_file = hm2012_lr.h5" >> $TRIDENT_CONFIG
echo "answer_test_data_dir = $TRIDENT_ANSWER_DATA" >> $TRIDENT_CONFIG
download-test-data:
description: "Download test data."
steps:
- run: |
source $BASH_ENV
source $HOME/venv/bin/activate
# download ion balance data
if [ ! -f $TRIDENT_ION_DATA/hm2012_lr.h5 ]; then
wget http://trident-project.org/data/ion_table/hm2012_lr.h5.gz
gunzip hm2012_lr.h5.gz
mv hm2012_lr.h5 $TRIDENT_ION_DATA
fi
# download answer test data
if [ ! -f $TRIDENT_ANSWER_DATA/enzo_small/AMRCosmology.enzo ]; then
pushd tests
export RUN_DOWNLOAD_TEST=1
pytest test_download.py
popd
fi
- run:
name: "Download test data."
command: |
source $BASH_ENV
source $HOME/venv/bin/activate
# download ion balance data
if [ ! -f $TRIDENT_ION_DATA/hm2012_lr.h5 ]; then
wget http://trident-project.org/data/ion_table/hm2012_lr.h5.gz
gunzip hm2012_lr.h5.gz
mv hm2012_lr.h5 $TRIDENT_ION_DATA
fi
# download answer test data
if [ ! -f $TRIDENT_ANSWER_DATA/enzo_small/AMRCosmology.enzo ]; then
pushd tests
export RUN_DOWNLOAD_TEST=1
pytest test_download.py
popd
fi
run-tests:
description: "Build trident and run tests."
Expand All @@ -109,29 +120,33 @@ commands:
default: 0

steps:
- run: |
source $BASH_ENV
source $HOME/venv/bin/activate
export TRIDENT_GENERATE_TEST_RESULTS=<< parameters.generate >>
if [[ << parameters.generate >> == 0 || ! -f $TRIDENT_ANSWER_DATA/test_results/TRIDENT_VERSION ]]; then
pushd tests
pytest --cov=trident
fi
if [ << parameters.coverage >> == 1 ]; then
# code coverage report
export COVERALLS_REPO_TOKEN="yUoFnf5H5uC9MJ9kLqzKaoSxkPf5dHc7F"
coveralls
fi
- run:
name: "Build trident and run tests."
command: |
source $BASH_ENV
source $HOME/venv/bin/activate
export TRIDENT_GENERATE_TEST_RESULTS=<< parameters.generate >>
if [[ << parameters.generate >> == 0 || ! -f $TRIDENT_ANSWER_DATA/test_results/TRIDENT_VERSION ]]; then
pushd tests
pytest --cov=trident
fi
if [ << parameters.coverage >> == 1 ]; then
# code coverage report
export COVERALLS_REPO_TOKEN="yUoFnf5H5uC9MJ9kLqzKaoSxkPf5dHc7F"
coveralls
fi
build-docs:
description: "Test the docs build."
steps:
- run: |
source $BASH_ENV
source $HOME/venv/bin/activate
touch $HOME/.trident/hm2012_lr.h5
cd doc/source
python -m sphinx -M html "." "_build" -W
- run:
name: "Test the docs build."
command: |
source $BASH_ENV
source $HOME/venv/bin/activate
touch $HOME/.trident/hm2012_lr.h5
cd doc/source
python -m sphinx -M html "." "_build" -W
executors:
python:
Expand Down Expand Up @@ -166,15 +181,15 @@ jobs:

- restore_cache:
name: "Restore dependencies cache."
key: python-<< parameters.tag >>-dependencies-v5
key: python-<< parameters.tag >>-dependencies-v6

- install-dependencies:
yttag: << parameters.yttag >>
- configure-trident

- save_cache:
name: "Save dependencies cache."
key: python-<< parameters.tag >>-dependencies-v5
key: python-<< parameters.tag >>-dependencies-v6
paths:
- ~/.cache/pip
- ~/venv
Expand All @@ -198,14 +213,14 @@ jobs:

- restore_cache:
name: "Restore answer tests cache."
key: test-results-<< parameters.tag >>-<< parameters.yttag >>-v6
key: test-results-<< parameters.tag >>-<< parameters.yttag >>-v7

- run-tests:
generate: 1

- save_cache:
name: "Save answer tests cache."
key: test-results-<< parameters.tag >>-<< parameters.yttag >>-v6
key: test-results-<< parameters.tag >>-<< parameters.yttag >>-v7
paths:
- ~/answer_test_data/test_results

Expand Down Expand Up @@ -246,25 +261,25 @@ workflows:

- tests:
name: "Python 3.6 tests with yt gold"
tag: "3.6.9"
tag: "3.6.10"

- tests:
name: "Python 3.7 tests with yt gold"
tag: "3.7.6"
tag: "3.7.7"

- tests:
name: "Python 3.8 tests with yt gold"
tag: "3.8.1"
tag: "3.8.2"

- tests:
name: "Python 3.8 tests with yt tip"
tag: "3.8.1"
tag: "3.8.2"
yttag: "YT_HEAD"
coverage: 1

- docs-test:
name: "Test docs build"
tag: "3.8.1"
tag: "3.8.2"

daily:
triggers:
Expand All @@ -277,29 +292,10 @@ workflows:
jobs:
- tests:
name: "Python 3.8 tests with yt tip"
tag: "3.8.1"
tag: "3.8.2"
yttag: "YT_HEAD"
coverage: 0

- docs-test:
name: "Test docs build"
tag: "3.8.1"

weekly:
triggers:
- schedule:
cron: "0 0 * * 1"
filters:
branches:
only:
- legacy
jobs:
- tests:
name: "Python 3.8 tests with yt tip"
tag: "3.8.1"
yttag: "YT_HEAD"
coverage: 0

- docs-test:
name: "Test docs build"
tag: "3.8.1"
tag: "3.8.2"

0 comments on commit a5ed5bd

Please sign in to comment.