Compare commits

...

2 Commits

Author SHA1 Message Date
bdf76b01d6 example_like pipeline
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2025-09-11 11:50:41 +09:00
132af4af18 EXAMPLE-LIKE PIPELINE 2025-09-11 11:50:16 +09:00
3 changed files with 68 additions and 37 deletions

View File

@@ -1,33 +1,20 @@
kind: pipeline
type: docker
name: quiz-bot-ci-cd
trigger:
branch:
- main
- develop
- "feature/*"
event:
- push
- pull_request
services:
- name: docker
image: docker:27-dind
privileged: true
command:
- --host=tcp://0.0.0.0:2375
environment:
DOCKER_TLS_CERTDIR: ""
name: quiz-bot-ci
steps:
- name: install-deps
image: python:3.12-slim
commands:
- echo "🔧 Installing dependencies..."
- pip install --upgrade pip
- pip install -r requirements.txt
- echo "✅ Dependencies installed"
- name: prepare
image: alpine/git:latest
environment:
DOCKER_HOST: tcp://docker:2375
commands:
- echo "🚀 Pipeline started for branch ${DRONE_BRANCH}"
# BusyBox ash может не поддерживать ${VAR:0:8}; безопаснее так:
- echo "📝 Commit: $(echo ${DRONE_COMMIT_SHA} | cut -c1-8)"
- echo "👤 Author: ${DRONE_COMMIT_AUTHOR}"
- echo "📅 Build: ${DRONE_BUILD_NUMBER}"
@@ -37,7 +24,7 @@ steps:
image: python:3.12-slim
commands:
- echo "🔍 Installing linting tools..."
- pip install --no-cache-dir flake8 black isort mypy
- pip install flake8 black isort
- echo "🎨 Running Black formatter check..."
- black --check --diff src/ config/ tools/ tests/ || true
- echo "📦 Running isort import sorting check..."
@@ -49,29 +36,71 @@ steps:
- name: test
image: python:3.12-slim
commands:
- pip install --no-cache-dir -r requirements.txt
- echo "🧪 Installing test dependencies..."
- pip install -r requirements.txt
- pip install pytest
- echo "🚀 Running tests..."
- python -m pytest tests/ -v --tb=short || true
- python tests/test_bot.py || true
- echo "✅ Tests completed"
- name: security
image: python:3.12-slim
commands:
- pip install --no-cache-dir safety bandit
- echo "🔒 Installing security tools..."
- pip install safety bandit
- echo "🛡️ Running safety check..."
- safety check --json || true
- echo "🔍 Running bandit security check..."
- bandit -r src/ -f json || true
- echo "✅ Security checks completed"
- name: typecheck
image: python:3.12-slim
commands:
- pip install --no-cache-dir mypy types-requests
- mypy src/ --ignore-missing-imports || true
- name: docker_build
image: docker:27-cli
environment:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
- name: docker-build
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- echo "🐳 Docker version info:"
- docker version
- echo "🔨 Building Docker image..."
- docker build -t ${DRONE_REPO_NAME}:latest .
- docker tag ${DRONE_REPO_NAME}:latest quiz-bot:${DRONE_COMMIT_SHA}
- echo "📦 Docker build completed"
- docker images | grep -E "${DRONE_REPO_NAME}|quiz-bot" || true
- name: docker-test
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- echo "🧪 Testing Docker image..."
- docker run --rm ${DRONE_REPO_NAME}:latest python -c "import src.bot; print('✅ Bot import successful')" || true
- docker run --rm ${DRONE_REPO_NAME}:latest python -c "import config.config; print('✅ Config import successful')" || true
- echo "✅ Docker tests completed"
- name: quality
image: python:3.12-slim
commands:
- echo "📊 Installing quality tools..."
- pip install flake8 radon
- echo "📈 Calculating code metrics..."
- radon cc src/ -s || true
- radon mi src/ -s || true
- echo "✅ Quality check completed"
- name: notify
image: alpine:latest
commands:
- echo "📋 Pipeline Summary:"
- echo "🌿 Branch: ${DRONE_BRANCH}"
- echo "📝 Commit: $(echo ${DRONE_COMMIT_SHA} | cut -c1-8)"
- echo "🏗️ Build: #${DRONE_BUILD_NUMBER}"
- echo "👤 Author: ${DRONE_COMMIT_AUTHOR}"
- echo "🎉 Quiz Bot CI Pipeline completed!"
volumes:
- name: dockersock
host:
path: /var/run/docker.sock

View File

@@ -46,7 +46,9 @@ quiz_test/
- 📖 [Быстрый старт](docs/QUICKSTART.md) - Начало работы с проектом
- 🐳 [Docker инструкции](docs/DOCKER_README.md) - Контейнеризация и развертывание
- 🏗️ [DevOps инфраструктура](docs/DEVOPS_SUMMARY.md) - CI/CD и автоматизация
- 🔧 [Инфраструктура](docs/INFRASTRUCTURE.md) - Архитектура и компоненты
- <EFBFBD> [Drone 1.x+ конфигурация](docs/DRONE_1.x_CONFIG.md) - Современный CI/CD pipeline
- 🔄 [Миграция Drone 0.8](docs/DRONE_0.8_MIGRATION.md) - Переход с устаревшей версии
- <20>🔧 [Инфраструктура](docs/INFRASTRUCTURE.md) - Архитектура и компоненты
- 🔧 [Отчет по исправлениям](docs/FIX_REPORT.md) - История изменений
## 🚀 Быстрый старт

Binary file not shown.