ci: add PR quality and coverage gates

This commit is contained in:
2026-08-09 00:10:24 +08:00
parent e50ac83988
commit 2f90c82d54
34 changed files with 47 additions and 34 deletions
+16 -4
View File
@@ -1,13 +1,17 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ gitea.event_name }}-${{ gitea.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
services:
mysql:
image: mysql:8.0.35
@@ -45,6 +49,8 @@ jobs:
--timeout 120 \
--retries 5 \
-r requirements-dev.txt
- name: Ruff checks
run: .venv-ci/bin/ruff check backend scripts
- name: Check migrations
working-directory: backend
run: ../.venv-ci/bin/python manage.py makemigrations --check --dry-run
@@ -54,8 +60,14 @@ jobs:
- name: ASGI import check
working-directory: backend
run: ../.venv-ci/bin/python -c "from config.asgi import application; print(type(application).__name__)"
- name: Unit tests
run: .venv-ci/bin/python -m pytest -q
- name: SQLite tests and coverage
run: |
.venv-ci/bin/python -m pytest -q \
--cov=backend \
--cov-config=.coveragerc \
--cov-report=term \
--cov-report=xml:coverage.xml \
--cov-fail-under=75
- name: MySQL migrations and tests
env:
DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath