Files
full-stack-fastapi/.gitea/workflows/test-backend.yml
魏风 30fd56f86e
Some checks failed
Deploy to Production / deploy (push) Successful in 34s
Test Backend / test-backend (push) Failing after 3m16s
Test Docker Compose / test-docker-compose (push) Failing after 1h4m50s
Playwright Tests / test-playwright (push) Failing after 36m21s
ci(gitea): install uv via venv to avoid PEP 668 on runners
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 10:59:34 +08:00

47 lines
1.4 KiB
YAML

name: Test Backend
on:
push:
branches:
- main
- bt
pull_request:
types:
- opened
- synchronize
jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout and run backend tests
run: |
set -euo pipefail
export UV_PYTHON_DOWNLOADS=automatic
git clone "http://172.17.0.1:3000/${{ github.repository }}.git" .
git checkout "${{ github.sha }}"
sudo apt-get update -qq
sudo apt-get install -y python3 python3-venv ca-certificates
# PEP 668: do not pip install into system Python; bootstrap uv inside a throwaway venv
python3 -m venv /tmp/gitea-ci-venv
/tmp/gitea-ci-venv/bin/pip install --upgrade pip
/tmp/gitea-ci-venv/bin/pip install "uv>=0.4"
export PATH="/tmp/gitea-ci-venv/bin:${PATH}"
docker compose down -v --remove-orphans || true
docker compose up -d db mailcatcher
(cd backend && uv run bash scripts/prestart.sh)
(cd backend && uv run bash scripts/tests-start.sh "Coverage for ${{ github.sha }}")
docker compose down -v --remove-orphans || true
if [ -d backend/htmlcov ]; then
echo "Coverage HTML generated under backend/htmlcov (view on runner if needed)."
fi
(cd backend && uv run coverage report --fail-under=90)