85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
# GitHub CI build pipeline
|
|
name: CI build
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
PYTHONIOENCODING: "utf8"
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.12"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Backup pyproject.toml
|
|
run: cp pyproject.toml pyproject.toml.ci.bak
|
|
|
|
- name: Strip tooltip entries from pyproject.toml for CI
|
|
run: |
|
|
# Remove `tooltip = ...` from [project] and drop [project.tooltip] section if present.
|
|
python - <<'PY'
|
|
from pathlib import Path
|
|
p = Path('pyproject.toml')
|
|
text = p.read_text()
|
|
out_lines = []
|
|
cur_section = None
|
|
skip_section = False
|
|
for line in text.splitlines():
|
|
s = line.strip()
|
|
if s.startswith('[') and s.endswith(']'):
|
|
cur_section = s.strip('[]')
|
|
# skip any subsection that starts with project.tooltip (or exact match)
|
|
if cur_section == 'project.tooltip' or cur_section.startswith('project.tooltip'):
|
|
skip_section = True
|
|
continue
|
|
else:
|
|
skip_section = False
|
|
if skip_section:
|
|
continue
|
|
# drop top-level tooltip = ... when inside [project]
|
|
if cur_section == 'project' and s and s.split('=')[0].strip() == 'tooltip':
|
|
continue
|
|
out_lines.append(line)
|
|
p.write_text('\n'.join(out_lines) + '\n')
|
|
PY
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.12
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install .[dev]
|
|
pip install -r requirements.txt
|
|
|
|
- name: Clone ComfyUI dependency
|
|
run: |
|
|
git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git ../ComfyUI-repo
|
|
cp -r ../ComfyUI-repo/* ../
|
|
python -m pip install -r ../ComfyUI-repo/requirements.txt
|
|
|
|
- name: Run Linting
|
|
run: |
|
|
ruff check .
|
|
|
|
- name: Run Tests
|
|
env:
|
|
PYTHONPATH: .
|
|
run: |
|
|
pytest tests/
|
|
|
|
- name: Restore original pyproject.toml
|
|
if: always()
|
|
run: mv pyproject.toml.ci.bak pyproject.toml
|