# This is a special configuration file to run tests on Circle-CI via
# GitHub notifications when changes are committed.
#
# This file is not intended for end users of Biopython.
#
# This uses a CircleCI provided Python image, see
# https://circleci.com/developer/images/image/cimg/python

version: 2.1
orbs:
  codecov: codecov/codecov@5.0.3
jobs:
  build:
    docker:
      - image: cimg/python:3.9
    steps:
      - checkout
      - run:
          name: Dependencies
          command: |
            python --version
            pip install -r .circleci/requirements-sphinx.txt
            pip install coverage numpy scipy mmtf-python mysqlclient mysql-connector-python rdflib networkx matplotlib
            echo "Python dependencies installed"
      - run:
          name: Installation
          command: |
            python setup.py sdist --formats=gztar
            echo "Built tar-ball, will now use that to test manifest..."
            tar -zxvf dist/biopython-*.tar.gz
            cd biopython-*/
            python setup.py bdist_wheel
            echo "Built wheel and installing it..."
            python -m pip install dist/biopython-*.whl
            echo "Biopython should now be installed"
      - run:
          name: Sphinx
          command: |
            make -C Doc/ html
      - run:
          name: Deploy Sphinx documentation
          command: |
            bash .github/deploy_docs.sh
      - run:
          name: Test
          command: |
            # Use the unzipped tar-ball where built wheel
            cd biopython-*/Tests/
            coverage run --source Bio,BioSQL --source Bio,BioSQL run_tests.py --offline
            echo "Tests run"
            coverage xml
      - codecov/upload:
          upload_name: CircleCI
          disable_search: true
          files: biopython-*/Tests/coverage.xml
