From 3ee969f77804d1ecdd2cf60be08fcb08105ca4dd Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Wed, 16 Jul 2025 15:48:22 -0700 Subject: [PATCH] Test macOS --- .github/workflows/test.yml | 21 +++++++++++++++++++++ pyproject.toml | 14 +++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b9122d98..0b95e6bfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,3 +46,24 @@ jobs: run: | pylint --rcfile=.pylintrc comfy/ pylint --rcfile=.pylintrc comfy_extras/ + build_and_execute_macos: + environment: "Testing" + name: Unit Tests for macOS + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + name: Checkout git repo + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install system dependencies + run: brew install ffmpeg + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Install ComfyUI + run: uv pip install '.[mps,dev]' --inexact + - name: Run tests + run: | + export OTEL_METRICS_EXPORTER=none + pytest -v tests/unit diff --git a/pyproject.toml b/pyproject.toml index 595c980f2..990113452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -160,6 +160,11 @@ rocm = [ "pytorch-triton-rocm" ] +mps = [ + "torch", + "torchvision", +] + attention = [ "sageattention", "flash_attn ; sys_platform == 'Linux'", @@ -188,7 +193,7 @@ Repository = "https://github.com/comfyanonymous/ComfyUI" [tool.uv] conflicts = [ - [{ extra = "cpu" }, { extra = "cu126" }, { extra = "cu128" }, { extra = "rocm" }], + [{ extra = "cpu" }, { extra = "cu126" }, { extra = "cu128" }, { extra = "rocm" }, { extra = "mps" }], ] no-build-isolation-package = [ "sageattention", @@ -216,18 +221,25 @@ name = "pytorch-rocm" url = "https://download.pytorch.org/whl/rocm6.3" explicit = true +[[tool.uv.index]] +name = "pytorch-nightly-cpu" +url = "https://download.pytorch.org/whl/nightly/cpu" +explicit = true + [tool.uv.sources] torch = [ { index = "pytorch-cpu", extra = "cpu" }, { index = "pytorch-cu126", extra = "cu126", marker = "sys_platform == 'Linux' or sys_platform == 'win32'" }, { index = "pytorch-cu128", extra = "cu128", marker = "sys_platform == 'Linux' or sys_platform == 'win32'" }, { index = "pytorch-rocm", extra = "rocm", marker = "sys_platform == 'Linux'" }, + { index = "pytorch-nightly-cpu", extra = "mps", marker = "sys_platform == 'darwin'" }, ] torchvision = [ { index = "pytorch-cpu", extra = "cpu" }, { index = "pytorch-cu126", extra = "cu126", marker = "sys_platform == 'Linux' or sys_platform == 'win32'" }, { index = "pytorch-cu128", extra = "cu128", marker = "sys_platform == 'Linux' or sys_platform == 'win32'" }, { index = "pytorch-rocm", extra = "rocm", marker = "sys_platform == 'Linux'" }, + { index = "pytorch-nightly-cpu", extra = "mps", marker = "sys_platform == 'darwin'" }, ] torchaudio = [ { index = "pytorch-cpu", extra = "cpu" },