version: 2

jobs:
  build:
    docker:
      - image: circleci/python:3.10.0a7
    working_directory: ~/repo
    steps:
      - checkout
      - run:
          name: install dependencies
          command: |
            wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
            chmod +x miniconda.sh && ./miniconda.sh -b -p ~/miniconda
            export PATH="~/miniconda/bin:$PATH"
            conda update --yes --quiet conda
            conda create -n testenv --yes --quiet python=3
            source activate testenv
            conda install --yes pip numpy scipy scikit-learn matplotlib sphinx sphinx_rtd_theme numpydoc pillow
            pip install sphinx-gallery
            pip install .
            cd doc
            make html
      - store_artifacts:
          path: doc/_build/html/
          destination: doc
      - store_artifacts:
          path: ~/log.txt
      - run: ls -ltrh doc/_build/html
    filters:
      branches:
        ignore: gh-pages

workflows:
  version: 2
  workflow:
    jobs:
      - build
