---
##### Sphinx  - Generate documentation
build-documentation:
  stage: documentation
  tags:
    - docker-executor
  image: sphinxdoc/sphinx:latest

  before_script:
    - pip install sphinx_rtd_theme sphinxcontrib-jquery
    - cd $CI_PROJECT_DIR/docs/source
  script:
    - make html

  artifacts:
    paths:
      - $CI_PROJECT_DIR/docs/build/html

##### Vale    - Documentation linter
lint-documentation:
  stage: documentation
  image:
    name: jdkato/vale:v2.30.0
    entrypoint: [""]

  tags:
    - docker-executor
  needs:
    - job: build-documentation # Only run when documentation has been built
      artifacts: true

  before_script:
    - cd $CI_PROJECT_DIR/docs/vale
    - vale sync

  script:
    - vale --glob='!*/migrations/*' $CI_PROJECT_DIR/docs/source $CI_PROJECT_DIR/gso
