From 892b6e8236bc7d005402fd6a2fc709d553e0f645 Mon Sep 17 00:00:00 2001 From: "francisco.schulz" Date: Tue, 20 Jun 2023 17:13:08 +0200 Subject: [PATCH] use template CI --- .gitlab-ci.yml | 63 ++++---------------------------------------------- 1 file changed, 4 insertions(+), 59 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e499f87..36e8d47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,59 +1,4 @@ -default: - image: python:3.8 - -before_script: - - echo "Run started by ${GITLAB_USER_NAME}" - - echo "Pipeline on branch ${CI_COMMIT_REF_SLUG}" - - echo "$(pip cache dir)" - # install poetry - - pip install poetry - # poetry config - - poetry config installer.max-workers 10 - - poetry config virtualenvs.in-project true - - poetry config repositories.gitlab https://gitlab.knecon.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi - # install package & dependencies - - poetry install --with=dev - # activate virtual environment - - source .venv/bin/activate - -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - -cache: - key: "${CI_JOB_NAME}" - paths: - - .venv/ - - ${PIP_CACHE_DIR}/.cache/pip - -stages: - - test - - build - -# run-tests: -# stage: test -# script: -# - echo "Running pytest against the package" -# - pytest ./tests - -build-pkg-dev: - stage: build - script: - - export PKG_VERSION="$(poetry version -s)-dev" - - echo "Building DEV package with version ${PKG_VERSION}" - - poetry version ${PKG_VERSION} - - poetry build - - echo "Publishing ..." - - poetry publish --repository gitlab -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} - when: manual - -build-pkg-prod: - stage: build - script: - - export PKG_VERSION="$(poetry version -s)" - - echo "Building PROD package with version ${PKG_VERSION}" - - poetry version ${PKG_VERSION} - - poetry build - - echo "Publishing ..." - - poetry publish --repository gitlab -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} - rules: - - if: $CI_COMMIT_TAG +include: + - project: "Gitlab/gitlab" + ref: 0.2.3 + file: "/ci-templates/research/python_pkg_venv_test_build_release_gitlab-ci.yml"