Skip to content

Commit

Permalink
feat: add codesign for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
hiento09 committed Dec 9, 2024
1 parent 6525313 commit 7af1352
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: "macos-selfhosted-12"
- os: "mac"
name: "arm64"
runs-on: "macos-13-arm"
runs-on: "macos-silicon"
# - os: "windows"
# name: "amd64"
# runs-on: "windows-cuda-12-0"
Expand Down Expand Up @@ -148,13 +148,56 @@ jobs:
echo "PYTHON_FOLDER=$PYTHON_FOLDER" >> $GITHUB_ENV
echo "github end PYTHON_FOLDER: ${{env.PYTHON_FOLDER}}"
- name: create plist file
if: runner.os == 'macOS'
run: |
cat << EOF > /tmp/entitlements.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- These are required for binaries built by PyInstaller -->
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<!-- Add these for additional permissions -->
<key>com.apple.security.app-sandbox</key>
<false/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.microphone</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.allow-executable-memory</key>
<true/>
</dict>
</plist>
EOF
- name: Notary macOS Binary
if: runner.os == 'macOS'
run: |
codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime ${{env.PYTHON_FOLDER}}/bin/python
codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime ${{env.PYTHON_FOLDER}}/bin/python3
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b /usr/local/bin
cd engine/cortex
codesign --force --entitlements="/tmp/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime ${{env.PYTHON_FOLDER}}/bin/python
codesign --force --entitlements="/tmp/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime ${{env.PYTHON_FOLDER}}/bin/python3
# Code sign all .so files and .dylib files
find ${{env.PYTHON_FOLDER}} -type f \( -name "*.so" \) -exec codesign --deep --force --entitlements="/tmp/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" {} \;
find ${{env.PYTHON_FOLDER}} -type f \( -name "*.dylib" \) -exec codesign --deep --force -s "${{ secrets.DEVELOPER_ID }}" {} \;
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sudo sh -s -- -b /usr/local/bin
# Notarize the binary
quill notarize ${{env.PYTHON_FOLDER}}/bin/python
quill notarize ${{env.PYTHON_FOLDER}}/bin/python3
Expand Down

0 comments on commit 7af1352

Please sign in to comment.