ci: add PR quality and coverage gates
This commit is contained in:
+16
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user