diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..8147b4b --- /dev/null +++ b/.coveragerc @@ -0,0 +1,23 @@ +[run] +source = comfy_cli +omit = tests/* + +[report] +exclude_lines = + pragma: no cover + def __repr__ + if self.debug: + if __name__ == .__main__.: + raise NotImplementedError + pass + except ImportError: + def parse_args + @abstractmethod + +ignore_errors = True + +[html] +directory = coverage_html_report + +[xml] +output = coverage.xml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f5a44db..3a022c8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -3,9 +3,21 @@ on: push: branches: - main + paths: + - "comfy_cli/**" + - "!.github/**" + - "!tests/**" + - "!.coveragerc" + - "!.gitignore" pull_request: branches: - main + paths: + - "comfy_cli/**" + - "!.github/**" + - "!tests/**" + - "!.coveragerc" + - "!.gitignore" jobs: test: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 27bd45a..b9bf881 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -23,11 +23,20 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest + pip install pytest pytest-cov pip install -e . - name: Run tests env: PYTHONPATH: ${{ github.workspace }} run: | - pytest + pytest --cov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: true diff --git a/.github/workflows/run-on-gpu.yml b/.github/workflows/run-on-gpu.yml index a87ec3c..069296a 100644 --- a/.github/workflows/run-on-gpu.yml +++ b/.github/workflows/run-on-gpu.yml @@ -8,6 +8,9 @@ on: - "comfy_cli/**" - "!comfy_cli/test_**" - "!.github/**" + - "!tests/**" + - "!.coveragerc" + - "!.gitignore" pull_request: branches: - main @@ -15,6 +18,9 @@ on: - "comfy_cli/**" - "!comfy_cli/test_**" - "!.github/**" + - "!tests/**" + - "!.coveragerc" + - "!.gitignore" jobs: test-cli-gpu: diff --git a/.gitignore b/.gitignore index a501527..d37eb6a 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ python* cpython* requirements.compiled override.txt +.coverage diff --git a/README.md b/README.md index fd46af2..24daa14 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # Comfy-Cli: A Command Line Tool for ComfyUI + [![Test ComfyUI Example Workflows](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows.yaml/badge.svg)](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows.yaml) [![Test ComfyUI Windows with Default Workflow](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows-windows.yaml/badge.svg)](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows-windows.yaml) +[![codecov](https://codecov.io/github/Comfy-Org/comfy-cli/graph/badge.svg?token=S64WJWD2ZX)](https://codecov.io/github/Comfy-Org/comfy-cli) + comfy-cli is a command line tool that helps users easily install and manage [ComfyUI](https://github.com/comfyanonymous/ComfyUI), a powerful open-source machine learning framework. With comfy-cli, you can quickly set up ComfyUI, install packages, and manage custom nodes, all from the convenience of your terminal. - - ## Demo Comfy Command Demo @@ -150,7 +151,7 @@ comfy node [show|simple-show] [installed|enabled|not-installed|disabled|all|snap #### Bisect custom nodes If you encounter bugs only with custom nodes enabled, and want to find out which custom node(s) causes the bug, - the bisect tool can help you pinpoint the custom node that causes the issue. +the bisect tool can help you pinpoint the custom node that causes the issue. - `comfy node bisect start`: Start a new bisect session with optional ComfyUI launch args. It automatically marks the starting state as bad, and takes all enabled nodes when the command executes as the test set. - `comfy node bisect good`: Mark the current active set as good, indicating the problem is not within the test set. @@ -163,7 +164,7 @@ If you encounter bugs only with custom nodes enabled, and want to find out which `comfy model download --url ?[--relative-path ] ?[--set-civitai-api-token ]` - * URL: CivitAI, huggingface file url, ... + - URL: CivitAI, huggingface file url, ... - Model remove diff --git a/tests/.coverage b/tests/.coverage new file mode 100644 index 0000000..2415f29 Binary files /dev/null and b/tests/.coverage differ diff --git a/tests/coverage.xml b/tests/coverage.xml new file mode 100644 index 0000000..24a3f41 --- /dev/null +++ b/tests/coverage.xml @@ -0,0 +1,530 @@ + + + + + + /Users/junhanhuang/Documents/comfy-cli/tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +