Skip to content

Commit

Permalink
Fix env issue with unrecognized named-value github
Browse files Browse the repository at this point in the history
  • Loading branch information
yoland68 committed Dec 9, 2024
1 parent e99e8b1 commit 32c2a4d
Showing 1 changed file with 116 additions and 37 deletions.
153 changes: 116 additions & 37 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ inputs:
description: "Skip quickci."
required: false
default: "true"
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 }}

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -119,56 +113,80 @@ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
#conda install pytorch torchvision torchaudio pytorch-cuda=${{ inputs.cuda_version }} -c pytorch-nightly -c nvidia
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
#conda install pytorch torchvision torchaudio pytorch-cuda=${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda install pytorch torchvision torchaudio pytorch-cuda=${{ inputs.cuda_version}} -c pytorch -c nvidia
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
conda install pytorch torchvision torchaudio pytorch-cuda=${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
which pip
pip install -r requirements.txt
pip install -U comfy-cli
- 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
which python
echo "#### Python Version ####"
python --version
Expand All @@ -181,8 +199,11 @@ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
cd $GITHUB_ACTION_PATH
which pip
pip install -r requirements.txt
Expand All @@ -195,21 +216,31 @@ runs:
- 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ 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-${{ inputs.python_version }}-${{ inputs.torch_version }}
conda activate gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
cd $GITHUB_ACTION_PATH
python3 poll_server_start.py > application.log 2>&1
shell: bash -el {0}
Expand All @@ -218,9 +249,26 @@ runs:
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-${{ inputs.python_version }}-${{ inputs.torch_version }}
if [ "${{ inputs.use_prior_commit }}" == "true" ]; then
conda activate gha-comfyui-${{ INPUT_PYTHON_VERSION }}-${{ INPUT_TORCH_VERSION }}
if [ "${{ INPUT_USE_PRIOR_COMMIT }}" == "true" ]; then
COMMIT_HASH=$(git rev-parse HEAD^)
else
COMMIT_HASH=$(git rev-parse HEAD)
Expand All @@ -240,49 +288,77 @@ runs:
MESSAGE=$(git show -s --format=%s $COMMIT_HASH)
cd $GITHUB_ACTION_PATH
echo "Running workflows: ${{ inputs.workflow_filenames }}"
echo "Running workflows: ${{ INPUT_WORKFLOW_NAMES }}"
python3 action.py \
--comfy-workflow-names ${{ inputs.workflow_filenames }} \
--comfy-workflow-names ${{ INPUT_WORKFLOW_NAMES }} \
--github-action-workflow-name "$GITHUB_WORKFLOW" \
--os "${{ inputs.os }}" \
--os "${{ INPUT_OS }}" \
--run-id "$GITHUB_RUN_ID" \
--job-id "$GITHUB_JOB" \
--job-trigger-user "$GITHUB_ACTOR" \
--gsc-bucket-name "${{ inputs.gcs_bucket_name }}" \
--gsc-bucket-name "${{ INPUT_GCS_BUCKET_NAME }}" \
--workspace-path "$GITHUB_WORKSPACE" \
--output-file-prefix ${{ inputs.output_prefix }} \
--output-file-prefix ${{ INPUT_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 }}" \
--comfy-run-flags "'${{ INPUT_COMFYUI_FLAGS }}'" \
--python-version "${{ INPUT_PYTHON_VERSION }}" \
--torch-version "${{ INPUT_TORCH_VERSION }}" \
--cuda-version "${{ INPUT_CUDA_VERSION }}" \
--commit-hash "$COMMIT_HASH" \
--commit-time "$TIMESTAMP" \
--commit-message "$MESSAGE" \
--branch-name "$BRANCH_NAME" \
--api-endpoint "${{ inputs.api_endpoint }}"
--api-endpoint "${{ INPUT_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 }}-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run${{ github.run_id }}
name: output-files-${{ GITHUB_JOB }}-${{ INPUT_OS }}-${{ INPUT_PYTHON_VERSION }}-${{ inputs.cuda_version }}-${{ INPUT_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 }}
with:
process_gcloudignore: false
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
destination: ${{ INPUT_GCS_BUCKET_NAME }}/logs/$GITHUB_JOB-${{ INPUT_OS }}-${{ INPUT_PYTHON_VERSION }}-${{ INPUT_CUDA_VERSION }}-${{ INPUT_TORCH_VERSION }}-${{ INPUT_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-${{ inputs.os }}-${{ inputs.python_version }}-${{ inputs.cuda_version }}-${{ inputs.torch_version }}-${{ inputs.workflow_name }}-run$GITHUB_RUN_ID
name: app-logs-$GITHUB_JOB-${{ INPUT_OS }}-${{ INPUT_PYTHON_VERSION }}-${{ INPUT_CUDA_VERSION }}-${{ INPUT_TORCH_VERSION }}-${{ INPUT_WORKFLOW_NAME }}-run$GITHUB_RUN_ID
path: $GITHUB_WORKSPACE/application.log

- name: '[Unix] Cleanup output files only'
Expand Down Expand Up @@ -322,10 +398,13 @@ runs:
- name: '[Win] Setup Conda'
uses: conda-incubator/[email protected]
if: ${{ inputs.os == 'windows' }}
env:
PYTHON_VERSION: ${{ inputs.python_version }}
TORCH_VERSION: ${{ inputs.torch_version }}
with:
activate-environment: gha-comfyui-${{ inputs.python_version }}-${{ inputs.torch_version }}
activate-environment: gha-comfyui-${{ PYTHON_VERSION }}-${{ TORCH_VERSION }}
miniconda-version: "latest"
python-version: ${{ inputs.python_version }}
python-version: ${{ PYTHON_VERSION }}
continue-on-error: true

# This step is created because the Conda setup step fails everytime.
Expand Down

0 comments on commit 32c2a4d

Please sign in to comment.