Newer
Older
image: python:3.9-slim
# 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:
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 install https://git.gfz-potsdam.de/globaldynamicexposure/libraries/rule-lib/-/archive/main/rule-lib-main.zip
script:
- echo "The project runs in '$CI_PROJECT_DIR'"
- echo "The project path is '$CI_PROJECT_PATH'"
- pytest tests
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'