Refactor CI workflow to localize job names in Russian and remove deprecated multistep and test workflows. Update artifact upload step to ensure clarity in job descriptions.
All checks were successful
CI/CD / test-backend (pull_request) Successful in 6s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
CI/CD / create-archives (pull_request) Has been skipped

This commit is contained in:
2026-03-24 13:11:46 +03:00
parent 38faec32f1
commit 288a2d81a1
3 changed files with 15 additions and 409 deletions

View File

@@ -12,45 +12,44 @@ jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Проверка кода
uses: actions/checkout@v4
- name: Set up Python
- name: Настройка Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
- name: Установка зависимостей
run: |
cd api
pip install -r requirements.txt
- name: Verify build
- name: Подтверждение сборки
run: |
python -c "from api.main import app"
- name: Run tests
- name: Запуск тестов
run: |
pytest -q
test-frontend:
needs: test-backend
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Проверка кода
uses: actions/checkout@v4
- name: Set up Node.js
- name: Настройка Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
- name: Установка зависимостей
run: |
cd web
npm ci
- name: Build frontend
- name: Сборка фронта
run: |
cd web
npm run build
@@ -58,23 +57,12 @@ jobs:
create-archives:
needs: [test-backend, test-frontend]
runs-on: ubuntu-latest
if: always() && !cancelled()
if: github.event_name == 'workflow_dispatch' && always()
steps:
- name: Checkout code
- name: Проверка кода
uses: actions/checkout@v4
# - name: Create archives
# run: |
# echo "Creating full-build.zip with api and web..."
# # Создаём единый архив, включающий папки api и web, с исключениями
# zip -r full-build.zip api/ web/ \
# -x "api/*.pyc" "api/*__pycache__*" "api/.git*" "api/.pytest_cache*" \
# -x "web/node_modules/*" "web/.git*" "web/dist/*" "web/*.log" \
# || echo "Warning: zip command had issues"
# # Проверяем, что файл создан
# ls -la full-build.zip
- name: Upload artifacts
- name: Загрузка артифакта
uses: actions/upload-artifact@v3
with:
name: build-artifacts-${{ github.run_id }}
@@ -89,7 +77,7 @@ jobs:
runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request'
steps:
- name: Check status and update PR
- name: Проверка статуса и обновление PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -97,11 +85,11 @@ jobs:
if [[ "${{ needs.test-backend.result }}" == "success" ]] && \
[[ "${{ needs.test-frontend.result }}" == "success" ]]; then
STATE="success"
DESCRIPTION="✅ All checks passed successfully"
DESCRIPTION="✅ Все проверки прошли успешно"
EXIT_CODE=0
else
STATE="failure"
DESCRIPTION="❌ Some checks failed"
DESCRIPTION="❌ Некоторые проверки сломались"
EXIT_CODE=1
fi
@@ -125,54 +113,3 @@ jobs:
# Выходим с соответствующим кодом, чтобы блокировать PR при неудаче
exit $EXIT_CODE
# Опционально: добавляем комментарий в PR при неудаче
comment-on-failure:
needs: [test-backend, test-frontend, pr-status]
runs-on: ubuntu-latest
if: failure() && github.event_name == 'pull_request'
steps:
- name: Add failure comment to PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Определяем какие проверки не прошли
BACKEND_STATUS="${{ needs.test-backend.result }}"
FRONTEND_STATUS="${{ needs.test-frontend.result }}"
COMMENT="## ❌ Проверки не пройдены!
### Результаты проверок:
| Проверка | Статус |
|----------|--------|
| **Backend tests** | $( [ "$BACKEND_STATUS" = "success" ] && echo "✅ Успешно" || echo "❌ Ошибка" ) |
| **Frontend build** | $( [ "$FRONTEND_STATUS" = "success" ] && echo "✅ Успешно" || echo "❌ Ошибка" ) |
### Детали:
- **Ветка**: ${{ github.head_ref }}
- **Коммит**: \`${{ github.event.pull_request.head.sha }}\`
- **Запуск**: [Смотреть детали](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
Пожалуйста, исправьте ошибки перед слиянием. 🚨"
# Находим PR номер
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
# Добавляем комментарий
curl -X POST "${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"body\": $(echo "$COMMENT" | jq -Rs .)}"
echo "Comment added to PR #$PR_NUMBER"
# Опционально: удаляем старые артефакты
cleanup:
needs: [create-archives, pr-status]
runs-on: ubuntu-latest
if: always()
steps:
- name: Clean up old artifacts
run: |
echo "Cleaning up temporary files"
# Здесь можно добавить логику очистки, если нужно