image: python

stages:
  - build
  - deploy

check:
  stage: build
  before_script:
    - pip3 install black numpy pandas 'pylint<3' 'isort[colors]<6'
  script:
    - pip3 install --editable .[test]
    - black --check --diff --color .
    - isort --check --diff --color .
    - pylint src/finam
    - python -m pytest --cov finam --cov-report term-missing --cov-report xml:cov.xml -v tests/
  artifacts:
    reports:
      cobertura: cov.xml

documentation:
  stage: build
  before_script:
    - pip3 install sphinx numpy
  script:
    - pip3 install --editable .
    - sphinx-apidoc --separate -o docs src/finam
    - sphinx-build -W -b html docs docs/build
    - mv docs/build public/
  artifacts:
    paths:
      - public

pages:
  stage: deploy
  script: "true"
  artifacts:
    paths:
      - public
  only:
    - main