Files
JasonHoku-ComfyUI-Ultimate-…/.github/workflows/tests.yml
T
Jason HokuandClaude Fable 5.1 ecf28d45aa test(docs): consistency checks between the docs and the code, refresh stale CI count comments
tests/test_docs_consistency.py (stdlib only, reads files, no process or network modules):
- README anchor links resolve (GitHub slug rule pinned), code fences balanced
- every README "## " section and the key features are linked from the TOC
- newest changelog entry is the 11/4/26 one
- every route registered with routes.get/post is in ProjectStructure.md (method + path)
- the file map lists every root .py, web/ file, resources/ file, tests/e2e, tests/js,
  examples, tests.yml and names no .py that does not exist
- every ultimate_grid.* event sent by the code is in Server Event Types (+ sweep phase payload)
- html_generator.js_files ends with logic_standalone.js and is listed in the docs
- no stale convertStateToConfigs / network_utils.py mentions
- CONTRIBUTING.md names every CI job id and the CI flags

tests.yml: comment-only edit, the "# expect:" counts now match the measured
499 passed / 16 skipped (stub leg).

Note: the docs checks are expected to be red at this commit; the next commit
(docs) makes them green.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-04 01:05:17 -08:00

136 lines
4.7 KiB
YAML

name: Tests
on:
push:
pull_request:
permissions:
contents: read
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
jobs:
pytest-stubs:
name: pytest (ComfyUI + torch stubbed)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: tests/requirements-ci.txt
- run: pip install -r tests/requirements-ci.txt
- name: Assert torch is NOT installed (this leg tests the stub path)
run: python -c "import importlib.util,sys; sys.exit(importlib.util.find_spec('torch') is not None)"
# expect: 499 passed, 16 skipped (the requires_torch tests), measured 11/4/26
- run: python -m pytest tests/ -q -ra --ignore=tests/e2e
pytest-torch:
name: pytest (real CPU torch)
runs-on: ubuntu-latest
timeout-minutes: 20
env:
USCG_REQUIRE_TORCH: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: tests/requirements-ci.txt
- name: Install CPU torch (latest CPU wheel; the tests only need the torch API, not a specific minor)
run: pip install torch --index-url https://download.pytorch.org/whl/cpu
- run: pip install -r tests/requirements-ci.txt
- run: python -c "import torch; print(torch.__version__); assert hasattr(torch, 'inference_mode')"
# expect: 515 passed, 0 skipped (the stub leg's passed + skipped; the torch leg itself is not measured locally)
- run: python -m pytest tests/ -q -ra --ignore=tests/e2e
js-syntax:
name: JS syntax
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: web/**/*.js (ES modules)
run: |
for f in $(find web -name '*.js'); do
node --input-type=module --check < "$f" || { echo "FAIL $f"; exit 1; }
done
- name: resources/*.js (plain scripts)
run: |
for f in resources/*.js; do
node --check "$f" || { echo "FAIL $f"; exit 1; }
done
- name: Assembled Dashboard page (all logic_*.js share ONE script scope)
run: |
python - <<'PY'
import os, re, sys
sys.path.insert(0, os.getcwd())
import html_generator
page = html_generator.get_html_template("ci", {"items": []}, "1")
bodies = re.findall(r"<script(?![^>]*\bsrc=)[^>]*>(.*?)</script>", page, re.S)
assert bodies, "no inline <script> found in the generated page"
out = os.environ.get("RUNNER_TEMP", ".")
for n, body in enumerate(bodies):
with open(os.path.join(out, f"bundle_{n}.js"), "w", encoding="utf-8") as fh:
fh.write(body)
print(f"wrote {len(bodies)} script bodies to {out}")
PY
for f in "${RUNNER_TEMP:-.}"/bundle_*.js; do
node --check "$f" || { echo "FAIL $f"; exit 1; }
done
- name: node:test unit tests (tests/js, if present)
run: |
if [ -d tests/js ]; then
node --test tests/js/
else
echo "tests/js not present, skipping"
fi
e2e-dashboard:
name: Dashboard SPA (Playwright)
runs-on: ubuntu-latest
timeout-minutes: 15
env:
USCG_REQUIRE_E2E: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
tests/requirements-ci.txt
tests/e2e/requirements.txt
- run: pip install -r tests/requirements-ci.txt -r tests/e2e/requirements.txt
- name: Cache Playwright browsers
id: pw
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: pw-${{ runner.os }}-${{ hashFiles('tests/e2e/requirements.txt') }}
- name: Install Chromium (cache miss)
if: steps.pw.outputs.cache-hit != 'true'
run: python -m playwright install --with-deps --only-shell chromium
- name: Install Chromium system deps (cache hit)
if: steps.pw.outputs.cache-hit == 'true'
run: python -m playwright install-deps chromium
- run: python -m pytest tests/e2e -q -ra --browser chromium --tracing retain-on-failure --output test-results
- name: Upload traces
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: test-results/
retention-days: 7