This commit is contained in:
75
.drone.yml
75
.drone.yml
@@ -1,84 +1,43 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: quiz-bot-ci
|
name: multibot-ci
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
- develop
|
- develop
|
||||||
|
- "feature/*"
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: install-deps
|
- name: install-deps
|
||||||
image: python:3.12-slim
|
image: python:3.11-slim
|
||||||
commands:
|
commands:
|
||||||
- echo "Installing dependencies..."
|
|
||||||
- pip install --upgrade pip
|
- pip install --upgrade pip
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- echo "Dependencies installed"
|
|
||||||
|
|
||||||
- name: lint
|
- name: lint
|
||||||
image: python:3.12-slim
|
image: python:3.11-slim
|
||||||
commands:
|
commands:
|
||||||
- echo "Installing linting tools..."
|
- pip install flake8
|
||||||
- pip install flake8 black isort
|
- flake8 .
|
||||||
- echo "Running Black formatter check (relaxed)..."
|
|
||||||
- black --check --diff src/ config/ tools/ tests/ || true
|
|
||||||
- echo "Running isort import sorting check (relaxed)..."
|
|
||||||
- isort --check-only --diff src/ config/ tools/ tests/ || true
|
|
||||||
- echo "Running flake8 linting (using .flake8 config)..."
|
|
||||||
- flake8 src/ config/ tools/ tests/ || true
|
|
||||||
- echo "Linting completed (warnings only)"
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
image: python:3.12-slim
|
|
||||||
commands:
|
|
||||||
- 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: docker-build
|
- name: docker-build
|
||||||
image: docker:dind
|
image: plugins/docker:27
|
||||||
volumes:
|
settings:
|
||||||
- name: dockersock
|
repo: ${DRONE_REPO} # или ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME}
|
||||||
path: /var/run/docker.sock
|
tags:
|
||||||
commands:
|
- latest
|
||||||
- echo "Docker version info:"
|
- ${DRONE_COMMIT_SHA}
|
||||||
- docker version
|
dockerfile: Dockerfile
|
||||||
- echo "Building Docker image..."
|
# Если не хочешь пушить — добавь:
|
||||||
- docker build -t ${DRONE_REPO_NAME}:latest .
|
# dry_run: true
|
||||||
- docker tag ${DRONE_REPO_NAME}:latest ${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA}
|
|
||||||
- echo "Docker build completed"
|
|
||||||
- docker images | grep ${DRONE_REPO_NAME} || true
|
|
||||||
|
|
||||||
- name: docker-test
|
- name: docker-test
|
||||||
image: docker:dind
|
image: docker:27-cli
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
commands:
|
commands:
|
||||||
- echo "Testing Docker image..."
|
- docker run --rm ${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA} python -c "print('image ok')"
|
||||||
- docker run --rm ${DRONE_REPO_NAME}:latest python -c "print('Docker image test successful')" || true
|
|
||||||
- echo "Docker tests completed"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- docker-build
|
- docker-build
|
||||||
|
|
||||||
- name: notify
|
|
||||||
image: alpine:latest
|
|
||||||
commands:
|
|
||||||
- echo "Pipeline Summary:"
|
|
||||||
- echo "Branch ${DRONE_BRANCH}"
|
|
||||||
- echo "Commit ${DRONE_COMMIT_SHA}"
|
|
||||||
- echo "Build ${DRONE_BUILD_NUMBER}"
|
|
||||||
- echo "Quiz Bot CI Pipeline completed successfully!"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
host:
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
|
|||||||
Reference in New Issue
Block a user