Skip to content

Commit

Permalink
Comfy now builds and installs, Fixed issues with Mac Signing
Browse files Browse the repository at this point in the history
Comfy now installs and then packaged into electron 

fixed issues with code signing, there were too many files and the runner was choking on it. There is a PR request to fix this issue on osx-sign but has not been merged. For now use that function as a shim and place it inside of node_modules.
  • Loading branch information
robinjhuang authored Sep 3, 2024
1 parent bac144b commit 9867264
Show file tree
Hide file tree
Showing 16 changed files with 14,764 additions and 7,465 deletions.
21 changes: 21 additions & 0 deletions .github/actions/build/macos/comfy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build Comfycli for Macos
description: Download, install, and set up Comfy
runs:
using: composite
steps:
name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Make Standalone
shell: sh
run: |
python -m pip install --upgrade pip
pip install comfy-cli
cd assets
comfy --skip-prompt --workspace ./ComfyUI install --fast-deps --m-series --skip-manager
comfy --workspace ./ComfyUI standalone --platform macos
comfy standalone --rehydrate
ls
# - name: Sign Wheels
# uses: ./.github/actions/build/macos/signwheel
20 changes: 20 additions & 0 deletions .github/actions/build/macos/signwheel/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sign Wheels
description: Unpack Sign Wheels and then RePack
runs:
using: composite
steps:
- name: Unpack
shell: sh
run: |
cd ./assets/python/wheels
find . -name '*.whl' -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \;
find . -name "*.whl" -type f -delete
- name: Gather and Sign
shell: sh
run: |
cd ./assets/python/wheels
find . -name "*so" -o -name "*.dylib" -print0 | while read -d $'\0' file; do codesign --sign 6698D856280DC1662A8E01E5B63428CB6D6651BB --force --timestamp --options runtime --entitlements ../../entitlements.mac.plist "$file"; done
- name: Repack
shell: sh
run: |
for i in */; do zip -r "${i%/}.whl" "$i"; done
40 changes: 14 additions & 26 deletions .github/actions/build/windows/app/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,32 @@ name: Windows Build App
description: Electron-Forge Build/Sign/publish
inputs:
DIGICERT_FINGERPRINT:
description: 'DigiCert SHA256 Fingerprint'
required: true
type: string
GITHUB_TOKEN:
description: 'GitHub Token'
required: true
type: string
sign-and-publish:
description: 'Sign the executable and publish to release page'
default: false
required: false
type: boolean
build-targets:
description: Override the default targets and build the passed targets. Comma separated list. Include '--target' and full names, eg '--targets=@electron-forge/maker-squirrel, ...etc'
required: false
default: ''
type: string
runs:
using: composite
steps:
- name: Use Node.js 20.x
uses: JP250552/setup-node@feature/corepack
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
corepack: true
- run: yarn install --immutable
node-version: 20
- run: yarn install
shell: cmd
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install ComfyUI and create standalone package
- name: Download and prepare ComfyUI
run: |
pip install comfy-cli
cd assets
comfy --skip-prompt --workspace ./ComfyUI install --fast-deps --nvidia --cuda-version 12.1
comfy --workspace ./ComfyUI standalone --platform windows --proc x86_64
rm -rf python cpython*.tar.gz
curl -L -o comfyui-win.7z https://github.com/Comfy-Org/python-dependencies/releases/download/embedded-windows-deps-cu11.8-py11.9-5/ComfyUI_windows_portable.7z
7z x comfyui-win.7z -odist/
move dist/ComfyUI_windows_portable/ComfyUI assets/UI/
move dist/ComfyUI_windows_portable/python_embedded assets/UI/
cd assets/UI/ComfyUI && ls
shell: cmd
- name: Make app
shell: powershell
Expand All @@ -48,14 +36,14 @@ runs:
DEBUG: electron-forge:*
PUBLISH: ${{ inputs.sign-and-publish }}
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: yarn run ${{inputs.sign-and-publish == true && 'publish' || 'make'}} -- ${{inputs.build-targets}}
run: npm run ${{inputs.sign-and-publish == true && 'publish' || 'make'}}
- name: Print SignLogs
if: ${{inputs.sign-and-publish == true && always()}}
continue-on-error: true
if: ${{inputs.sign-and-publish == true && always()}}
continue-on-error: true
shell: powershell
run: cd $HOME ; gc .signingmanager\logs\smksp.log
- name: verify signing
if: ${{inputs.sign-and-publish == true}}
run:
signtool verify /v /pa out/ComfyUI-win32-x64/ComfyUI.exe
shell: cmd
shell: cmd
4 changes: 2 additions & 2 deletions .github/actions/build/windows/certificate/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Certificate Setup
description: Sets up DigiCert and make it ready for signing
inputs:
inputes:
DIGICERT_AUTHENTICATION_CERTIFICATE_BASE64:
required: true
type: string
Expand Down Expand Up @@ -46,4 +46,4 @@ runs:
smksp_cert_sync.exe
- name: health check
shell: cmd
run: smctl healthcheck --user
run: smctl healthcheck --user
10 changes: 3 additions & 7 deletions .github/workflows/debug_windows.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: Build App Windows Debug
name: Build Windows Debug

on:
workflow_dispatch:
workflow_call:
push:
branches:
- rh-windows # just for testing

jobs:
build-windows-debug:
Expand All @@ -20,11 +17,10 @@ jobs:
- name: Build
uses: ./.github/actions/build/windows/app
with:
build-targets: '--targets=@electron-forge/maker-zip'
sign-and-publish: false
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: comfyui-electron-win32-debug-build-${{env.sha_short}}
path: out/make/zip/win32/x64/*.zip
name: comfyui-electron-debug-build-${{env.sha_short}}
path: out/make/zip/win32/x64/*.zip
24 changes: 16 additions & 8 deletions .github/workflows/publish_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,26 @@ jobs:
with:
node-version: 20
- run: npm i
- name: Download and prepare ComfyUI
- name: Make Comfy
uses: ./.github/actions/build/macos/comfy
- run: |
SIGN_ID=$(security find-identity -p codesigning -v | grep -E "Developer ID" | sed -n -e 's/.* "/"/p' | tr -d '""')
echo "SIGN_ID=$SIGN_ID" >> $GITHUB_ENV
sed -i '' 's/packageOpts.quiet = true/packageOpts.quiet = false/g' "node_modules/@electron-forge/core/dist/api/package.js"
- name: Sign Wheels
uses: ./.github/actions/build/macos/signwheel
- name: shim
run: |
curl -L -o comfyui-mac.tar.gz https://github.com/Comfy-Org/python-dependencies/releases/download/mac-arm-deps-py3.12-2024-08-16-050751/mac_arm_python_env.tar.gz
tar -xzvf comfyui-mac.tar.gz
rm -rf ComfyUI
mv dist/ComfyUI ./assets/UI/ComfyUIBackend
rm -rf comfyui-mac.tar.gz
chmod +x scripts/shim.sh && ./scripts/shim.sh
- name: Publish app
env:
DEBUG: electron-forge:*
DEBUG: electron-osx-sign*
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SIGN_ID: ${{env.SIGN_ID}}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: npm run publish -- --arch="x64","arm64"
run: npm run publish -- --arch="arm64"
- name: Check Notarization
run: |
spctl -a -vvv -t install "out/ComfyUI-darwin-arm64/ComfyUI.app"
1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

33 changes: 0 additions & 33 deletions README.md

This file was deleted.

2 changes: 2 additions & 0 deletions assets/entitlements.mac.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
6 changes: 4 additions & 2 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const config: ForgeConfig = {
},
}},
osxSign: {
identity: process.env.SIGN_ID,
optionsForFile: (filepath) => {
console.log('~');
return { entitlements: './assets/entitlements.mac.plist' };
},
}
},
extraResource: ['./assets/UI', './assets/ComfyUI', './assets/python.tgz'],
extraResource: ['./assets/UI', './assets/ComfyUI', process.platform === 'darwin' ? './assets/python' : './assets/python.tgz'],
osxNotarize: {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_PASSWORD,
Expand Down
Loading

0 comments on commit 9867264

Please sign in to comment.