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

Commit b749499

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

File tree

1 file changed

+60
-57
lines changed

1 file changed

+60
-57
lines changed

.github/workflows/python-package.yml

Lines changed: 60 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,67 +46,35 @@ 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 activate ${{env.MODEL_NAME}}
59+
python -m pip install --upgrade pip
60+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
8861
8962
- name: Install dependencies Linux
9063
if: runner.os == 'linux'
9164
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
65+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
66+
conda activate ${{env.MODEL_NAME}}
67+
python -m pip install --upgrade pip
68+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
9969
10070
- name: Install dependencies Mac
10171
if: runner.os == 'macOS'
10272
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
73+
export PATH=$PATH:$HOME/miniconda/bin/
74+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
75+
conda activate ${{env.MODEL_NAME}}
76+
python -m pip install --upgrade pip
77+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
11078
11179
- name: prepare python package windows
11280
if : runner.os == 'windows'
@@ -119,8 +87,6 @@ jobs:
11987
- name: prepare python package unix
12088
if : runner.os != 'windows'
12189
run: |
122-
export PATH=$PATH:$HOME/miniconda/bin/
123-
source $HOME/miniconda/bin/activate base
12490
conda activate ${{env.MODEL_NAME}}
12591
PYTHON_PATH=$(which python)
12692
echo $PYTHON_PATH
@@ -133,4 +99,41 @@ jobs:
13399
uses: actions/upload-artifact@v4
134100
with:
135101
name: ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
136-
path: ${{env.PYTHON_FOLDER}}
102+
path: ${{env.PYTHON_FOLDER}}
103+
104+
codesign:
105+
runs-on: macos-latest
106+
needs: build-and-test
107+
steps:
108+
- name: checkout
109+
uses: actions/checkout@v3
110+
- uses: apple-actions/import-codesign-certs@v2
111+
continue-on-error: true
112+
with:
113+
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
114+
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
115+
- name: Download Artifact
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: ${{env.MODEL_NAME}}-mac-amd64
119+
path: ${{env.MODEL_NAME}}-mac-amd64
120+
- name: Download Artifact
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: ${{env.MODEL_NAME}}-mac-arm64
124+
path: ${{env.MODEL_NAME}}-mac-arm64
125+
126+
- run: |
127+
find "${{env.MODEL_NAME}}-mac-amd64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
128+
find "${{env.MODEL_NAME}}-mac-arm64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
129+
130+
- name: Upload Artifact
131+
uses: actions/upload-artifact@v4
132+
with:
133+
name: ${{env.MODEL_NAME}}-mac-amd64-signed
134+
path: ${{env.MODEL_NAME}}-mac-amd64
135+
- name: Upload Artifact
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: ${{env.MODEL_NAME}}-mac-arm64-signed
139+
path: ${{env.MODEL_NAME}}-mac-arm64

0 commit comments

Comments
 (0)