Some checks reported errors
continuous-integration/drone/push Build encountered an error
106 lines
2.8 KiB
YAML
106 lines
2.8 KiB
YAML
services:
|
|
docker:
|
|
image: docker:27-dind
|
|
privileged: true
|
|
command: [ "--host=tcp://0.0.0.0:2375" ]
|
|
environment:
|
|
DOCKER_TLS_CERTDIR: ""
|
|
|
|
pipeline:
|
|
|
|
prepare:
|
|
image: alpine/git:latest
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
commands:
|
|
- echo "Pipeline started for branch ${DRONE_BRANCH}"
|
|
- echo "Commit: ${DRONE_COMMIT_SHA}"
|
|
- echo "Author: ${DRONE_COMMIT_AUTHOR}"
|
|
- git --version
|
|
|
|
lint:
|
|
image: python:3.12-slim
|
|
commands:
|
|
- pip install --no-cache-dir flake8 black isort mypy
|
|
- black --check --diff src/ config/ tools/ tests/ || true
|
|
- isort --check-only --diff src/ config/ tools/ tests/ || true
|
|
- flake8 src/ config/ tools/ tests/ --max-line-length=88 --extend-ignore=E203,W503 || true
|
|
|
|
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
|
|
|
|
security:
|
|
image: python:3.12-slim
|
|
commands:
|
|
- pip install --no-cache-dir safety bandit
|
|
- safety check --json || true
|
|
- bandit -r src/ -f json || true
|
|
|
|
typecheck:
|
|
image: python:3.12-slim
|
|
commands:
|
|
- pip install --no-cache-dir mypy types-requests
|
|
- mypy src/ --ignore-missing-imports || true
|
|
|
|
docker_build:
|
|
image: docker:27
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
DOCKER_TLS_CERTDIR: ""
|
|
commands:
|
|
- docker version
|
|
- docker build -t quiz-bot:${DRONE_COMMIT_SHA} .
|
|
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:latest
|
|
when:
|
|
branch: [ main, develop ]
|
|
event: [ push, pull_request ]
|
|
|
|
docker_test:
|
|
image: docker:27
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
DOCKER_TLS_CERTDIR: ""
|
|
commands:
|
|
- docker run --rm quiz-bot:${DRONE_COMMIT_SHA} python -c "import src.bot; print('Import successful')"
|
|
when:
|
|
branch: [ main, develop ]
|
|
event: [ push, pull_request ]
|
|
|
|
quality:
|
|
image: python:3.12-slim
|
|
commands:
|
|
- pip install --no-cache-dir flake8 radon
|
|
- radon cc src/ -s || true
|
|
- radon mi src/ -s || true
|
|
|
|
deploy:
|
|
image: docker:27
|
|
environment:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
DOCKER_TLS_CERTDIR: ""
|
|
commands:
|
|
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:production
|
|
- echo "Deployment completed (simulation)"
|
|
when:
|
|
branch: [ main ]
|
|
event: [ push ]
|
|
|
|
notify_success:
|
|
image: alpine:latest
|
|
commands:
|
|
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
|
- echo "Build status: SUCCESS"
|
|
when:
|
|
status: success
|
|
|
|
notify_failure:
|
|
image: alpine:latest
|
|
commands:
|
|
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
|
- echo "Build status: FAILURE"
|
|
when:
|
|
status: failure |