added tests
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
name: Code Quality (Lint)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main, master, develop]
|
||||
push:
|
||||
branches: [main, master, develop]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install linting tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install ruff black isort
|
||||
|
||||
- name: Run Ruff (linter)
|
||||
run: |
|
||||
ruff check . --output-format=github
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run Black (formatter check)
|
||||
run: |
|
||||
black --check --diff .
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run isort (import sorting check)
|
||||
run: |
|
||||
isort --check-only --diff .
|
||||
continue-on-error: true
|
||||
|
||||
- name: Lint summary
|
||||
if: always()
|
||||
run: |
|
||||
echo "## Code Quality Results" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ Ruff linting completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ Black formatting check completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ isort import sorting check completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Note**: Linting errors are not blocking CI (continue-on-error: true)" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Publish to Comfy registry
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'PozzettiAndrea' }}
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@v1
|
||||
with:
|
||||
## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
@@ -0,0 +1,80 @@
|
||||
name: Real Model Integration Tests
|
||||
|
||||
on:
|
||||
# Run on schedule (weekly, every Monday at 3 AM UTC)
|
||||
schedule:
|
||||
- cron: '0 3 * * 1'
|
||||
|
||||
# Allow manual trigger
|
||||
workflow_dispatch:
|
||||
|
||||
# Optionally run on specific branches (commented out to save resources)
|
||||
# push:
|
||||
# branches: [main]
|
||||
|
||||
jobs:
|
||||
test-real-models:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60 # Real model tests can take longer
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgl1-mesa-glx libglib2.0-0
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest pytest-cov pytest-mock pytest-asyncio
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
- name: Create model cache directory
|
||||
run: |
|
||||
mkdir -p ~/.cache/huggingface
|
||||
|
||||
- name: Cache models
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/huggingface
|
||||
key: ${{ runner.os }}-huggingface-models-${{ hashFiles('tests/integration_real/*.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-huggingface-models-
|
||||
|
||||
- name: Run real model tests
|
||||
run: |
|
||||
pytest tests/integration_real/ -v -m real_model --tb=short
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
HF_HUB_DISABLE_TELEMETRY: 1
|
||||
|
||||
- name: Test summary
|
||||
if: always()
|
||||
run: |
|
||||
echo "## Real Model Test Results" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ GroundingDINO SwinT tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ Florence-2 Base tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ OWLv2 Base tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ YOLO-World v2 S tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Note**: SAM2 tests were skipped as requested" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Upload test artifacts
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-failures
|
||||
path: |
|
||||
pytest-results/
|
||||
*.log
|
||||
@@ -0,0 +1,66 @@
|
||||
name: Unit and Integration Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master, develop]
|
||||
pull_request:
|
||||
branches: [main, master, develop]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest pytest-cov pytest-mock pytest-asyncio
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
pytest tests/unit/ -v --cov=nodes --cov-report=xml --cov-report=term-missing
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
- name: Run mocked integration tests
|
||||
run: |
|
||||
pytest tests/integration/ -v --cov=nodes --cov-append --cov-report=xml --cov-report=term-missing
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
- name: Run workflow validation tests
|
||||
run: |
|
||||
pytest tests/workflows/ -v
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v4
|
||||
if: matrix.python-version == '3.10'
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
- name: Test summary
|
||||
if: always()
|
||||
run: |
|
||||
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ Unit tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ Mocked integration tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ Workflow validation tests completed" >> $GITHUB_STEP_SUMMARY
|
||||
Reference in New Issue
Block a user