show_examples_timetaken #591
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: workflows-ci | |
on: | |
pull_request: | |
branches: | |
- master | |
permissions: | |
contents: read | |
pull-requests: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
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 | |
- name: Fetch target branch | |
run: | | |
git fetch origin ${{ github.base_ref }} --depth=1 | |
- name: Check modified files | |
id: check_files | |
run: | | |
modified_files=$(git diff --name-only origin/${{ github.base_ref }}...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' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
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/test_examples.py | |
env: | |
BIZYAIR_KEY: ${{ secrets.BIZYAIR_KEY }} | |
BIZYAIR_API_KEY: ${{ secrets.BIZYAIR_KEY }} | |
PYTHONPATH: ${{ github.workspace }}/ComfyUI | |
- name: Add PR review comment about the time taken to run the examples on Linux | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
const { pull_request } = context.payload; | |
const fs = require('fs'); | |
const timeTaken = fs.readFileSync('ComfyUI/custom_nodes/BizyAir/time_taken.txt', 'utf8'); | |
const comment = `The time taken by running the examples on Linux: \n${timeTaken}`; | |
await github.issues.createComment({ | |
issue_number: pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}) | |
- name: remove the time_taken.txt file | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
rm ComfyUI/custom_nodes/BizyAir/time_taken.txt | |
- 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/test_examples.py | |
env: | |
BIZYAIR_KEY: ${{ secrets.BIZYAIR_KEY }} | |
BIZYAIR_API_KEY: ${{ secrets.BIZYAIR_KEY }} | |
PYTHONPATH: ${{ github.workspace }}/ComfyUI | |
- name: Add PR review comment about the time taken to run the examples on Windows | |
if: matrix.os == 'windows-latest' | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
const { pull_request } = context.payload; | |
const fs = require('fs'); | |
const timeTaken = fs.readFileSync('ComfyUI/custom_nodes/BizyAir/time_taken.txt', 'utf8'); | |
const comment = `The time taken by running the examples on Windows: \n${timeTaken}`; | |
await github.issues.createComment({ | |
issue_number: pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}) | |
- name: remove the time_taken.txt file | |
if: matrix.os == 'windows-latest' | |
run: | | |
rm ComfyUI/custom_nodes/BizyAir/time_taken.txt |