71 lines
2.5 KiB
YAML
71 lines
2.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
# ------------------------------------------------------------------
|
|
# TypeScript type-check, metadata check, build, AND frontend tests.
|
|
# All JS/TS quality gates live here so a single red job blocks merge.
|
|
# ------------------------------------------------------------------
|
|
typecheck:
|
|
name: TypeScript & Frontend tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run check
|
|
- run: npm run build
|
|
- name: Verify js/ is up to date
|
|
run: |
|
|
git diff --exit-code js/ || (echo "::error::js/ is out of date — run 'npm run build' and commit the result" && exit 1)
|
|
# Frontend unit tests (imageops-registry, node-modules, graph, blend goldens)
|
|
- run: npm run test:js
|
|
|
|
# ------------------------------------------------------------------
|
|
# Python unit tests.
|
|
# Uses CPU-only PyTorch wheels (~200 MB vs ~1.3 GB for CUDA) because
|
|
# these tests never touch CUDA. GPU integration tests belong in a
|
|
# separate job that requires a self-hosted GPU runner.
|
|
#
|
|
# NOTE: tests/unit/ must NOT import from the package root __init__.py
|
|
# directly (that triggers folder_paths / server imports). All ComfyUI
|
|
# integration tests belong in tests/integration/ (not run here).
|
|
# ------------------------------------------------------------------
|
|
pytest:
|
|
name: Python unit tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
cache: pip
|
|
- name: Install CPU-only dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
pip install numpy pytest pillow
|
|
- name: Run unit tests
|
|
run: |
|
|
python -m pytest tests/unit -v
|
|
|
|
# ------------------------------------------------------------------
|
|
# Quality Gate.
|
|
# This job depends on all test/check jobs. It serves as a single
|
|
# required status check target for branch protection rules.
|
|
# ------------------------------------------------------------------
|
|
quality-gate:
|
|
name: Quality Gate
|
|
needs: [typecheck, pytest]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: echo "All quality checks passed!"
|