From f0b117f5ff143f1fed808a0c799f500a55996568 Mon Sep 17 00:00:00 2001 From: Remy Prechelt <prechelt@hawaii.edu> Date: Tue, 30 Mar 2021 11:50:12 -1000 Subject: [PATCH] Add initial Python CI configuration. --- .gitlab-ci.yml | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8992c3c45..cd81f7d04 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 -- GitLab