Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.13 KiB
Newer Older
image: python:3.11.10

# Make pip cache the installed dependencies
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  LINE_LENGTH: 96
  SOURCES: building
cache:
  paths:
    - .cache/pip
    - venv/

stages:
  - release

linters:
  before_script:
    - python3 -V
    - pip3 install virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - pip3 install black pylint flake8
  script:
    - flake8 --max-line-length=$LINE_LENGTH $SOURCES
    - black --check --line-length $LINE_LENGTH $SOURCES

tests:
  stage: tests
  before_script:
    - python3 -V
    - pip3 install virtualenv
    - virtualenv venv
    - source venv/bin/activate
    - pip3 install pytest
    - pip3 config set global.extra-index-url https://git.gfz-potsdam.de/api/v4/projects/2940/packages/pypi/simple
    - pip3 install rulelib>=0.1.1
release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  only:
    - tags
  script:
    - echo "running release_job for $CI_COMMIT_TAG"
  release:
    tag_name: '$CI_COMMIT_TAG'
    description: '$CI_COMMIT_TAG_MESSAGE'
    ref: '$CI_COMMIT_SHA'