D:\VC25\Otus\Py\projects\ci-pipeline-demo
.gitlab-ci.yml
image: python:latest
variables:
PYTHON_VERSION: "3.10" # Указываем версию Python
cache:
paths:
- venv/ # Будем кешировать виртуальное окружение
stages:
- setup
- lint
- test
before_script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
setup_dependencies:
stage: setup
script:
- pip install flake8 # Необходимо добавить установку flake8
- pip freeze > installed_packages.txt # Проверим, что все зависимости установлены
artifacts:
paths:
- venv/
lint:
stage: lint
script:
- flake8 src/**/*.py
- mypy src/**/*.py
test:
stage: test
script:
- pytest tests/
---------------------------------------------------------------------------------------------
D:\VC25\Otus\Py\projects
.gitlab-ci_02.yml
.gitlab-ci_02.yml
---------------------------------------------------------------------------------------------
image: python:latest
variables:
PYTHON_VERSION: "3.10" # Указываем версию Python
cache:
paths:
- venv/ # Будем кешировать виртуальное окружение
stages:
- setup
- lint
- test
- publish # Добавляем новый этап publish
before_script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
setup_dependencies:
stage: setup
script:
- pip freeze > installed_packages.txt # Проверим, что все зависимости установлены
artifacts:
paths:
- venv/
lint:
stage: lint
script:
- flake8 src/**/*.py
- mypy src/**/*.py
test:
stage: test
script:
- pytest tests/
pages:
stage: publish # Теперь используем этап publish
script:
- mkdir public
- cp index.html public/index.html # Пример страницы
artifacts:
paths:
- public
only:
- main
Комментариев нет:
Отправить комментарий