test build and deploy
Some checks failed
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD / build-and-deploy (pull_request) Failing after 2m38s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s

This commit is contained in:
2026-04-02 17:10:21 +03:00
parent 867fcaa722
commit c185b62441

View File

@@ -53,6 +53,68 @@ jobs:
run: |
cd web
npm run build
build-and-deploy:
needs: test-backend
runs-on: ubuntu-latest
if: success() # Запускается только если тесты прошли успешно
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to container registry
uses: docker/login-action@v3
with:
registry: gitea.example.com # Замените на ваш Gitea registry
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: fastapi-app:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Stop and remove old container
run: |
docker stop fastapi-container || true
docker rm fastapi-container || true
- name: Run new container
run: |
docker run -d \
--name fastapi-container \
-p 8080:8000 \
--restart unless-stopped \
fastapi-app:latest
- name: Wait for container to be ready
run: |
for i in {1..30}; do
if curl -s http://localhost:8080/health > /dev/null; then
echo "Container is ready!"
exit 0
fi
echo "Waiting for container... ($i/30)"
sleep 2
done
echo "Container failed to start properly"
docker logs fastapi-container
exit 1
- name: Verify deployment
run: |
curl -f http://localhost:8080/ || exit 1
echo "Deployment successful!"
# Явный статус для PR
pr-status: