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: "" steps: - 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}" - git --version - name: lint image: python:3.12-slim commands: - echo "🔍 Installing linting tools..." - pip install --no-cache-dir flake8 black isort mypy - echo "🎨 Running Black formatter check..." - black --check --diff src/ config/ tools/ tests/ || true - echo "📦 Running isort import sorting check..." - isort --check-only --diff src/ config/ tools/ tests/ || true - echo "🔧 Running flake8 linting..." - flake8 src/ config/ tools/ tests/ --max-line-length=88 --extend-ignore=E203,W503 || true - echo "✅ Linting completed" - name: test image: python:3.12-slim commands: - pip install --no-cache-dir -r requirements.txt - python -m pytest tests/ -v --tb=short || true - python tests/test_bot.py || true - name: security image: python:3.12-slim commands: - pip install --no-cache-dir safety bandit - safety check --json || true - bandit -r src/ -f json || true - 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: "" commands: - echo "🐳 Docker version info:" - docker version - echo "🔨 Building Docker image..."