Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.81 KiB
---
stages:
  - tox
  - documentation
  - sonarqube
  - trigger_jenkins_build
  - publish-docs-prod-1
  - publish-docs-prod-2

####################################  tox   -   Testing and linting
run-tox-pipeline:
  stage: tox
  tags:
    - docker-executor
  image: python:3.12
  except:
    - /^release\/.*/
  services:
    - postgres:14
  # Change pip's cache directory to be inside the project directory since we can
  # only cache local items.
  variables:
    POSTGRES_DB: gso-test-db
    POSTGRES_USER: nwa
    POSTGRES_PASSWORD: nwa
    DATABASE_HOST: "postgres"
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  cache:
    key: tox-virtualenv
    paths:
      - .cache/pip
      - venv/
  before_script:
    - pip install virtualenv
    - virtualenv venv
    - . venv/bin/activate
    - pip install tox
  script:
    - tox
  artifacts:
    paths:
      - htmlcov

##### MkDocs  - Generate documentation
build-documentation:
  stage: documentation
  tags:
    - docker-executor
  image: python:3.12
  before_script:
    - cd $CI_PROJECT_DIR/docs
  script:
    - /bin/sh ./build-docs.sh
  artifacts:
    paths:
      - docs/public

##### 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