Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 65e48cd

Browse files
committed
feat: add codesign for macos
1 parent 75cafe6 commit 65e48cd

File tree

1 file changed

+68
-56
lines changed

1 file changed

+68
-56
lines changed

.github/workflows/python-package.yml

Lines changed: 68 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Package Python Library
22

33
on:
44
push:
5-
branches: [ feat/python-package-ci ]
5+
branches: [ feat/codesign-python-package ]
66
workflow_dispatch:
77
inputs:
88
model_dir:
@@ -25,9 +25,9 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
include:
28-
- os: "linux"
29-
name: "amd64"
30-
runs-on: "ubuntu-20-04-cuda-12-0"
28+
# - os: "linux"
29+
# name: "amd64"
30+
# runs-on: "ubuntu-20-04-cuda-12-0"
3131
- os: "mac"
3232
name: "amd64"
3333
runs-on: "macos-selfhosted-12"
@@ -46,81 +46,56 @@ jobs:
4646
repository: janhq/models
4747
ref: "feat/ci-python-models"
4848

49-
# - name: Install Miniconda on Linux
50-
# if: runner.os == 'Linux'
51-
# run: |
52-
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
53-
# bash miniconda.sh -b -p $HOME/miniconda
54-
# echo "$HOME/miniconda/bin" >> $GITHUB_PATH
55-
56-
# - name: Install Miniconda on macOS
57-
# if: runner.os == 'macOS'
58-
# run: |
59-
# if [ "$(uname -m)" = "arm64" ]; then
60-
# echo "Running on macOS ARM"
61-
# MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh"
62-
# else
63-
# echo "Running on macOS Intel"
64-
# MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
65-
# fi
66-
# echo "Downloading Miniconda from $MINICONDA_URL"
67-
# curl -L $MINICONDA_URL -o miniconda.sh
68-
# bash miniconda.sh -b -p $HOME/miniconda
69-
# echo "$HOME/miniconda/bin" >> $GITHUB_PATH
70-
71-
# - name: Install Miniconda on Windows
72-
# if: runner.os == 'Windows'
73-
# shell: pwsh
74-
# run: |
75-
# $minicondaUrl = 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe'
76-
# Invoke-WebRequest -Uri $minicondaUrl -OutFile miniconda.exe
77-
# Start-Process -FilePath miniconda.exe -ArgumentList '/InstallationType=JustMe', '/AddToPath=1', '/RegisterPython=0', '/S', ('/D=Miniconda3') -Wait
78-
# echo "$env:USERPROFILE\\Miniconda3" >> $GITHUB_PATH
49+
- uses: conda-incubator/setup-miniconda@v3
50+
with:
51+
auto-update-conda: true
52+
python-version: 3.11
53+
7954
- name: Install dependencies Windows
8055
if: runner.os == 'windows'
8156
run: |
82-
Miniconda\_conda.exe init
83-
conda create -y -n ${{env.MODEL_NAME}} python=3.11
84-
85-
conda activate ${{env.MODEL_NAME}}
86-
python -m pip install --upgrade pip
87-
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
57+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
58+
source $HOME/miniconda/bin/activate base
59+
conda init
60+
conda activate ${{env.MODEL_NAME}}
61+
python -m pip install --upgrade pip
62+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
8863
8964
- name: Install dependencies Linux
9065
if: runner.os == 'linux'
9166
run: |
92-
export PATH=$PATH:$HOME/miniconda/bin/
93-
conda init
94-
conda create -y -n ${{env.MODEL_NAME}} python=3.11
95-
source $HOME/miniconda/bin/activate base
96-
conda activate ${{env.MODEL_NAME}}
97-
python -m pip install --upgrade pip
98-
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
67+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
68+
source $HOME/miniconda/bin/activate base
69+
conda init
70+
conda activate ${{env.MODEL_NAME}}
71+
python -m pip install --upgrade pip
72+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
9973
10074
- name: Install dependencies Mac
10175
if: runner.os == 'macOS'
10276
run: |
103-
export PATH=$PATH:$HOME/miniconda/bin/
104-
conda init
105-
conda create -y -n ${{env.MODEL_NAME}} python=3.11
106-
source $HOME/miniconda/bin/activate base
107-
conda activate ${{env.MODEL_NAME}}
108-
python -m pip install --upgrade pip
109-
python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
77+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
78+
source $HOME/miniconda/bin/activate base
79+
conda init
80+
conda activate ${{env.MODEL_NAME}}
81+
python -m pip install --upgrade pip
82+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
11083
11184
- name: prepare python package windows
11285
if : runner.os == 'windows'
11386
shell: cmd
11487
run: |
88+
source $HOME/miniconda/bin/activate base
89+
conda init
11590
conda activate ${{env.MODEL_NAME}}
11691
for /f "delims=" %%a in ('where python') do set "PYTHON_PATH=%%a"
11792
echo %PYTHON_PATH%
11893
11994
- name: prepare python package unix
12095
if : runner.os != 'windows'
12196
run: |
122-
export PATH=$PATH:$HOME/miniconda/bin/
12397
source $HOME/miniconda/bin/activate base
98+
conda init
12499
conda activate ${{env.MODEL_NAME}}
125100
PYTHON_PATH=$(which python)
126101
echo $PYTHON_PATH
@@ -133,4 +108,41 @@ jobs:
133108
uses: actions/upload-artifact@v4
134109
with:
135110
name: ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
136-
path: ${{env.PYTHON_FOLDER}}
111+
path: ${{env.PYTHON_FOLDER}}
112+
113+
codesign:
114+
runs-on: macos-latest
115+
needs: build-and-test
116+
steps:
117+
- name: checkout
118+
uses: actions/checkout@v3
119+
- uses: apple-actions/import-codesign-certs@v2
120+
continue-on-error: true
121+
with:
122+
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
123+
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
124+
- name: Download Artifact
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: ${{env.MODEL_NAME}}-mac-amd64
128+
path: ${{env.MODEL_NAME}}-mac-amd64
129+
- name: Download Artifact
130+
uses: actions/download-artifact@v4
131+
with:
132+
name: ${{env.MODEL_NAME}}-mac-arm64
133+
path: ${{env.MODEL_NAME}}-mac-arm64
134+
135+
- run: |
136+
find "${{env.MODEL_NAME}}-mac-amd64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
137+
find "${{env.MODEL_NAME}}-mac-arm64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
138+
139+
- name: Upload Artifact
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: ${{env.MODEL_NAME}}-mac-amd64-signed
143+
path: ${{env.MODEL_NAME}}-mac-amd64
144+
- name: Upload Artifact
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: ${{env.MODEL_NAME}}-mac-arm64-signed
148+
path: ${{env.MODEL_NAME}}-mac-arm64

0 commit comments

Comments
 (0)