diff --git a/action.yml b/action.yml index 850031c..0bcfa00 100644 --- a/action.yml +++ b/action.yml @@ -64,7 +64,6 @@ inputs: description: "Skip quickci." required: false default: "true" - runs: using: "composite" steps: @@ -113,68 +112,47 @@ runs: - name: '[Unix-Mac-Only] Install Pytorch nightly' if: ${{ inputs.os == 'macos' && inputs.torch_version == 'nightly' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} - CUDA_VERSION: ${{ inputs.cuda_version }} run: | conda env list - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} conda install pytorch-nightly::pytorch torchvision torchaudio -c pytorch-nightly - name: '[Unix-Mac-Only] Install Pytorch stable' if: ${{ inputs.os == 'macos' && inputs.torch_version == 'stable' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | conda env list - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} conda install pytorch::pytorch torchvision torchaudio -c pytorch - name: '[Unix-Linux-Only] Install Pytorch nightly' if: ${{ inputs.os == 'linux' && inputs.torch_version == 'nightly' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} - CUDA_VERSION: ${{ inputs.cuda_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} - #conda install pytorch torchvision torchaudio pytorch-cuda=${CUDA_VERSION} -c pytorch-nightly -c nvidia + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} + #conda install pytorch torchvision torchaudio pytorch-cuda=${{ inputs.cuda_version }} -c pytorch-nightly -c nvidia pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121 - name: '[Unix-Linux-Only] Install Pytorch stable' if: ${{ inputs.os == 'linux' && inputs.torch_version == 'stable' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} - CUDA_VERSION: ${{ inputs.cuda_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} - conda install pytorch torchvision torchaudio pytorch-cuda=${CUDA_VERSION} -c pytorch -c nvidia + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} + conda install pytorch torchvision torchaudio pytorch-cuda=${{ inputs.cuda_version}} -c pytorch -c nvidia - name: '[Unix] Install Pytorch specific version' if: ${{ inputs.os == 'macos' && inputs.torch_version == 'specific' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} echo "Run specific torch install command" ${{ inputs.specific_torch_install }} - name: '[Unix] Install dependencies' if: ${{ inputs.os != 'windows' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} which pip pip install -r requirements.txt pip install -U comfy-cli @@ -182,11 +160,8 @@ runs: - name: '[Unix] Check conda environment' if: ${{ inputs.os != 'windows' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} which python echo "#### Python Version ####" python --version @@ -199,75 +174,46 @@ runs: - name: '[Unix] Download models' if: ${{ inputs.os != 'windows' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} - cd $GITHUB_ACTION_PATH + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} + cd ${{ github.action_path }} which pip pip install -r requirements.txt echo "will run default-models prep" python default-models-prep.py --cache-directory ~/.cache/comfy-actions-runner/modelcache --live-directory "$GITHUB_WORKSPACE/models" echo "default-models-prep done, will copy workflow images" - cp -r "$GITHUB_ACTION_PATH"/workflow-images/* "$GITHUB_WORKSPACE/input" + cp -r "${{ github.action_path }}"/workflow-images/* "$GITHUB_WORKSPACE/input" echo "workflow images copied" - name: '[Unix] Run ComfyUI quick test' if: ${{ inputs.os != 'windows' && inputs.skip_quick_ci != 'true' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} python3 main.py --quick-test-for-ci - name: '[Unix] Run ComfyUI' if: ${{ inputs.os != 'windows' }} shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} python3 main.py ${{inputs.comfyui_flags}} > application.log 2>&1 & - name: '[Unix] Check if the server is running' if: ${{ inputs.os != 'windows' }} - shell: bash -el {0} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} - cd $GITHUB_ACTION_PATH + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} + cd ${{ github.action_path }} python3 poll_server_start.py > application.log 2>&1 + shell: bash -el {0} - name: '[Unix] Get Details and Run Python Action' id: unix_action if: ${{ inputs.os != 'windows' }} shell: bash -el {0} - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_ACTION_PATH: ${{ github.action_path }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_JOB: ${{ github.job }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} - INPUT_OS: ${{ inputs.os }} - INPUT_PYTHON_VERSION: ${{ inputs.python_version }} - INPUT_TORCH_VERSION: ${{ inputs.torch_version }} - INPUT_CUDA_VERSION: ${{ inputs.cuda_version }} - INPUT_WORKFLOW_NAME: ${{ inputs.workflow_name }} - INPUT_COMFYUI_FLAGS: ${{ inputs.comfyui_flags }} - INPUT_GCS_BUCKET_NAME: ${{ inputs.gcs_bucket_name }} - INPUT_OUTPUT_PREFIX: ${{ inputs.output_prefix }} - INPUT_API_ENDPOINT: ${{ inputs.api_endpoint }} - INPUT_USE_PRIOR_COMMIT: ${{ inputs.use_prior_commit }} run: | - conda activate gha-comfyui-${PYTHON_VERSION}-${TORCH_VERSION} - if [ "${INPUT_USE_PRIOR_COMMIT}" == "true" ]; then + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} + if [ "${{ inputs.use_prior_commit }}" == "true" ]; then COMMIT_HASH=$(git rev-parse HEAD^) else COMMIT_HASH=$(git rev-parse HEAD) @@ -275,8 +221,8 @@ runs: echo "Commit time: $TIMESTAMP" echo "Commit title: $MESSAGE" echo "Commit hash: $COMMIT_HASH" - BRANCH_NAME="${GITHUB_REF_NAME}" - PRNUMBER="${GITHUB_EVENT_PULL_REQUEST_NUMBER}" + BRANCH_NAME="${{ github.ref_name }}" + PRNUMBER="${{ github.event.pull_request.number }}" if [ -n "$PRNUMBER" ]; then BRANCH_NAME="$PRNUMBER/merge" git fetch origin pull/$PRNUMBER/head @@ -286,85 +232,56 @@ runs: TIMESTAMP=$(git show -s --format=%cI $COMMIT_HASH) MESSAGE=$(git show -s --format=%s $COMMIT_HASH) - cd $GITHUB_ACTION_PATH - echo "Running workflows: ${INPUT_WORKFLOW_NAMES}" + cd ${{ github.action_path }} + echo "Running workflows: ${{ inputs.workflow_filenames }}" python3 action.py \ - --comfy-workflow-names ${INPUT_WORKFLOW_NAMES} \ - --github-action-workflow-name "$GITHUB_WORKFLOW" \ - --os "${INPUT_OS}" \ - --run-id "$GITHUB_RUN_ID" \ - --job-id "$GITHUB_JOB" \ - --job-trigger-user "$GITHUB_ACTOR" \ - --gsc-bucket-name "${INPUT_GCS_BUCKET_NAME}" \ - --workspace-path "$GITHUB_WORKSPACE" \ - --output-file-prefix "${INPUT_OUTPUT_PREFIX}" \ - --repo "$GITHUB_REPOSITORY" \ - --comfy-run-flags "'${INPUT_COMFYUI_FLAGS}'" \ - --python-version "${PYTHON_VERSION}" \ - --torch-version "${TORCH_VERSION}" \ - --cuda-version "${CUDA_VERSION}" \ + --comfy-workflow-names ${{ inputs.workflow_filenames }} \ + --github-action-workflow-name "${{ github.workflow }}" \ + --os "${{ inputs.os }}" \ + --run-id "${{ github.run_id }}" \ + --job-id "${{ github.job }}" \ + --job-trigger-user "${{ github.actor }}" \ + --gsc-bucket-name "${{ inputs.gcs_bucket_name }}" \ + --workspace-path "${{ github.workspace }}" \ + --output-file-prefix ${{ inputs.output_prefix }} \ + --repo "${{ github.repository }}" \ + --comfy-run-flags "'${{ inputs.comfyui_flags }}'" \ + --python-version "${{ inputs.python_version }}" \ + --torch-version "${{ inputs.torch_version }}" \ + --cuda-version "${{ inputs.cuda_version }}" \ --commit-hash "$COMMIT_HASH" \ --commit-time "$TIMESTAMP" \ --commit-message "$MESSAGE" \ --branch-name "$BRANCH_NAME" \ - --api-endpoint "${INPUT_API_ENDPOINT}" + --api-endpoint "${{ inputs.api_endpoint }}" - name: '[Unix] Upload Output Files' uses: actions/upload-artifact@v4 if: ${{ inputs.os != 'windows' && ( success() || failure() ) }} - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_ACTION_PATH: ${{ github.action_path }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_JOB: ${{ github.job }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} - INPUT_OS: ${{ inputs.os }} - INPUT_PYTHON_VERSION: ${{ inputs.python_version }} - INPUT_TORCH_VERSION: ${{ inputs.torch_version }} with: - name: output-files-${GITHUB_JOB}-${INPUT_OS}-${INPUT_PYTHON_VERSION}-${CUDA_VERSION}-${TORCH_VERSION}-${WORKFLOW_NAME}-run${GITHUB_RUN_ID} - path: $GITHUB_WORKSPACE/output/** + name: output-files-${{ github.job }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }} + path: ${{ github.workspace }}/output/** - name: '[Unix] Upload log file to GCS' if: ${{ inputs.os != 'windows' && ( success() || failure() ) }} id: unix_upload-log-files uses: google-github-actions/upload-cloud-storage@v2 - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_ACTION_PATH: ${{ github.action_path }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_JOB: ${{ github.job }} - INPUT_OS: ${{ inputs.os }} - INPUT_PYTHON_VERSION: ${{ inputs.python_version }} - INPUT_TORCH_VERSION: ${{ inputs.torch_version }} - INPUT_CUDA_VERSION: ${{ inputs.cuda_version }} - INPUT_WORKFLOW_NAME: ${{ inputs.workflow_name }} - INPUT_GCS_BUCKET_NAME: ${{ inputs.gcs_bucket_name }} with: process_gcloudignore: false - path: $GITHUB_WORKSPACE/application.log - destination: ${INPUT_GCS_BUCKET_NAME}/logs/$GITHUB_JOB-${INPUT_OS}-${INPUT_PYTHON_VERSION}-${CUDA_VERSION}-${TORCH_VERSION}-${WORKFLOW_NAME}-run$GITHUB_RUN_ID + path: ${{ github.workspace }}/application.log + destination: ${{ inputs.gcs_bucket_name }}/logs/${{ github.job }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }} - name: '[Unix] Upload log file' if: ${{ inputs.os != 'windows' && ( success() || failure() ) }} uses: actions/upload-artifact@v4 - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_ACTION_PATH: ${{ github.action_path }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_JOB: ${{ github.job }} - INPUT_OS: ${{ inputs.os }} - INPUT_PYTHON_VERSION: ${{ inputs.python_version }} - INPUT_TORCH_VERSION: ${{ inputs.torch_version }} with: - name: app-logs-$GITHUB_JOB-${INPUT_OS}-${INPUT_PYTHON_VERSION}-${CUDA_VERSION}-${TORCH_VERSION}-${WORKFLOW_NAME}-run$GITHUB_RUN_ID - path: $GITHUB_WORKSPACE/application.log + name: app-logs-${{ github.job }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }} + path: ${{ github.workspace }}/application.log - name: '[Unix] Cleanup output files only' if: ${{ inputs.os != 'windows' && ( success() || failure() ) }} shell: bash -el {0} - run: rm -rf $GITHUB_WORKSPACE/* + run: rm -rf ${{ github.workspace }}/* ##################################################################################### @@ -398,81 +315,59 @@ runs: - name: '[Win] Setup Conda' uses: conda-incubator/setup-miniconda@v3.0.3 if: ${{ inputs.os == 'windows' }} - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} with: - activate-environment: gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + activate-environment: gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} miniconda-version: "latest" - python-version: $Env:PYTHON_VERSION + python-version: ${{ inputs.python_version }} continue-on-error: true # This step is created because the Conda setup step fails everytime. - name: '[Win-Only] Create Conda environment if not exists' if: ${{ inputs.os == 'windows' }} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - if (-not (conda env list | Select-String -Pattern "gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION")) { - conda create -n gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION python=$Env:PYTHON_VERSION -y + if (-not (conda env list | Select-String -Pattern "gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}")) { + conda create -n gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} python=${{ inputs.python_version }} -y } - name: '[Win-Only] Install Pytorch nightly' if: ${{ inputs.os == 'windows' && inputs.torch_version == 'nightly'}} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} Get-Command pip3 pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121 - name: '[Win-Only] Install Pytorch stable' if: ${{ inputs.os == 'windows' && inputs.torch_version =='stable' }} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} Get-Command pip3 pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 - name: '[Win] Install Pytorch specific version' if: ${{ inputs.os == 'windows' && inputs.torch_version == 'specific' }} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} Write-Output "Run specific torch install command" ${{ inputs.specific_torch_install }} - name: '[Win] Install dependencies' if: ${{ inputs.os == 'windows' }} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} pip install -r requirements.txt pip install -U comfy-cli conda install google-cloud-storage -y # This is because some fcking how, installing google-cloud-storage using pip has permission error on Windows using python 3.12 - name: "[Win] Check conda environment" if: ${{ inputs.os == 'windows' }} - shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} Get-Command python Write-Output "#### Python Version ####" python --version @@ -481,28 +376,23 @@ runs: Write-Output "#### Conda Info ####" conda info conda list + shell: powershell - name: '[Win] Download models' if: ${{ inputs.os == 'windows' }} - shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + 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" Copy-Item -Path "$Env:GITHUB_ACTION_PATH\workflow-images\*" -Destination "$Env:GITHUB_WORKSPACE\input" -Recurse + shell: powershell - name: '[Win] Run ComfyUI quick test' if: ${{ inputs.os == 'windows' && inputs.skip_quick_ci != 'true' }} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} python $Env:GITHUB_WORKSPACE/main.py --quick-test-for-ci Write-Output "(Temporary) fixing torch nightly bug" python $Env:GITHUB_WORKSPACE/fix_torch.py @@ -510,58 +400,34 @@ runs: - name: '[Win] Run ComfyUI' if: ${{ inputs.os == 'windows' }} shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | $envGithubWorkspace = $Env:GITHUB_WORKSPACE Write-Output "##############################" Write-Output $envGithubWorkspace Write-Output "##############################" - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION - Start-Process powershell -ArgumentList "-File", "$Env:GITHUB_ACTION_PATH\start-server.ps1", "-GITHUB_WORKSPACE", "`"$envGithubWorkspace`"", "-CondaEnv", "`"gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}`"", "-RunFlags", "`"${{ inputs.comfyui_flags}}`"" + 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 }}`"", "-RunFlags", "`"${{ inputs.comfyui_flags}}`"" - name: '[Win] Check if the server is running' if: ${{ inputs.os == 'windows' }} - shell: powershell - env: - PYTHON_VERSION: ${{ inputs.python_version }} - TORCH_VERSION: ${{ inputs.torch_version }} run: | cd $Env:GITHUB_ACTION_PATH - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} python poll_server_start.py + shell: powershell - name: '[Win] Get Details and Run Python Action' id: windows_action if: ${{ inputs.os == 'windows' }} shell: powershell - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_ACTION_PATH: ${{ github.action_path }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_JOB: ${{ github.job }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} - INPUT_OS: ${{ inputs.os }} - INPUT_PYTHON_VERSION: ${{ inputs.python_version }} - INPUT_TORCH_VERSION: ${{ inputs.torch_version }} - INPUT_CUDA_VERSION: ${{ inputs.cuda_version }} - INPUT_WORKFLOW_NAME: ${{ inputs.workflow_name }} - INPUT_COMFYUI_FLAGS: ${{ inputs.comfyui_flags }} - INPUT_GCS_BUCKET_NAME: ${{ inputs.gcs_bucket_name }} - INPUT_OUTPUT_PREFIX: ${{ inputs.output_prefix }} - INPUT_API_ENDPOINT: ${{ inputs.api_endpoint }} - INPUT_USE_PRIOR_COMMIT: ${{ inputs.use_prior_commit }} - run: | - if ( $Env:INPUT_USE_PRIOR_COMMIT -eq "true" ) { + if ( "${{ inputs.use_prior_commit }}" -eq "true" ) { $commit_hash = git rev-parse HEAD^ } else { $commit_hash = git rev-parse HEAD } - $branch_name = "$Env:GITHUB_REF_NAME" - $pr_number = "$Env:GITHUB_EVENT_PULL_REQUEST_NUMBER" + $branch_name = "${{ github.ref_name }}" + $pr_number = "${{ github.event.pull_request.number }}" if ( $pr_number -ne "" ) { $branch_name = "$pr_number/merge" git fetch origin pull/$pr_number/head @@ -574,52 +440,42 @@ runs: # Special cleanup/escape for variable names $branch_name = $branch_name -replace '"', '\"' $message = $message -replace '"', '\"' - $actor = "$Env:GITHUB_ACTOR" + $actor = "${{ github.actor }}" $actor = $actor -replace '"', '\"' cd $Env:GITHUB_ACTION_PATH - conda activate gha-comfyui-$Env:PYTHON_VERSION-$Env:TORCH_VERSION - Write-Host "Running workflows: $Env:INPUT_WORKFLOW_NAMES" + conda activate gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }} + Write-Host "Running workflows: ${{ inputs.workflow_filenames }}" python action.py ` - --comfy-workflow-names "$Env:INPUT_WORKFLOW_NAMES" ` - --github-action-workflow-name "$Env:GITHUB_WORKFLOW" ` - --os "$Env:INPUT_OS" ` - --run-id "$Env:GITHUB_RUN_ID" ` - --job-id "$Env:GITHUB_JOB" ` + --comfy-workflow-names "${{ inputs.workflow_filenames }}" ` + --github-action-workflow-name "${{ github.workflow }}" ` + --os "${{ inputs.os }}" ` + --run-id "${{ github.run_id }}" ` + --job-id "${{ github.job }}" ` --job-trigger-user $actor ` - --gsc-bucket-name "$Env:INPUT_GCS_BUCKET_NAME" ` - --workspace-path "$Env:GITHUB_WORKSPACE" ` - --output-file-prefix "$Env:INPUT_OUTPUT_PREFIX" ` - --repo "$Env:GITHUB_REPOSITORY" ` - --comfy-run-flags "$Env:INPUT_COMFYUI_FLAGS" ` - --python-version "$Env:INPUT_PYTHON_VERSION" ` - --torch-version "$Env:INPUT_TORCH_VERSION" ` - --cuda-version "$Env:INPUT_CUDA_VERSION" ` + --gsc-bucket-name "${{ inputs.gcs_bucket_name }}" ` + --workspace-path "${{ github.workspace }}" ` + --output-file-prefix "${{ inputs.output_prefix }}" ` + --repo "${{ github.repository }}" ` + --comfy-run-flags "'${{ inputs.comfyui_flags }}'" ` + --python-version "${{ inputs.python_version }}" ` + --torch-version "${{ inputs.torch_version }}" ` + --cuda-version "${{ inputs.cuda_version }}" ` --commit-hash "$commit_hash" ` --commit-time "$timestamp" ` --commit-message $message ` --branch-name $branch_name ` - --api-endpoint "$Env:INPUT_API_ENDPOINT" - (Get-ChildItem -Force -Path "$Env:GITHUB_WORKSPACE/output").FullName - cat "$Env:GITHUB_WORKSPACE/application.log" + --api-endpoint "${{ inputs.api_endpoint }}" + (Get-ChildItem -Force -Path "${{ github.workspace }}/output").FullName + cat "${{ github.workspace }}/application.log" # Note the Get-ChildItem mess is powershell for "ls -la" for debug - name: '[Win] Upload Output Files' uses: actions/upload-artifact@v4 if: ${{ inputs.os == 'windows' && ( success() || failure() ) }} - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_ACTION_PATH: ${{ github.action_path }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_JOB: ${{ github.job }} - INPUT_OS: ${{ inputs.os }} - INPUT_PYTHON_VERSION: ${{ inputs.python_version }} - INPUT_CUDA_VERSION: ${{ inputs.cuda_version }} - INPUT_TORCH_VERSION: ${{ inputs.torch_version }} - INPUT_WORKFLOW_NAME: ${{ inputs.workflow_name }} with: - name: output-files-$GITHUB_JOB-$Env:INPUT_OS-$Env:INPUT_PYTHON_VERSION-$Env:INPUT_CUDA_VERSION-$Env:INPUT_TORCH_VERSION-$Env:INPUT_WORKFLOW_NAME-run$GITHUB_RUN_ID - path: $Env:GITHUB_WORKSPACE/output/** + name: output-files-${{ github.job }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }} + path: ${{ github.workspace }}/output/** - name: '[Win] Upload log file to GCS' if: ${{ ( success() || failure() ) && inputs.os == 'windows'}} @@ -627,17 +483,17 @@ runs: uses: google-github-actions/upload-cloud-storage@v2 with: process_gcloudignore: false - path: $Env:GITHUB_WORKSPACE/application.log - destination: $Env:INPUT_GCS_BUCKET_NAME/logs/$GITHUB_JOB-$Env:INPUT_OS-$Env:INPUT_PYTHON_VERSION-$Env:INPUT_CUDA_VERSION-$Env:INPUT_TORCH_VERSION-$Env:INPUT_WORKFLOW_NAME-run$GITHUB_RUN_ID + path: ${{ github.workspace }}/application.log + destination: ${{ inputs.gcs_bucket_name }}/logs/${{ github.job }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }} - name: '[Win] Upload log file' uses: actions/upload-artifact@v4 if: ${{ inputs.os == 'windows' && ( success() || failure() ) }} with: - name: app-logs-$GITHUB_JOB-$Env:INPUT_OS-$Env:INPUT_PYTHON_VERSION-$Env:INPUT_CUDA_VERSION-$Env:INPUT_TORCH_VERSION-$Env:INPUT_WORKFLOW_NAME-run$GITHUB_RUN_ID - path: $Env:GITHUB_WORKSPACE/application.log + name: app-logs-${{ github.job }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }} + path: ${{ github.workspace }}/application.log - name: '[Win] Cleanup output files only' if: ${{ inputs.os == 'windows' && ( success() || failure() ) }} shell: powershell - run: Remove-Item -Path "$Env:GITHUB_WORKSPACE/output/*" -Recurse -Force + run: Remove-Item -Path "${{ github.workspace }}/output/*" -Recurse -Force