ci(gitea): add offline-friendly test workflows and deploy on bt
Some checks failed
Deploy to Production / deploy (push) Failing after 2m57s
Playwright Tests / test-playwright (push) Failing after 22s
Test Backend / test-backend (push) Failing after 14s
Test Docker Compose / test-docker-compose (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
魏风
2026-05-11 10:33:38 +08:00
parent 3c9a0343e9
commit 5d50401d40
4 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
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 PATH="${HOME}/.local/bin:${PATH}"
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-pip python3-venv ca-certificates
python3 -m pip install --user --upgrade pip
python3 -m pip install --user "uv>=0.4"
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)