@@ -2,7 +2,7 @@ name: Build and Package Python Library
22
33on :
44 push :
5- branches : [ feat/python-package-ci ]
5+ branches : [ feat/codesign- python-package ]
66 workflow_dispatch :
77 inputs :
88 model_dir :
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,51 @@ 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+ conda create -y -n ${{env.MODEL_NAME}} python=3.11
76+ conda init
77+ conda activate ${{env.MODEL_NAME}}
78+ python -m pip install --upgrade pip
79+ python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
11080
11181 - name : prepare python package windows
11282 if : runner.os == 'windows'
11383 shell : cmd
11484 run : |
85+ conda init
11586 conda activate ${{env.MODEL_NAME}}
11687 for /f "delims=" %%a in ('where python') do set "PYTHON_PATH=%%a"
11788 echo %PYTHON_PATH%
11889
11990 - name : prepare python package unix
12091 if : runner.os != 'windows'
12192 run : |
122- export PATH=$PATH:$HOME/miniconda/bin/
123- source $HOME/miniconda/bin/activate base
93+ conda init
12494 conda activate ${{env.MODEL_NAME}}
12595 PYTHON_PATH=$(which python)
12696 echo $PYTHON_PATH
@@ -133,4 +103,41 @@ jobs:
133103 uses : actions/upload-artifact@v4
134104 with :
135105 name : ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
136- path : ${{env.PYTHON_FOLDER}}
106+ path : ${{env.PYTHON_FOLDER}}
107+
108+ codesign :
109+ runs-on : macos-latest
110+ needs : build-and-test
111+ steps :
112+ - name : checkout
113+ uses : actions/checkout@v3
114+ - uses : apple-actions/import-codesign-certs@v2
115+ continue-on-error : true
116+ with :
117+ p12-file-base64 : ${{ secrets.CODE_SIGN_P12_BASE64 }}
118+ p12-password : ${{ secrets.CODE_SIGN_P12_PASSWORD }}
119+ - name : Download Artifact
120+ uses : actions/download-artifact@v4
121+ with :
122+ name : ${{env.MODEL_NAME}}-mac-amd64
123+ path : ${{env.MODEL_NAME}}-mac-amd64
124+ - name : Download Artifact
125+ uses : actions/download-artifact@v4
126+ with :
127+ name : ${{env.MODEL_NAME}}-mac-arm64
128+ path : ${{env.MODEL_NAME}}-mac-arm64
129+
130+ - run : |
131+ find "${{env.MODEL_NAME}}-mac-amd64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
132+ find "${{env.MODEL_NAME}}-mac-arm64" \( -type f \) -exec codesign --force --entitlements="./engine/templates/macos/entitlements.plist" -s "${{ secrets.DEVELOPER_ID }}" --options=runtime {} \;
133+
134+ - name : Upload Artifact
135+ uses : actions/upload-artifact@v4
136+ with :
137+ name : ${{env.MODEL_NAME}}-mac-amd64-signed
138+ path : ${{env.MODEL_NAME}}-mac-amd64
139+ - name : Upload Artifact
140+ uses : actions/upload-artifact@v4
141+ with :
142+ name : ${{env.MODEL_NAME}}-mac-arm64-signed
143+ path : ${{env.MODEL_NAME}}-mac-arm64
0 commit comments