diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..df53e4d --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,42 @@ +name: test + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + pytest: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:17-alpine + env: + POSTGRES_PASSWORD: ci + POSTGRES_DB: xiaonuan_ci + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 5s + --health-timeout 3s + --health-retries 10 + ports: + - 5432:5432 + env: + PG_DSN: postgresql://postgres:ci@postgres:5432/xiaonuan_ci + steps: + - name: 拉代码 + uses: actions/checkout@v4 + + - name: 装 Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: 安装 uv 并同步依赖 + run: | + pip install uv + uv sync + + - name: 跑测试(含 PG 集成) + run: uv run pytest -q