From 39c2af70e7206c2bbbf5b6fe21a3af671e16327f Mon Sep 17 00:00:00 2001 From: Dorian Turba <dt.pro.ymaa5@8shield.net> Date: Mon, 8 May 2023 13:01:37 +0200 Subject: [PATCH] gitlab ci update --- .gitlab-ci.yml | 68 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b366e59..68f09bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,9 +18,21 @@ variables: - source venv/bin/activate - pip install .[QUALITY] -.tox_script: &tox_script - - pip install tox - - tox -e ${CI_JOB_NAME} +.requirements_script: &requirements_script + - python --version # Debug + - python -m venv venv --upgrade-deps || python -m venv venv + - source venv/bin/activate + - git config --global user.email "${GITLAB_USER_EMAIL}" + - git config --global user.name "${GITLAB_USER_NAME}" + - git remote set-url origin "https://:${PROJECT_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@}" + - pip install . + - pip freeze > ${CI_JOB_NAME}.txt --exclude ${PACKAGE_NAME} + - git add requirements.txt + - git commit -m "Update ${CI_JOB_NAME}.txt" || true + - git fetch origin + - git rebase origin/${CI_COMMIT_BRANCH} + - git push https://:${PROJECT_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@} HEAD:"${CI_COMMIT_BRANCH}" -o ci.skip + flake8: image: python:latest @@ -46,29 +58,47 @@ mypy: script: - mypy -generate_requirements: +requirements_py37: image: python:3.7 - stage: test + stage: requirements script: - - python --version # Debug - - python -m venv venv --upgrade-deps || python -m venv venv - - source venv/bin/activate - - git config --global user.email "${GITLAB_USER_EMAIL}" - - git config --global user.name "${GITLAB_USER_NAME}" - - git remote set-url origin "https://:${PROJECT_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@}" - - pip install . - - pip freeze > requirements.txt --exclude ${PACKAGE_NAME} - - git add requirements.txt - - git commit -m "Update requirements.txt" || true - - git fetch origin - - git rebase origin/${CI_COMMIT_BRANCH} - - git push https://:${PROJECT_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@} HEAD:"${CI_COMMIT_BRANCH}" -o ci.skip + - *requirements_script + +requirements_py38: + image: python:3.8 + stage: requirements + script: + - *requirements_script + +requirements_py39: + image: python:3.9 + stage: requirements + script: + - *requirements_script + +requirements_py310: + image: python:3.10 + stage: requirements + script: + - *requirements_script + +requirements_py311: + image: python:3.11 + stage: requirements + script: + - *requirements_script + +requirements_py312: + image: python:3.12-rc + stage: requirements + script: + - *requirements_script py37: image: python:3.7 stage: test before_script: - - *install_and_generate_requirements + - *install_test script: - pytest -- GitLab