mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
Merge pull request #486 from willmiao/codex/enable-test-coverage-metrics-in-ci
ci: add pytest coverage reporting
This commit is contained in:
69
.github/workflows/backend-tests.yml
vendored
Normal file
69
.github/workflows/backend-tests.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
name: Backend Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- 'py/**'
|
||||||
|
- 'standalone.py'
|
||||||
|
- 'tests/**'
|
||||||
|
- 'requirements.txt'
|
||||||
|
- 'requirements-dev.txt'
|
||||||
|
- 'pyproject.toml'
|
||||||
|
- 'pytest.ini'
|
||||||
|
- '.github/workflows/backend-tests.yml'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'py/**'
|
||||||
|
- 'standalone.py'
|
||||||
|
- 'tests/**'
|
||||||
|
- 'requirements.txt'
|
||||||
|
- 'requirements-dev.txt'
|
||||||
|
- 'pyproject.toml'
|
||||||
|
- 'pytest.ini'
|
||||||
|
- '.github/workflows/backend-tests.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pytest:
|
||||||
|
name: Run pytest with coverage
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.11
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
cache: 'pip'
|
||||||
|
cache-dependency-path: |
|
||||||
|
requirements.txt
|
||||||
|
requirements-dev.txt
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
|
||||||
|
- name: Run pytest with coverage
|
||||||
|
env:
|
||||||
|
COVERAGE_FILE: coverage/backend/.coverage
|
||||||
|
run: |
|
||||||
|
mkdir -p coverage/backend
|
||||||
|
python -m pytest \
|
||||||
|
--cov=py \
|
||||||
|
--cov=standalone \
|
||||||
|
--cov-report=term-missing \
|
||||||
|
--cov-report=xml:coverage/backend/coverage.xml \
|
||||||
|
--cov-report=html:coverage/backend/html \
|
||||||
|
--cov-report=json:coverage/backend/coverage.json
|
||||||
|
|
||||||
|
- name: Upload coverage artifact
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: backend-coverage
|
||||||
|
path: coverage/backend
|
||||||
|
if-no-files-found: warn
|
||||||
2
.github/workflows/frontend-tests.yml
vendored
2
.github/workflows/frontend-tests.yml
vendored
@@ -11,6 +11,7 @@ on:
|
|||||||
- 'vitest.config.js'
|
- 'vitest.config.js'
|
||||||
- 'tests/frontend/**'
|
- 'tests/frontend/**'
|
||||||
- 'static/js/**'
|
- 'static/js/**'
|
||||||
|
- 'scripts/run_frontend_coverage.js'
|
||||||
- '.github/workflows/frontend-tests.yml'
|
- '.github/workflows/frontend-tests.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
@@ -19,6 +20,7 @@ on:
|
|||||||
- 'vitest.config.js'
|
- 'vitest.config.js'
|
||||||
- 'tests/frontend/**'
|
- 'tests/frontend/**'
|
||||||
- 'static/js/**'
|
- 'static/js/**'
|
||||||
|
- 'scripts/run_frontend_coverage.js'
|
||||||
- '.github/workflows/frontend-tests.yml'
|
- '.github/workflows/frontend-tests.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ cache/
|
|||||||
civitai/
|
civitai/
|
||||||
node_modules/
|
node_modules/
|
||||||
coverage/
|
coverage/
|
||||||
|
.coverage
|
||||||
|
|||||||
27
README.md
27
README.md
@@ -233,6 +233,33 @@ You can now run LoRA Manager independently from ComfyUI:
|
|||||||
|
|
||||||
This standalone mode provides a lightweight option for managing your model and recipe collection without needing to run the full ComfyUI environment, making it useful even for users who primarily use other stable diffusion interfaces.
|
This standalone mode provides a lightweight option for managing your model and recipe collection without needing to run the full ComfyUI environment, making it useful even for users who primarily use other stable diffusion interfaces.
|
||||||
|
|
||||||
|
## Testing & Coverage
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
|
||||||
|
Install the development dependencies and run pytest with coverage reports:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
COVERAGE_FILE=coverage/backend/.coverage pytest \
|
||||||
|
--cov=py \
|
||||||
|
--cov=standalone \
|
||||||
|
--cov-report=term-missing \
|
||||||
|
--cov-report=html:coverage/backend/html \
|
||||||
|
--cov-report=xml:coverage/backend/coverage.xml \
|
||||||
|
--cov-report=json:coverage/backend/coverage.json
|
||||||
|
```
|
||||||
|
|
||||||
|
HTML, XML, and JSON artifacts are stored under `coverage/backend/` so you can inspect hot spots locally or from CI artifacts.
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
Run the Vitest coverage suite to analyze widget hot spots:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run test:coverage
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
3
requirements-dev.txt
Normal file
3
requirements-dev.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
-r requirements.txt
|
||||||
|
pytest>=7.4
|
||||||
|
pytest-cov>=4.1
|
||||||
Reference in New Issue
Block a user