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

Commit 3f250e9

Browse files
committed
feat: add codesign for macos
1 parent 75cafe6 commit 3f250e9

File tree

1 file changed

+65
-57
lines changed

1 file changed

+65
-57
lines changed

.github/workflows/python-package.yml

Lines changed: 65 additions & 57 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,52 @@ 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+
conda init
59+
conda activate ${{env.MODEL_NAME}}
60+
python -m pip install --upgrade pip
61+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
8862
8963
- name: Install dependencies Linux
9064
if: runner.os == 'linux'
9165
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
66+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
67+
conda init
68+
conda activate ${{env.MODEL_NAME}}
69+
python -m pip install --upgrade pip
70+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
9971
10072
- name: Install dependencies Mac
10173
if: runner.os == 'macOS'
10274
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
75+
export PATH=$PATH:$HOME/miniconda/bin/
76+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
77+
conda init
78+
conda activate ${{env.MODEL_NAME}}
79+
python -m pip install --upgrade pip
80+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
11081
11182
- name: prepare python package windows
11283
if : runner.os == 'windows'
11384
shell: cmd
11485
run: |
86+
conda init
11587
conda activate ${{env.MODEL_NAME}}
11688
for /f "delims=" %%a in ('where python') do set "PYTHON_PATH=%%a"
11789
echo %PYTHON_PATH%
11890
11991
- name: prepare python package unix
12092
if : runner.os != 'windows'
12193
run: |
122-
export PATH=$PATH:$HOME/miniconda/bin/
123-
source $HOME/miniconda/bin/activate base
94+
conda init
12495
conda activate ${{env.MODEL_NAME}}
12596
PYTHON_PATH=$(which python)
12697
echo $PYTHON_PATH
@@ -133,4 +104,41 @@ jobs:
133104
uses: actions/upload-artifact@v4
134105
with:
135106
name: ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
136-
path: ${{env.PYTHON_FOLDER}}
107+
path: ${{env.PYTHON_FOLDER}}
108+
109+
codesign:
110+
runs-on: macos-latest
111+
needs: build-and-test
112+
steps:
113+
- name: checkout
114+
uses: actions/checkout@v3
115+
- uses: apple-actions/import-codesign-certs@v2
116+
continue-on-error: true
117+
with:
118+
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
119+
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
120+
- name: Download Artifact
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: ${{env.MODEL_NAME}}-mac-amd64
124+
path: ${{env.MODEL_NAME}}-mac-amd64
125+
- name: Download Artifact
126+
uses: actions/download-artifact@v4
127+
with:
128+
name: ${{env.MODEL_NAME}}-mac-arm64
129+
path: ${{env.MODEL_NAME}}-mac-arm64
130+
131+
- run: |
132+
find "${{env.MODEL_NAME}}-mac-amd64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
133+
find "${{env.MODEL_NAME}}-mac-arm64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
134+
135+
- name: Upload Artifact
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: ${{env.MODEL_NAME}}-mac-amd64-signed
139+
path: ${{env.MODEL_NAME}}-mac-amd64
140+
- name: Upload Artifact
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: ${{env.MODEL_NAME}}-mac-arm64-signed
144+
path: ${{env.MODEL_NAME}}-mac-arm64

0 commit comments

Comments
 (0)