Tests cover: - routes.py: Input validation, path traversal protection, JSON error handling, GUID sanitization (12 new tests) - nodes/ideogram4_nodes.py: Prompt assembly, bbox normalization, palette handling, JSON serialization, input coercion (28 new tests) All tests use mocks via conftest.py to avoid ComfyUI dependencies. Tests import the repo as a proper package so routes.py relative imports work unchanged. CI: Install aiohttp for route tests. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
lint-and-test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.10', '3.11', '3.12']
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install flake8 aiohttp pytest pytest-asyncio
|
|
|
|
- name: Lint with flake8
|
|
run: |
|
|
# Stop the build if there are Python syntax errors or undefined names
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=__pycache__,.git
|
|
# Exit-zero treats all errors as warnings
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=__pycache__,.git
|
|
|
|
- name: Check Python syntax
|
|
run: |
|
|
python -m py_compile __init__.py
|
|
python -m py_compile nodes/__init__.py
|
|
python -m py_compile nodes/ideogram4_nodes.py
|
|
python -m py_compile routes.py
|
|
python -m py_compile store.py
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
python -m pytest tests/ -v
|
|
|
|
javascript-check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Check JavaScript syntax
|
|
run: |
|
|
node -c web/js/ideogram4_prompt_builder_enhanced.js
|
|
node -c web/js/ideogram4_shared.js
|
|
node -c web/js/utility.js
|