add docs, req, deployments configurations, and develop structure of src #58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Pipeline | |
| # Триггеры для CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [3.12] | |
| steps: | |
| # 1️⃣ Checkout проекта | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2️⃣ Настройка Python и кеширование pip | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| # 3️⃣ Установка UV и зависимостей | |
| - name: Install UV | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install uv | |
| # 4️⃣ Кешируем virtualenv UV для ускорения повторных запусков | |
| - name: Cache UV virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .venv | |
| ~/.cache/uv | |
| key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv- | |
| # 5️⃣ Синхронизация зависимостей проекта через UV | |
| - name: Sync dependencies | |
| run: uv sync | |
| # 6️⃣ Pre-commit checks (форматирование, линтеры и проверки безопасности) | |
| - name: Run Pre-commit checks | |
| uses: pre-commit/action@v3.0.0 | |
| with: | |
| extra_args: --all-files | |
| - name: Clear pre-commit cache | |
| run: pre-commit clean | |
| # 7️⃣ Статическая проверка типизации | |
| - name: Run Mypy | |
| run: uv run mypy src/ | |
| # 8️⃣ Линтер | |
| - name: Run Ruff | |
| run: uv run ruff check src/ | |
| # 9️⃣ Тесты проекта | |
| - name: Run Tests | |
| env: | |
| ENV: test | |
| MAIL_USERNAME: test@example.com | |
| MAIL_PASSWORD: testpass | |
| run: uv run pytest -v --disable-warnings --maxfail=1 | |
| # 🔒 10️⃣ Аудит безопасности зависимостей | |
| # - name: Dependency security audit (pip-audit) | |
| # run: uv run pip-audit --format=columns | |
| # - name: Static security scan (Bandit) | |
| # run: uv run bandit -r src -ll | |
| # - name: Safety scan | |
| # run: uv run safety scan | |
| # 12️⃣ Сохраняем кэш pytest при падении тестов | |
| - name: Upload pytest cache | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-cache | |
| path: .pytest_cache/ |