- Создана система отслеживания миграций (MigrationRepository, таблица migrations) - Добавлен скрипт apply_migrations.py для автоматического применения миграций - Созданы CI/CD пайплайны (.github/workflows/ci.yml, deploy.yml) - Обновлена документация по миграциям в database-patterns.md - Миграции применяются автоматически при деплое в продакшн
94 lines
3.1 KiB
YAML
94 lines
3.1 KiB
YAML
name: CI pipeline
|
|
|
|
on:
|
|
push:
|
|
branches: [ 'dev-*', 'feature-*' ]
|
|
pull_request:
|
|
branches: [ 'dev-*', 'feature-*', 'main' ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: Test & Code Quality
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.11
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Code formatting check (Black)
|
|
run: |
|
|
echo "🔍 Checking code formatting with Black..."
|
|
black --check . || (echo "❌ Code formatting issues found. Run 'black .' to fix." && exit 1)
|
|
|
|
- name: Import sorting check (isort)
|
|
run: |
|
|
echo "🔍 Checking import sorting with isort..."
|
|
isort --check-only . || (echo "❌ Import sorting issues found. Run 'isort .' to fix." && exit 1)
|
|
|
|
- name: Linting (flake8) - Critical errors
|
|
run: |
|
|
echo "🔍 Running flake8 linter (critical errors only)..."
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics || true
|
|
|
|
- name: Linting (flake8) - Warnings
|
|
run: |
|
|
echo "🔍 Running flake8 linter (warnings)..."
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics || true
|
|
continue-on-error: true
|
|
|
|
- name: Run tests
|
|
run: |
|
|
echo "🧪 Running tests..."
|
|
python -m pytest tests/ -v --tb=short
|
|
|
|
- name: Send test success notification
|
|
if: success()
|
|
uses: appleboy/telegram-action@v1.0.0
|
|
with:
|
|
to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
message: |
|
|
✅ CI Tests Passed
|
|
|
|
📦 Repository: telegram-helper-bot
|
|
🌿 Branch: ${{ github.ref_name }}
|
|
📝 Commit: ${{ github.sha }}
|
|
👤 Author: ${{ github.actor }}
|
|
|
|
✅ All tests passed! Code quality checks completed successfully.
|
|
|
|
🔗 View details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
continue-on-error: true
|
|
|
|
- name: Send test failure notification
|
|
if: failure()
|
|
uses: appleboy/telegram-action@v1.0.0
|
|
with:
|
|
to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
message: |
|
|
❌ CI Tests Failed
|
|
|
|
📦 Repository: telegram-helper-bot
|
|
🌿 Branch: ${{ github.ref_name }}
|
|
📝 Commit: ${{ github.sha }}
|
|
👤 Author: ${{ github.actor }}
|
|
|
|
❌ Tests failed! Deployment blocked. Please fix the issues and try again.
|
|
|
|
🔗 View details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
continue-on-error: true
|