Skip to content

Commit f5b483c

Browse files
committed
Add builder for cu128
1 parent cb21b67 commit f5b483c

34 files changed

+1421
-0
lines changed

.github/workflows/build-cu128.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Build & Upload CUDA 12.8 Package"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build_upload:
8+
permissions:
9+
contents: "write"
10+
packages: "write"
11+
pull-requests: "read"
12+
runs-on: windows-latest
13+
steps:
14+
- uses: actions/checkout@v5
15+
16+
- name: Stage 1 Gathering Dependencies
17+
shell: bash
18+
working-directory: builder-cu128
19+
run: bash stage1.sh
20+
21+
- name: Stage 2 Assembling Repositories
22+
shell: bash
23+
working-directory: builder-cu128
24+
run: bash stage2.sh
25+
26+
- name: Stage 3 Compressing Package
27+
shell: bash
28+
working-directory: builder-cu128
29+
run: bash stage3.sh
30+
31+
- name: Upload archive to release
32+
uses: xresloader/upload-to-github-release@v1
33+
env:
34+
# This is an always-on token in GitHub CI environment
35+
# You don't need to configure it
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
with:
38+
file: "builder-cu128/*.7z*;builder-cu128/*.zip*"
39+
# Always draft before release
40+
draft: true
41+
overwrite: true

builder-cu128/attachments/ExtraScripts/!Please copy these files to the parent folder first before using them

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"C:\Program Files\Git\bin\bash.exe" force-update-all.sh
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# You need to install Git for Windows and select Git Bash (Default)
3+
# https://git-scm.com/download/win
4+
5+
set -eu
6+
7+
# If you don't want a FORCE update, remove "git reset" line
8+
function git_pull () {
9+
git_remote_url=$(git -C "$1" remote get-url origin) ;
10+
11+
if [[ $git_remote_url =~ ^(https:\/\/github\.com\/)(.*)(\.git)$ ]]; then
12+
echo "Updating: $1" ;
13+
git -C "$1" reset --hard ;
14+
git -C "$1" pull --ff-only ;
15+
echo "Done Updating: $1" ;
16+
fi ;
17+
}
18+
19+
git_pull ComfyUI
20+
21+
cd ./ComfyUI/custom_nodes
22+
for D in *; do
23+
if [ -d "${D}" ]; then
24+
git_pull "${D}" &
25+
fi
26+
done
27+
28+
wait $(jobs -p)
29+
30+
exit 0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.\python_standalone\python.exe -s ComfyUI\main.py --cpu --windows-standalone-build
2+
pause
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@echo on
2+
setlocal
3+
4+
@REM If you don't want the browser to open automatically, add [ --disable-auto-launch ] after the last argument.
5+
set "EXTRA_ARGS=--disable-auto-launch"
6+
7+
@REM To set proxy, edit and uncomment the two lines below (remove 'rem ' in the beginning of line).
8+
rem set HTTP_PROXY=http://localhost:1080
9+
rem set HTTPS_PROXY=http://localhost:1080
10+
11+
@REM To set mirror site for PIP & HuggingFace Hub, uncomment and edit the two lines below.
12+
rem set PIP_INDEX_URL=https://mirrors.cernet.edu.cn/pypi/web/simple
13+
rem set HF_ENDPOINT=https://hf-mirror.com
14+
15+
@REM To set HuggingFace Access Token, uncomment and edit the line below.
16+
@REM https://huggingface.co/settings/tokens
17+
rem set HF_TOKEN=
18+
19+
@REM ==========================================================================
20+
@REM The following content generally does not require user modification.
21+
22+
@REM This command redirects HuggingFace-Hub to download model files in this folder.
23+
set HF_HUB_CACHE=%~dp0\HuggingFaceHub
24+
25+
@REM This command redirects Pytorch Hub to download model files in this folder.
26+
set TORCH_HOME=%~dp0\TorchHome
27+
28+
@REM This command will set PATH environment variable.
29+
set PATH=%PATH%;%~dp0\MinGit\cmd;%~dp0\python_standalone\Scripts
30+
31+
@REM This command will let the .pyc files to be stored in one place.
32+
set PYTHONPYCACHEPREFIX=%~dp0\pycache
33+
34+
.\python_standalone\python.exe -s ComfyUI\main.py --windows-standalone-build %EXTRA_ARGS%
35+
36+
endlocal
37+
pause
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
setlocal
2+
set PATH=%PATH%;%~dp0\MinGit\cmd;%~dp0\python_standalone\Scripts
3+
set PYTHONPYCACHEPREFIX=%~dp0\pycache
4+
.\python_standalone\python.exe -s force_updater.py
5+
endlocal
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
setlocal
2+
set PYTHONPYCACHEPREFIX=%~dp0\pycache
3+
.\python_standalone\python.exe -s launcher.py
4+
endlocal
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import os
2+
import re
3+
import sys
4+
import git
5+
from concurrent.futures import ThreadPoolExecutor
6+
from gooey import Gooey, GooeyParser
7+
8+
@Gooey(
9+
program_name="ComfyUI Force Update Tool", # Program name
10+
progress_regex=r"^Progress: (\d+)/(\d+)$", # Progress bar regex
11+
progress_expr="x[0] / x[1] * 100", # Progress bar expression
12+
disable_progress_bar_animation=True,
13+
timing_options={
14+
'show_time_remaining': True,
15+
},
16+
clear_before_run=True, # Clear console before running
17+
)
18+
def main():
19+
# Create Gooey argument parser
20+
parser = GooeyParser(
21+
description="Force update ComfyUI and its custom nodes.\n\n"
22+
"Note: The force update only handles Git repositories and does not manage Python dependencies.\n"
23+
"You may need to click 'Try Fix' in the Manager later to fix individual nodes."
24+
)
25+
26+
# Set default directories
27+
default_comfyui_dir = os.path.join(os.getcwd(), 'ComfyUI')
28+
default_custom_nodes_dir = os.path.join(os.getcwd(), 'ComfyUI', 'custom_nodes')
29+
30+
parser.add_argument(
31+
'comfyui_dir', # Argument name
32+
metavar='ComfyUI Directory', # Display name
33+
help='Select the ComfyUI root directory', # Help message
34+
widget='DirChooser', # Use directory chooser
35+
default=default_comfyui_dir, # Default value
36+
)
37+
parser.add_argument(
38+
'custom_nodes_dir', # Argument name
39+
metavar='Custom Nodes Directory', # Display name
40+
help='Select the custom_nodes directory', # Help message
41+
widget='DirChooser', # Use directory chooser
42+
default=default_custom_nodes_dir, # Default value
43+
)
44+
args = parser.parse_args()
45+
46+
# Get the total number of folders in custom_nodes directory
47+
custom_nodes = [D for D in os.listdir(args.custom_nodes_dir) if os.path.isdir(os.path.join(args.custom_nodes_dir, D))]
48+
total_tasks = len(custom_nodes) + 1 # Include ComfyUI root directory
49+
completed_tasks = 0
50+
51+
# Update progress bar
52+
def update_progress():
53+
nonlocal completed_tasks
54+
completed_tasks += 1
55+
print(f"Progress: {completed_tasks}/{total_tasks}") # Gooey will update the progress bar based on this output
56+
sys.stdout.flush() # Force flush output to ensure Gooey captures the progress
57+
58+
# Update main repository
59+
try:
60+
git_pull(args.comfyui_dir)
61+
update_progress()
62+
except Exception as e:
63+
print(f"Error: {e}")
64+
sys.exit(1) # Terminate the program
65+
66+
# Update all subdirectories in custom_nodes directory
67+
with ThreadPoolExecutor() as executor:
68+
futures = []
69+
for D in custom_nodes:
70+
dir_path = os.path.join(args.custom_nodes_dir, D)
71+
futures.append(executor.submit(git_pull, dir_path))
72+
73+
# Wait for all tasks to complete
74+
for future in futures:
75+
try:
76+
future.result() # Get the task result; if there's an exception, it will be raised here
77+
update_progress()
78+
except Exception as e:
79+
print(f"Error: {e}")
80+
sys.exit(1) # Terminate the program
81+
82+
def git_pull(repo_path):
83+
try:
84+
repo = git.Repo(repo_path)
85+
git_remote_url = repo.remotes.origin.url
86+
87+
if re.match(r'^https:\/\/github\.com\/.*\.git$', git_remote_url):
88+
print(f"Updating: {repo_path}")
89+
repo.git.reset('--hard')
90+
repo.remotes.origin.pull()
91+
print(f"Done Updating: {repo_path}")
92+
except Exception as e:
93+
print(f"Error processing {repo_path}: {e}")
94+
raise # Re-raise the exception to be caught by the caller
95+
96+
if __name__ == "__main__":
97+
main()
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import os
2+
import re
3+
import sys
4+
import git
5+
from concurrent.futures import ThreadPoolExecutor
6+
from gooey import Gooey, GooeyParser
7+
8+
@Gooey(
9+
program_name="ComfyUI 强制更新工具", # 程序名称
10+
language='chinese',
11+
progress_regex=r"^进度: (\d+)/(\d+)$", # 进度条正则表达式
12+
progress_expr="x[0] / x[1] * 100", # 进度条显示格式
13+
disable_progress_bar_animation=True, # 禁用进度条动画
14+
timing_options={
15+
'show_time_remaining': True,
16+
},
17+
clear_before_run=True, # 运行前清空控制台
18+
)
19+
def main():
20+
# 创建 Gooey 参数解析器
21+
parser = GooeyParser(
22+
description="强制更新 ComfyUI 及其自定义节点,且将远程 GitHub 地址替换为国内镜像。\n\n"
23+
"提示:强制更新仅处理 Git 仓库, 不处理 Python 依赖包,\n"
24+
"后续可能需要在 Manager 中点击 Try Fix 修复个别节点。"
25+
)
26+
27+
# 添加镜像地址参数
28+
parser.add_argument(
29+
'mirror_url', # 参数名称
30+
metavar='镜像站点', # 参数显示名称
31+
help='用于访问 GitHub 的镜像/代理站点(例如:https://ghfast.top 或 https://gh-proxy.com)', # 帮助信息
32+
default='https://ghfast.top', # 设置默认值
33+
)
34+
35+
# 设置默认目录
36+
default_comfyui_dir = os.path.join(os.getcwd(), 'ComfyUI')
37+
default_custom_nodes_dir = os.path.join(os.getcwd(), 'ComfyUI', 'custom_nodes')
38+
39+
parser.add_argument(
40+
'comfyui_dir', # 参数名称
41+
metavar='ComfyUI 目录', # 参数显示名称
42+
help='选择 ComfyUI 根目录', # 帮助信息
43+
widget='DirChooser', # 使用目录选择器
44+
default=default_comfyui_dir, # 设置默认值
45+
)
46+
parser.add_argument(
47+
'custom_nodes_dir', # 参数名称
48+
metavar='自定义节点目录', # 参数显示名称
49+
help='选择 custom_nodes 目录', # 帮助信息
50+
widget='DirChooser', # 使用目录选择器
51+
default=default_custom_nodes_dir, # 设置默认值
52+
)
53+
args = parser.parse_args()
54+
55+
# 获取镜像地址
56+
mirror_url = args.mirror_url
57+
58+
# 获取 custom_nodes 目录下的文件夹总数
59+
custom_nodes = [D for D in os.listdir(args.custom_nodes_dir) if os.path.isdir(os.path.join(args.custom_nodes_dir, D))]
60+
total_tasks = len(custom_nodes) + 1 # 包括 ComfyUI 根目录
61+
completed_tasks = 0
62+
63+
# 更新进度条
64+
def update_progress():
65+
nonlocal completed_tasks
66+
completed_tasks += 1
67+
print(f"进度: {completed_tasks}/{total_tasks}") # Gooey 会根据正则表达式更新进度条
68+
sys.stdout.flush() # 强制刷新输出,确保 Gooey 捕获到进度信息
69+
70+
# 更新主仓库
71+
try:
72+
print(f"ComfyUI 根目录: {args.comfyui_dir}")
73+
print(f"custom_nodes 目录: {args.custom_nodes_dir}")
74+
set_url_and_pull(args.comfyui_dir, mirror_url)
75+
update_progress()
76+
except Exception as e:
77+
print(f"错误: {e}")
78+
sys.exit(1) # 终止程序
79+
80+
# 更新 custom_nodes 目录下的所有子目录
81+
with ThreadPoolExecutor() as executor:
82+
futures = []
83+
for D in custom_nodes:
84+
dir_path = os.path.join(args.custom_nodes_dir, D)
85+
futures.append(executor.submit(set_url_and_pull, dir_path, mirror_url))
86+
87+
# 等待所有任务完成
88+
for future in futures:
89+
try:
90+
future.result() # 获取任务结果,如果任务中有异常会抛出
91+
update_progress()
92+
except Exception as e:
93+
print(f"错误: {e}")
94+
sys.exit(1) # 终止程序
95+
96+
def set_url_and_pull(repo_path, mirror_url):
97+
try:
98+
repo = git.Repo(repo_path)
99+
git_remote_url = repo.remotes.origin.url
100+
101+
# 提取文件夹名称
102+
repo_foldername = os.path.basename(repo_path)
103+
104+
# 确保 URL 以 .git 结尾
105+
if not git_remote_url.endswith('.git'):
106+
print(f"忽略 {repo_foldername} ,非标准 Git 仓库(仓库地址不以 .git 结尾): {git_remote_url}")
107+
return
108+
109+
# 1. 直接下载:如果 remote URL 以 mirror_url 开头,则直接 pull
110+
if git_remote_url.startswith(f'{mirror_url}/'):
111+
print(f"正在更新: {repo_foldername}")
112+
repo.git.reset('--hard')
113+
repo.remotes.origin.pull()
114+
print(f"更新完成: {repo_foldername}")
115+
# 2. 添加镜像(代理):如果 remote URL 以 https://github.com/ 开头,则在开头添加 mirror_url
116+
elif git_remote_url.startswith('https://github.com/'):
117+
print(f"正在修改 GitHub URL 并更新: {repo_foldername}")
118+
new_url = f'{mirror_url}/{git_remote_url}'
119+
repo.git.reset('--hard')
120+
repo.remotes.origin.set_url(new_url)
121+
repo.remotes.origin.pull()
122+
print(f"更新完成: {repo_foldername}")
123+
# 3. 替换镜像(代理):如果 remote URL 包含 /https://github.com/,则替换镜像站点
124+
elif '/https://github.com/' in git_remote_url:
125+
print(f"正在修改镜像 URL 并更新: {repo_foldername}")
126+
# 提取 https://github.com/ 之后的部分
127+
github_part = git_remote_url.split('/https://github.com/')[1]
128+
new_url = f'{mirror_url}/https://github.com/{github_part}'
129+
repo.git.reset('--hard')
130+
repo.remotes.origin.set_url(new_url)
131+
repo.remotes.origin.pull()
132+
print(f"更新完成: {repo_foldername}")
133+
else:
134+
print(f"忽略 {repo_foldername},未知 URL 格式的仓库: {git_remote_url}")
135+
except Exception as e:
136+
print(f"处理 {repo_foldername} 时出错: {e}")
137+
raise # 重新抛出异常,让上层捕获并终止程序
138+
139+
if __name__ == "__main__":
140+
main()

0 commit comments

Comments
 (0)