47 lines
1.4 KiB
YAML
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)
|