From 2d9b8327fa6db3ea0edea6b2d8ed354e2c453ec3 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 11:57:16 -0400 Subject: [PATCH 01/23] try circleci config --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..d74f0fb33 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,37 @@ +# Python CircleCI 2.0 configuration file +# Check https://circleci.com/docs/2.0/language-python/ for more details +version: 2 +jobs: + build: + docker: + - image: continuumio/miniconda3 + + steps: + - checkout + + # - restore_cache: # Need cache for all tutorial data! + # keys: sample-data-v1 + + - run: + name: Conda setup + command: | + conda config --set always_yes yes --set changeps1 no + conda env update --file=environment.yml + + - run: + name: Build documentation + command: | + python setup.py build_docs -w 2> /dev/null + + - store_artifacts: + path: docs/_build/html + + - run: + name: "Built documentation is available at:" + command: | + DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/docs/_build/html/index.html"; echo $DOCS_URL + + # - save_cache: # specify what paths to cache + # key: sample-data-v1 + # paths: + # - ~/sunpy/data/sample_data From d51ece4707501f620596bd0b0bff7e54dfacc3be Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 13:53:40 -0400 Subject: [PATCH 02/23] pedantry --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d74f0fb33..a9a1b5423 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: command: | DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/docs/_build/html/index.html"; echo $DOCS_URL - # - save_cache: # specify what paths to cache + # - save_cache: # Specify what paths to cache # key: sample-data-v1 # paths: # - ~/sunpy/data/sample_data From 347de591c3bb23c9e93c1e45b93513681d4037f3 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 14:04:51 -0400 Subject: [PATCH 03/23] don't pipe --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a9a1b5423..b4c6ebf73 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,7 @@ jobs: - run: name: Build documentation command: | - python setup.py build_docs -w 2> /dev/null + python setup.py build_docs -w - store_artifacts: path: docs/_build/html From efe5581a6ff9b3c18c21467a9cc46299f2627f67 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 14:22:37 -0400 Subject: [PATCH 04/23] oops, duh, don't have a setup file --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b4c6ebf73..3fd204841 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,11 +17,12 @@ jobs: command: | conda config --set always_yes yes --set changeps1 no conda env update --file=environment.yml + pip install git+https://github.com/jupyter/nbconvert - run: name: Build documentation command: | - python setup.py build_docs -w + make html - store_artifacts: path: docs/_build/html From 849b70321110e8519cdb184fa6f63fee070172b5 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 14:42:34 -0400 Subject: [PATCH 05/23] install make --- .circleci/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3fd204841..35ea7fd66 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,13 @@ # Python CircleCI 2.0 configuration file # Check https://circleci.com/docs/2.0/language-python/ for more details version: 2 + +apt-run: &apt-install + name: Install apt packages + command: | + sudo apt update + sudo apt install build-essential + jobs: build: docker: @@ -8,6 +15,7 @@ jobs: steps: - checkout + - run: *apt-install # run the apt install defined above # - restore_cache: # Need cache for all tutorial data! # keys: sample-data-v1 From fc8c5d38869d8f14ea0b247d20046954b2c0d25c Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 14:50:29 -0400 Subject: [PATCH 06/23] apt-get --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35ea7fd66..7256445cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,8 +5,7 @@ version: 2 apt-run: &apt-install name: Install apt packages command: | - sudo apt update - sudo apt install build-essential + apt-get install build-essential jobs: build: From f2caf2fa1d788abf059df90d0a164b7cbd791ab9 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 15:06:37 -0400 Subject: [PATCH 07/23] update first --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7256445cc..de7cb1759 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,6 +5,7 @@ version: 2 apt-run: &apt-install name: Install apt packages command: | + apt-get update apt-get install build-essential jobs: From 549ddd8f19a37dc8f67e985a1a9021f547167f35 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 15:22:17 -0400 Subject: [PATCH 08/23] try following sunpy config instead --- .circleci/config.yml | 21 +++++++++++---------- pip-requirements.txt | 5 +++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de7cb1759..12f13b135 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,28 +5,29 @@ version: 2 apt-run: &apt-install name: Install apt packages command: | - apt-get update - apt-get install build-essential + sudo apt-get update + sudo apt-get install build-essential + +pip-run: &pip-install + name: Install Python dependencies + command: | + python3 -m venv venv + . venv/bin/activate + pip install -q -r pip-requirements.txt jobs: build: docker: - - image: continuumio/miniconda3 + - image: circleci/python:3.6 steps: - checkout - run: *apt-install # run the apt install defined above + - run: *pip-install # run the pip install defined above # - restore_cache: # Need cache for all tutorial data! # keys: sample-data-v1 - - run: - name: Conda setup - command: | - conda config --set always_yes yes --set changeps1 no - conda env update --file=environment.yml - pip install git+https://github.com/jupyter/nbconvert - - run: name: Build documentation command: | diff --git a/pip-requirements.txt b/pip-requirements.txt index 4f0059537..2a02585b6 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -5,3 +5,8 @@ matplotlib==2.0.2 numpy==1.13.1 jupyter==1.0 scipy=0.19 +notebook=5.0 +aplpy +spectral-cube +reproject +git+https://github.com/jupyter/nbconvert From 213d12381c4ca90a4bedb15bd294340b4a0c7c5d Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 15:23:42 -0400 Subject: [PATCH 09/23] == --- pip-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pip-requirements.txt b/pip-requirements.txt index 2a02585b6..d9dd00b30 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -4,8 +4,8 @@ astroquery==0.3.7 matplotlib==2.0.2 numpy==1.13.1 jupyter==1.0 -scipy=0.19 -notebook=5.0 +scipy==0.19 +notebook==5.0 aplpy spectral-cube reproject From 69cbc2c52d12f5101c43e3833e897246e96b6a44 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 15:27:15 -0400 Subject: [PATCH 10/23] install sphinx too --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12f13b135..90dd76720 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,7 @@ pip-run: &pip-install python3 -m venv venv . venv/bin/activate pip install -q -r pip-requirements.txt + pip install sphinx jobs: build: From 731956ecac391b68f598946f5831d51edbbe30da Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 15:30:23 -0400 Subject: [PATCH 11/23] Activate venv --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 90dd76720..8db3f50e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,6 +32,7 @@ jobs: - run: name: Build documentation command: | + . venv/bin/activate make html - store_artifacts: From 7ac565f46e36ff79ef7ee6a8224968b129363a93 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 15:37:29 -0400 Subject: [PATCH 12/23] try install astropy helpers via pip --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8db3f50e0..2da7bf80c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ pip-run: &pip-install python3 -m venv venv . venv/bin/activate pip install -q -r pip-requirements.txt - pip install sphinx + pip install astropy_helpers sphinx jobs: build: From ba979cf1b5b91881e33e4a5f2c40652eda7e2d0f Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Fri, 4 May 2018 16:45:12 -0400 Subject: [PATCH 13/23] install pandoc --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2da7bf80c..4b2be5ae1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ apt-run: &apt-install name: Install apt packages command: | sudo apt-get update - sudo apt-get install build-essential + sudo apt-get install build-essential pandoc pip-run: &pip-install name: Install Python dependencies From 9e8f424fe23e9cacc235cf95e2269680ccc68a1d Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 21:10:02 -0400 Subject: [PATCH 14/23] save artifacts and try giles --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b2be5ae1..1a78cb8b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ jobs: make html - store_artifacts: - path: docs/_build/html + path: build/html - run: name: "Built documentation is available at:" @@ -47,3 +47,7 @@ jobs: # key: sample-data-v1 # paths: # - ~/sunpy/data/sample_data + +notify: + webhooks: + - url: https://giles.cadair.com/circleci From db5b0b296210d24314eec5e7b31f44051e1182bd Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 21:37:43 -0400 Subject: [PATCH 15/23] try new run step --- .circleci/config.yml | 9 +++++++-- .circleci/rtd-push.sh | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .circleci/rtd-push.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a78cb8b4..200d53499 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,9 +39,14 @@ jobs: path: build/html - run: - name: "Built documentation is available at:" + name: Built documentation is available at: command: | - DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/docs/_build/html/index.html"; echo $DOCS_URL + DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/build/html/index.html"; echo $DOCS_URL + + - run: + name: Push to RTD branch + command: | + bash circleci/rtd-push.sh # - save_cache: # Specify what paths to cache # key: sample-data-v1 diff --git a/.circleci/rtd-push.sh b/.circleci/rtd-push.sh new file mode 100644 index 000000000..e63b47567 --- /dev/null +++ b/.circleci/rtd-push.sh @@ -0,0 +1,9 @@ +if [[ ! -z $CIRCLE_PULL_REQUEST ]] ; then + # git checkout --orphan rst + # git add -f tutorials/rst-tutorials/* + # git -c user.name='travis' -c user.email='travis' commit -m "now with RST" + # git push -q -f https://adrn:$GITHUB_API_KEY@github.com/astropy/astropy-tutorials rst; + echo "Not a pull request: pushing RST files to `rst` branch!" +else + echo "This is a pull request: not pushing RST files." +fi From 0ef0c1e91f33f7c8bb2de259a95af9bd1a81a76f Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 21:38:23 -0400 Subject: [PATCH 16/23] path.join --- scripts/convert.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/convert.py b/scripts/convert.py index fb25153ca..e71062e84 100644 --- a/scripts/convert.py +++ b/scripts/convert.py @@ -41,6 +41,10 @@ def __init__(self, nb_path, output_path=None, template_file=None, logger.info('Processing notebook {0} (in {1})'.format(fn, self.path_only)) + # the RST file + self._rst_path = path.join(self.output_path, + '{0}.rst'.format(self.nb_name)) + if kernel_name is None: self.kernel_name = ExecutePreprocessor.kernel_name.default_value else: @@ -107,6 +111,12 @@ def convert(self, remove_executed=False): raise IOError("Executed notebook file doesn't exist! Expected: {0}" .format(self._executed_nb_path)) + if path.exists(self._rst_path) and not self.overwrite: + logger.debug("RST version of notebook already exists at {0}. Use " + "overwrite=True or --overwrite (at cmd line) to re-run" + .format(self._rst_path)) + return self._rst_path + # Initialize the resources dict - see: # https://github.com/jupyter/nbconvert/blob/master/nbconvert/nbconvertapp.py#L327 resources = {} From 79bbcc07bebca4cec93dcdf952f8d23aa32b1b11 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 21:55:57 -0400 Subject: [PATCH 17/23] add ssh key for github --- .circleci/config.yml | 6 ++++++ .circleci/rtd-push.sh | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 200d53499..12d49b77c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,6 +16,11 @@ pip-run: &pip-install pip install -q -r pip-requirements.txt pip install astropy_helpers sphinx +add_ssh_keys: &add_ssh_keys + add_ssh_keys: + fingerprints: + - 32:53:df:4a:53:71:25:8b:73:42:71:c8:57:8a:3f:f7 + jobs: build: docker: @@ -25,6 +30,7 @@ jobs: - checkout - run: *apt-install # run the apt install defined above - run: *pip-install # run the pip install defined above + - run: *add_ssh_keys # add GitHub SSH keys # - restore_cache: # Need cache for all tutorial data! # keys: sample-data-v1 diff --git a/.circleci/rtd-push.sh b/.circleci/rtd-push.sh index e63b47567..35ef095b3 100644 --- a/.circleci/rtd-push.sh +++ b/.circleci/rtd-push.sh @@ -1,3 +1,15 @@ +#!/bin/bash -eux + +# if [ -z "${GIT_USER_NAME}" ]; then +# echo "Please set an env var GIT_USER_NAME" +# exit 1 +# fi +# +# if [ -z "${GIT_USER_EMAIL}" ]; then +# echo "Please set an env var GIT_USER_EMAIL" +# exit 1 +# fi + if [[ ! -z $CIRCLE_PULL_REQUEST ]] ; then # git checkout --orphan rst # git add -f tutorials/rst-tutorials/* From a151230c5b3474934b998d6778e33e0f376d3992 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 21:56:58 -0400 Subject: [PATCH 18/23] oops colon --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12d49b77c..e1ac50eec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,7 +45,7 @@ jobs: path: build/html - run: - name: Built documentation is available at: + name: Built documentation is available at command: | DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/build/html/index.html"; echo $DOCS_URL From 932d89071c096be44b5bd0500b47b5ce64e5c006 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 22:00:36 -0400 Subject: [PATCH 19/23] rearrange ssh key --- .circleci/config.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1ac50eec..a5b786d6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,21 +16,22 @@ pip-run: &pip-install pip install -q -r pip-requirements.txt pip install astropy_helpers sphinx -add_ssh_keys: &add_ssh_keys - add_ssh_keys: - fingerprints: - - 32:53:df:4a:53:71:25:8b:73:42:71:c8:57:8a:3f:f7 - jobs: + deploy-job: + steps: + + build: docker: - image: circleci/python:3.6 steps: - checkout + - add_ssh_keys: # add GitHub SSH keys + fingerprints: + - 32:53:df:4a:53:71:25:8b:73:42:71:c8:57:8a:3f:f7 - run: *apt-install # run the apt install defined above - run: *pip-install # run the pip install defined above - - run: *add_ssh_keys # add GitHub SSH keys # - restore_cache: # Need cache for all tutorial data! # keys: sample-data-v1 From 42267c4f909c51bbbd1bede6686983e76c50ac68 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 22:01:56 -0400 Subject: [PATCH 20/23] doh typo --- .circleci/config.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a5b786d6b..06f620210 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,11 +16,6 @@ pip-run: &pip-install pip install -q -r pip-requirements.txt pip install astropy_helpers sphinx -jobs: - deploy-job: - steps: - - build: docker: - image: circleci/python:3.6 From afef743c8225e8804c2ef8796d45c1bbfb324ba2 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 22:05:26 -0400 Subject: [PATCH 21/23] on a roll with those typos --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 06f620210..2ad7503e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,6 +16,8 @@ pip-run: &pip-install pip install -q -r pip-requirements.txt pip install astropy_helpers sphinx +jobs: + build: docker: - image: circleci/python:3.6 From ae23b90ab3a82ae391cd762ddd4a5f3d8dc654c9 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 22:18:03 -0400 Subject: [PATCH 22/23] dot in front of circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2ad7503e3..b118c7d32 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,7 +50,7 @@ jobs: - run: name: Push to RTD branch command: | - bash circleci/rtd-push.sh + bash .circleci/rtd-push.sh # - save_cache: # Specify what paths to cache # key: sample-data-v1 From 6d34d593b6f54c3da1fb7e07a8a157f683ca44ba Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 8 May 2018 23:01:18 -0400 Subject: [PATCH 23/23] update rtd push script --- .circleci/rtd-push.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.circleci/rtd-push.sh b/.circleci/rtd-push.sh index 35ef095b3..087360171 100644 --- a/.circleci/rtd-push.sh +++ b/.circleci/rtd-push.sh @@ -10,12 +10,14 @@ # exit 1 # fi -if [[ ! -z $CIRCLE_PULL_REQUEST ]] ; then - # git checkout --orphan rst - # git add -f tutorials/rst-tutorials/* - # git -c user.name='travis' -c user.email='travis' commit -m "now with RST" - # git push -q -f https://adrn:$GITHUB_API_KEY@github.com/astropy/astropy-tutorials rst; - echo "Not a pull request: pushing RST files to `rst` branch!" +if [[ -z $CIRCLE_PULL_REQUEST ]] ; then + git checkout --orphan rst + git add -f tutorials/rst-tutorials/* + git -c user.name='circle' -c user.email='circle' commit -m "now with RST" + git remote add origin git@github.com:astropy/astropy-tutorials.git + git push -q -f origin rst + echo "Not a pull request: pushing RST files to rst branch." else + echo $CIRCLE_PULL_REQUEST echo "This is a pull request: not pushing RST files." fi