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

Commit d2400b1

Browse files
chore: add package pipeline for 4 os
1 parent 798b582 commit d2400b1

File tree

1 file changed

+46
-25
lines changed

1 file changed

+46
-25
lines changed

.github/workflows/python-package.yml

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Build and Package Python Library
32

43
on:
@@ -12,11 +11,21 @@ on:
1211
model_name:
1312
description: "name of model to be release"
1413
required: true
14+
repo_name:
15+
description: "name of repo to be checked out"
16+
required: true
17+
branch_name:
18+
description: "name of branch to be checked out"
19+
required: true
20+
default: main
21+
1522

1623

1724
env:
1825
MODEL_DIR: models/whispervq # ${{ inputs.model_dir }}
1926
MODEL_NAME: whispervq # ${{ inputs.model_name }}
27+
REPO_NAME: janhq/models # ${{ inputs.model_name }}
28+
BRANCH_NAME: feat/ci-python-models # ${{ inputs.model_name }}
2029

2130
jobs:
2231
build-and-test:
@@ -26,41 +35,45 @@ jobs:
2635
fail-fast: false
2736
matrix:
2837
include:
29-
# - os: "linux"
30-
# name: "amd64"
31-
# runs-on: "ubuntu-20-04-cuda-12-0"
38+
- os: "linux"
39+
name: "amd64"
40+
runs-on: "ubuntu-20-04-cuda-12-0"
3241
- os: "mac"
3342
name: "amd64"
3443
runs-on: "macos-selfhosted-12"
3544
- os: "mac"
3645
name: "arm64"
3746
runs-on: "macos-silicon"
38-
# - os: "windows"
39-
# name: "amd64"
40-
# runs-on: "windows-cuda-12-0"
47+
- os: "windows"
48+
name: "amd64"
49+
runs-on: "windows-cuda-12-0"
4150
steps:
4251
- name: Clone
4352
id: checkout
4453
uses: actions/checkout@v3
4554
with:
4655
submodules: recursive
47-
repository: janhq/models
48-
ref: "feat/ci-python-models"
49-
56+
repository: ${{env.REPO_NAME}}
57+
ref: ${{env.BRANCH_NAME}}
5058
- uses: conda-incubator/setup-miniconda@v3
59+
if: runner.os != 'windows'
5160
with:
5261
auto-update-conda: true
5362
python-version: 3.11
63+
- name: use python
64+
if : runner.os == 'windows'
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: "3.11"
5468

5569
- name: Install dependencies Windows
5670
if: runner.os == 'windows'
71+
shell: pwsh
5772
run: |
58-
conda create -y -n ${{env.MODEL_NAME}} python=3.11
59-
source $HOME/miniconda/bin/activate base
60-
conda init
61-
conda activate ${{env.MODEL_NAME}}
62-
python -m pip install --upgrade pip
63-
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
73+
74+
python3 -m pip install --upgrade pip
75+
python3 -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
76+
6477
- name: Install dependencies Linux
6578
if: runner.os == 'linux'
6679
run: |
@@ -70,7 +83,7 @@ jobs:
7083
conda activate ${{env.MODEL_NAME}}
7184
python -m pip install --upgrade pip
7285
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
73-
86+
7487
- name: Install dependencies Mac
7588
if: runner.os == 'macOS'
7689
run: |
@@ -80,15 +93,19 @@ jobs:
8093
conda activate ${{env.MODEL_NAME}}
8194
python -m pip install --upgrade pip
8295
python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
96+
8397
- name: prepare python package windows
8498
if : runner.os == 'windows'
85-
shell: cmd
99+
shell: pwsh
86100
run: |
87-
source $HOME/miniconda/bin/activate base
88-
conda init
89-
conda activate ${{env.MODEL_NAME}}
90-
for /f "delims=" %%a in ('where python') do set "PYTHON_PATH=%%a"
91-
echo %PYTHON_PATH%
101+
$pythonPath = where.exe python
102+
echo "Python path (where.exe): $pythonPath"
103+
104+
105+
$pythonFolder = Split-Path -Path "$pythonPath" -Parent
106+
echo "PYTHON_FOLDER=$pythonFolder" >> $env:GITHUB_ENV
107+
108+
Move-Item -Path "$pythonFolder\python*.*" -Destination "$pythonFolder\Scripts\" -Force
92109
93110
- name: prepare python package unix
94111
if : runner.os != 'windows'
@@ -101,13 +118,15 @@ jobs:
101118
PYTHON_FOLDER=$(dirname $(dirname "$PYTHON_PATH"))
102119
echo "PYTHON_FOLDER=$PYTHON_FOLDER" >> $GITHUB_ENV
103120
echo "github end PYTHON_FOLDER: ${{env.PYTHON_FOLDER}}"
121+
104122
- name: Upload Artifact
105-
if : runner.os == 'macOS' || runner.os == 'linux'
123+
#if : runner.os == 'windows' || runner.os == 'linux'
106124
uses: actions/upload-artifact@v4
107125
with:
108126
name: ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
109127
path: ${{env.PYTHON_FOLDER}}
110128
include-hidden-files: true
129+
compression-level: 0
111130

112131
codesign:
113132
runs-on: macos-latest
@@ -141,9 +160,11 @@ jobs:
141160
name: ${{env.MODEL_NAME}}-mac-amd64-signed
142161
path: ${{env.MODEL_NAME}}-mac-amd64
143162
include-hidden-files: true
163+
compression-level: 0
144164
- name: Upload Artifact
145165
uses: actions/upload-artifact@v4
146166
with:
147167
name: ${{env.MODEL_NAME}}-mac-arm64-signed
148168
path: ${{env.MODEL_NAME}}-mac-arm64
149-
include-hidden-files: true
169+
include-hidden-files: true
170+
compression-level: 0

0 commit comments

Comments
 (0)