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

  before_script:
    - pip install sphinx sphinx_rtd_theme myst-parser
  script:
    - sphinx-apidoc gso gso/app.py -o docs/source
    - sphinx-build -b html docs/source docs/build

  artifacts:
    paths:
      - docs/build/html

##### Vale    - Documentation linter
lint-documentation:
  stage: documentation
  image:
    name: jdkato/vale:latest
    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 $CI_PROJECT_DIR/docs/build/html/_sources
