* try fix * fix * override workflow json * uat wf json * official workflow run script * workflow test script * format * fix * fix * fix win encoding * format * replace old script * configurable page size --------- Co-authored-by: Yao Chi <later@usopp.net>
141 lines
4.6 KiB
YAML
141 lines
4.6 KiB
YAML
name: workflows-ci
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
description: 'The environment to deploy the workflow to'
|
|
required: true
|
|
default: 'uat'
|
|
branch:
|
|
description: 'The branch to checkout code from'
|
|
required: true
|
|
default: 'master'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.inputs.environment }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
test_script: test_official_workflows.py
|
|
target_branch: ${{ github.base_ref || 'master' }}
|
|
|
|
jobs:
|
|
check-modified-files:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
only_non_code_files: ${{ steps.check_files.outputs.only_non_code_files }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.head_ref || github.event.inputs.branch }}
|
|
|
|
- name: Fetch target branch
|
|
run: |
|
|
git fetch origin ${{ env.target_branch }} --depth=1
|
|
|
|
- name: Check modified files
|
|
id: check_files
|
|
run: |
|
|
modified_files=$(git diff --name-only origin/${{ env.target_branch }}...HEAD)
|
|
only_non_code_files=true
|
|
for file in $modified_files; do
|
|
if [[ "$file" == *.py ]] || [[ "$file" == *.js ]] || [[ "$file" == *.json ]] || [[ "$file" == *.yml ]]; then
|
|
only_non_code_files=false
|
|
break
|
|
fi
|
|
done
|
|
echo "only_non_code_files=$only_non_code_files" >> $GITHUB_OUTPUT
|
|
|
|
- name: Debug only_non_code_files
|
|
run: echo "only_non_code_files=${{ steps.check_files.outputs.only_non_code_files }}"
|
|
|
|
run-examples-workflows:
|
|
needs: check-modified-files
|
|
if: ${{ needs.check-modified-files.outputs.only_non_code_files == 'false' }} || ${{ github.event_name == 'workflow_dispatch' }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, ubuntu-latest]
|
|
environment: ${{ github.event.inputs.environment || 'prod' }}
|
|
|
|
steps:
|
|
- name: Show Base
|
|
run: |
|
|
echo "Current directory: $(pwd)"
|
|
|
|
- name: Checkout ComfyUI
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: comfyanonymous/ComfyUI
|
|
path: ComfyUI
|
|
ref: v0.3.7
|
|
|
|
- name: Checkout plugin repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: ComfyUI/custom_nodes/BizyAir
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Cache pip packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python3 -m pip install --upgrade pip
|
|
python3 -m pip install selenium pytest chromedriver-binary
|
|
python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
|
python3 -m pip install -r ComfyUI/requirements.txt
|
|
python3 -m pip install -r ComfyUI/custom_nodes/BizyAir/requirements.txt
|
|
python3 -m pip show torch
|
|
|
|
- name: Run ComfyUI on Linux
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
cd ComfyUI
|
|
nohup python main.py --port 8188 --cpu > >(tee -a service.log) 2>&1 &
|
|
|
|
cd custom_nodes/BizyAir
|
|
echo "Current directory: $(pwd)"
|
|
python3 tests/write_api_ini_file.py
|
|
python3 tests/${{ env.test_script }}
|
|
env:
|
|
BIZYAIR_KEY: ${{ secrets.BIZYAIR_KEY }}
|
|
BIZYAIR_API_KEY: ${{ secrets.BIZYAIR_KEY }}
|
|
BIZYAIR_SERVER_ADDRESS: ${{ vars.BIZYAIR_SERVER_ADDRESS }}
|
|
PYTHONPATH: ${{ github.workspace }}/ComfyUI
|
|
BIZYAIR_TEST_SKIP_WORKFLOW_IDS: ${{ vars.BIZYAIR_TEST_SKIP_WORKFLOW_IDS }}
|
|
BIZYAIR_OFFICIAL_WORKFLOW_MAX_TOTAL: ${{ vars.BIZYAIR_OFFICIAL_WORKFLOW_MAX_TOTAL }}
|
|
|
|
- name: Run ComfyUI on Windows
|
|
if: matrix.os == 'windows-latest'
|
|
run: |
|
|
cd ComfyUI
|
|
Start-Process -FilePath "python3" -ArgumentList "main.py --port 8188 --cpu" -NoNewWindow
|
|
cd custom_nodes/BizyAir
|
|
Write-Output "Current directory: $(Get-Location)"
|
|
python3 tests/write_api_ini_file.py
|
|
python3 tests/${{ env.test_script }}
|
|
env:
|
|
BIZYAIR_KEY: ${{ secrets.BIZYAIR_KEY }}
|
|
BIZYAIR_API_KEY: ${{ secrets.BIZYAIR_KEY }}
|
|
BIZYAIR_SERVER_ADDRESS: ${{ vars.BIZYAIR_SERVER_ADDRESS }}
|
|
PYTHONPATH: ${{ github.workspace }}/ComfyUI
|
|
PYTHONIOENCODING: utf-8
|
|
BIZYAIR_TEST_SKIP_WORKFLOW_IDS: ${{ vars.BIZYAIR_TEST_SKIP_WORKFLOW_IDS }}
|
|
BIZYAIR_OFFICIAL_WORKFLOW_MAX_TOTAL: ${{ vars.BIZYAIR_OFFICIAL_WORKFLOW_MAX_TOTAL }}
|