diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8992c3c453ddcae3daa1d83a92366e2c3862e5af..cd81f7d043b4196fa8017d88adde0c02108601a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -576,4 +576,37 @@ sanity: policy: pull key: "${CI_COMMIT_REF_SLUG}-gcc" - +########################################################## +# template for all Python jobs +.python: + stage: python + tags: + - corsika + before_script: + - apt-get update && apt-get install -y python3-pip + script: + - cd ${CI_PROJECT_DIR}/Python # change into the Python directory + - pip3 install --user -e '.[test]' # install the package + test deps + - python3 --version + - python3 -m mypy corsika + - python3 -m isort --atomic --check-only corsika tests + - python3 -m black -t py37 corsika tests + - python3 -m flake8 corsika tests + - python3 -m pytest --cov=corsika tests + - cd ${CI_PROJECT_DIR} # reset the directory + coverage: '/^TOTAL\s*\d+\s*\d+\s*(.*\%)/' + +# the default Python version Ubuntu 18.04 is Python3.8 +python-3.8: + extends: .python + image: corsika/devel:u-18.04 + dependencies: + - build-u-18_04 + cache: + key: "${CI_COMMIT_REF_SLUG}-gcc" + artifacts: + when: always + expire_in: 1 year + paths: + - ${CI_PROJECT_DIR}/Python/python-test.log + allow_failure: true