version: 2
jobs:
  build:
    docker:
      - image: continuumio/miniconda3:4.12.2
    steps:
      - checkout
      - restore_cache:
          key: deps-{{ .Branch }}-{{ checksum "setup.py" }}-{{ checksum "build_tools/circle/install.sh" }}
      - run:
          name: Install dependencies
          command: |
            bash build_tools/circle/install.sh
          no_output_timeout: 1024s
      - save_cache:
          key: deps-{{ .Branch }}-{{ checksum "setup.py" }}-{{ checksum "build_tools/circle/install.sh" }}
          paths:
            - /opt/conda/pkgs
            - ~/.cache/pip
      - run:
          name: Run build
          command: |
            bash build_tools/circle/execute.sh
            if grep -q "Traceback (most recent call last):" nb_to_md.txt; then false; else true; fi
          no_output_timeout: 3600s
      - store_artifacts:
          path: ~/doc
          destination: doc
      - persist_to_workspace:
          root: ~/doc
          paths: .

  deploy:
    docker:
      - image: circleci/python:3.6.7
    steps:
      - checkout
      - attach_workspace:
          at: ~/doc
      - deploy:
          command: bash build_tools/circle/deploy.sh

workflows:
  version: 2
  build-doc-and-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

version: 2
jobs:
  build:
    docker:
      - image: continuumio/miniconda3:4.7.12.1
    steps:
      - checkout
      - restore_cache:
          key: deps-{{ .Branch }}-{{ checksum "setup.py" }}-{{ checksum "build_tools/circle/install.sh" }}
      - run:
          name: Install dependencies
          command: |
            bash build_tools/circle/install.sh
          no_output_timeout: 1024s
      - save_cache:
          key: deps-{{ .Branch }}-{{ checksum "setup.py" }}-{{ checksum "build_tools/circle/install.sh" }}
          paths:
            - /opt/conda/pkgs
            - ~/.cache/pip
      - run:
          name: Run build
          command: |
            bash build_tools/circle/execute.sh
            if grep -q "Traceback (most recent call last):" nb_to_md.txt; then false; else true; fi
          no_output_timeout: 3600s
      - store_artifacts:
          path: ~/doc
          destination: doc
      - persist_to_workspace:
          root: ~/doc
          paths: .

  deploy:
    docker:
      - image: circleci/python:3.6.7
    steps:
      - checkout
      - attach_workspace:
          at: ~/doc
      - deploy:
          command: bash build_tools/circle/deploy.sh

workflows:
  version: 2
  build-doc-and-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

Fix version number for circleCI
Fix version number for circleCI

