Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Comfy-Org/comfy-action
Browse files Browse the repository at this point in the history
  • Loading branch information
yoland68 committed Jul 11, 2024
2 parents 8b6b731 + 1548461 commit ada1aa8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
26 changes: 10 additions & 16 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ runs:
auto-activate-base: false
python-version: ${{ inputs.python_version }}

- name: '[Unix] Activate conda'
if: ${{ inputs.os != 'windows' }}
run: |
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
shell: bash -el {0}

- name: '[Unix-Mac-Only] Install Pytorch nightly'
if: ${{ inputs.os == 'macos' }}
shell: bash -el {0}
Expand Down Expand Up @@ -252,35 +246,33 @@ runs:
python-version: ${{ inputs.python_version }}
continue-on-error: true

- name: "[Win] Activate conda"
if: ${{ inputs.os == 'windows' }}
run: |
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
shell: powershell

- name: '[Win-Only] Install Pytorch'
if: ${{ inputs.os == 'windows' }}
shell: powershell
run: |
conda install pytorch torchvision torchaudio pytorch-cuda=${{ inputs.cuda_version }} -c pytorch -c nvidia --yes
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
Get-Command pip
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
- name: '[Win] Install dependencies'
if: ${{ inputs.os == 'windows' }}
shell: powershell
run: |
Get-Command pip
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
pip install -r requirements.txt
- name: "[Win] Check conda environment"
if: ${{ inputs.os == 'windows' }}
run: |
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda info
conda list
shell: powershell

- name: '[Win] Download models'
if: ${{ inputs.os == 'windows' }}
run: |
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
cd $Env:GITHUB_ACTION_PATH
pip install -r requirements.txt
python default-models-prep.py --cache-directory C:\actions-runner\modelcache --live-directory "$Env:GITHUB_WORKSPACE/models"
Expand All @@ -290,6 +282,7 @@ runs:
if: ${{ inputs.os == 'windows' }}
shell: powershell
run: |
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
python $Env:GITHUB_WORKSPACE/main.py --quick-test-for-ci
- name: '[Win] Run ComfyUI'
Expand All @@ -300,7 +293,8 @@ runs:
Write-Output "##############################"
Write-Output $envGithubWorkspace
Write-Output "##############################"
Start-Process powershell -ArgumentList "-File", "${{ github.action_path }}\start-server.ps1", "-GITHUB_WORKSPACE", "`"$envGithubWorkspace`""
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
Start-Process powershell -ArgumentList "-File", "${{ github.action_path }}\start-server.ps1", "-GITHUB_WORKSPACE", "`"$envGithubWorkspace`"", "-CondaEnv", "`"gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}`""
- name: '[Win] Check if the server is running'
if: ${{ inputs.os == 'windows' }}
Expand Down Expand Up @@ -328,7 +322,7 @@ runs:
shell: powershell
run: |
cd $Env:GITHUB_ACTION_PATH
conda activate gha-comfyui
conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
Write-Host "Running workflows: ${{ inputs.workflow_filenames }}"
python action.py `
--comfy-workflow-names "${{ inputs.workflow_filenames }}" `
Expand Down
5 changes: 3 additions & 2 deletions start-server.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# start-server.ps1
param (
[String]$GITHUB_WORKSPACE,
[String]$PythonFlags
[String]$PythonFlags,
[String]$CondaEnv
)

# Initialize Conda environment
# TODO: remove hardcoding
echo "Starting Conda"
conda activate gha-comfyui
conda activate "$CondaEnv"

# Start the web server and redirect output to a log file
echo "Running Server"
Expand Down

0 comments on commit ada1aa8

Please sign in to comment.