pipeline fix #3
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
54
.drone.yml
54
.drone.yml
@@ -1,14 +1,3 @@
|
|||||||
# ---------- DRONE 0.8 CONFIG ----------
|
|
||||||
|
|
||||||
# Ограничим сборки по веткам и событиям
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
docker:
|
docker:
|
||||||
image: docker:27-dind
|
image: docker:27-dind
|
||||||
@@ -33,41 +22,29 @@ pipeline:
|
|||||||
image: python:3.12-slim
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
- pip install --no-cache-dir flake8 black isort mypy
|
- pip install --no-cache-dir flake8 black isort mypy
|
||||||
- echo "Running Black formatter check..."
|
|
||||||
- black --check --diff src/ config/ tools/ tests/ || true
|
- black --check --diff src/ config/ tools/ tests/ || true
|
||||||
- echo "Running isort import sorting check..."
|
|
||||||
- isort --check-only --diff src/ config/ tools/ tests/ || true
|
- 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
|
- flake8 src/ config/ tools/ tests/ --max-line-length=88 --extend-ignore=E203,W503 || true
|
||||||
- echo "Linting completed"
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: python:3.12-slim
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
- pip install --no-cache-dir -r requirements.txt
|
- pip install --no-cache-dir -r requirements.txt
|
||||||
- echo "Running pytest tests..."
|
|
||||||
- python -m pytest tests/ -v --tb=short || true
|
- python -m pytest tests/ -v --tb=short || true
|
||||||
- echo "Running integration tests..."
|
|
||||||
- python tests/test_bot.py || true
|
- python tests/test_bot.py || true
|
||||||
- echo "Testing completed"
|
|
||||||
|
|
||||||
security:
|
security:
|
||||||
image: python:3.12-slim
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
- pip install --no-cache-dir safety bandit
|
- pip install --no-cache-dir safety bandit
|
||||||
- echo "Running safety check..."
|
|
||||||
- safety check --json || true
|
- safety check --json || true
|
||||||
- echo "Running bandit security check..."
|
|
||||||
- bandit -r src/ -f json || true
|
- bandit -r src/ -f json || true
|
||||||
- echo "Security checks completed"
|
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
image: python:3.12-slim
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
- pip install --no-cache-dir mypy types-requests
|
- pip install --no-cache-dir mypy types-requests
|
||||||
- echo "Running mypy type checking..."
|
|
||||||
- mypy src/ --ignore-missing-imports || true
|
- mypy src/ --ignore-missing-imports || true
|
||||||
- echo "Type checking completed"
|
|
||||||
|
|
||||||
docker_build:
|
docker_build:
|
||||||
image: docker:27
|
image: docker:27
|
||||||
@@ -75,14 +52,12 @@ pipeline:
|
|||||||
DOCKER_HOST: tcp://docker:2375
|
DOCKER_HOST: tcp://docker:2375
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
commands:
|
commands:
|
||||||
- echo "Building Docker image..."
|
|
||||||
- docker version
|
- docker version
|
||||||
- docker build -t quiz-bot:${DRONE_COMMIT_SHA} .
|
- docker build -t quiz-bot:${DRONE_COMMIT_SHA} .
|
||||||
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:latest
|
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:latest
|
||||||
- echo "Docker build completed"
|
|
||||||
when:
|
when:
|
||||||
branch:
|
branch: [ main, develop ]
|
||||||
include: [ main, develop ]
|
event: [ push, pull_request ]
|
||||||
|
|
||||||
docker_test:
|
docker_test:
|
||||||
image: docker:27
|
image: docker:27
|
||||||
@@ -90,23 +65,17 @@ pipeline:
|
|||||||
DOCKER_HOST: tcp://docker:2375
|
DOCKER_HOST: tcp://docker:2375
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
commands:
|
commands:
|
||||||
- echo "Testing Docker image..."
|
|
||||||
- docker run --rm quiz-bot:${DRONE_COMMIT_SHA} python -c "import src.bot; print('Import successful')"
|
- docker run --rm quiz-bot:${DRONE_COMMIT_SHA} python -c "import src.bot; print('Import successful')"
|
||||||
- echo "Docker test completed"
|
|
||||||
when:
|
when:
|
||||||
branch:
|
branch: [ main, develop ]
|
||||||
include: [ main, develop ]
|
event: [ push, pull_request ]
|
||||||
depends_on:
|
|
||||||
- docker_build
|
|
||||||
|
|
||||||
quality:
|
quality:
|
||||||
image: python:3.12-slim
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
- pip install --no-cache-dir flake8 radon
|
- pip install --no-cache-dir flake8 radon
|
||||||
- echo "Calculating code metrics..."
|
|
||||||
- radon cc src/ -s || true
|
- radon cc src/ -s || true
|
||||||
- radon mi src/ -s || true
|
- radon mi src/ -s || true
|
||||||
- echo "Quality check completed"
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
image: docker:27
|
image: docker:27
|
||||||
@@ -114,25 +83,17 @@ pipeline:
|
|||||||
DOCKER_HOST: tcp://docker:2375
|
DOCKER_HOST: tcp://docker:2375
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
commands:
|
commands:
|
||||||
- echo "Deployment preparation..."
|
|
||||||
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:production
|
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:production
|
||||||
- echo "Tagged image for production"
|
|
||||||
- echo "Deployment completed (simulation)"
|
- echo "Deployment completed (simulation)"
|
||||||
when:
|
when:
|
||||||
branch:
|
branch: [ main ]
|
||||||
include: [ main ]
|
event: [ push ]
|
||||||
event:
|
|
||||||
include: [ push ]
|
|
||||||
depends_on:
|
|
||||||
- docker_test
|
|
||||||
- quality
|
|
||||||
|
|
||||||
notify_success:
|
notify_success:
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
commands:
|
commands:
|
||||||
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
||||||
- echo "Build status: SUCCESS"
|
- echo "Build status: SUCCESS"
|
||||||
- echo "All checks finished."
|
|
||||||
when:
|
when:
|
||||||
status: success
|
status: success
|
||||||
|
|
||||||
@@ -141,6 +102,5 @@ pipeline:
|
|||||||
commands:
|
commands:
|
||||||
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
||||||
- echo "Build status: FAILURE"
|
- echo "Build status: FAILURE"
|
||||||
- echo "Check previous steps for errors."
|
|
||||||
when:
|
when:
|
||||||
status: failure
|
status: failure
|
||||||
Reference in New Issue
Block a user