Files
python-common-app/.gitea/workflows/ci.yml
EremeevRA b3eaf03627
All checks were successful
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
Add manual archiving workflow to Gitea CI
- Introduced a new workflow for manual archiving, allowing users to trigger the creation of archives for the api and web directories.
- The workflow includes steps for code checkout and artifact upload with a retention policy of 7 days.
2026-03-24 13:21:48 +03:00

116 lines
3.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: CI/CD
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- test
workflow_dispatch:
jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- name: Проверка кода
uses: actions/checkout@v4
- name: Настройка Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Установка зависимостей
run: |
cd api
pip install -r requirements.txt
- name: Подтверждение сборки
run: |
python -c "from api.main import app"
- name: Запуск тестов
run: |
pytest -q
test-frontend:
runs-on: ubuntu-latest
steps:
- name: Проверка кода
uses: actions/checkout@v4
- name: Настройка Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Установка зависимостей
run: |
cd web
npm ci
- name: Сборка фронта
run: |
cd web
npm run build
# create-archives:
# needs: [test-backend, test-frontend]
# runs-on: ubuntu-latest
# if: github.event_name == 'workflow_dispatch' && always()
# steps:
# - name: Проверка кода
# uses: actions/checkout@v4
# - name: Загрузка артифакта
# uses: actions/upload-artifact@v3
# with:
# name: build-artifacts-${{ github.run_id }}
# path: |
# api/
# web/
# retention-days: 7
# Явный статус для PR
pr-status:
needs: [test-backend, test-frontend]
runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request'
steps:
- name: Проверка статуса и обновление PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Определяем общий статус проверок
if [[ "${{ needs.test-backend.result }}" == "success" ]] && \
[[ "${{ needs.test-frontend.result }}" == "success" ]]; then
STATE="success"
DESCRIPTION="✅ Все проверки прошли успешно"
EXIT_CODE=0
else
STATE="failure"
DESCRIPTION="❌ Некоторые проверки сломались"
EXIT_CODE=1
fi
# Формируем URL для API статусов
REPO="${{ github.repository }}"
SHA="${{ github.event.pull_request.head.sha }}"
API_URL="${{ github.api_url }}/repos/${REPO}/statuses/${SHA}"
# Отправляем статус в Gitea
curl -X POST "$API_URL" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"state\": \"$STATE\",
\"context\": \"CI/CD Pipeline / Overall Status\",
\"description\": \"$DESCRIPTION\",
\"target_url\": \"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"
}"
echo "Status $STATE sent for commit $SHA"
# Выходим с соответствующим кодом, чтобы блокировать PR при неудаче
exit $EXIT_CODE