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

Commit 7fd1a0e

Browse files
test package using miniconda
1 parent 9409282 commit 7fd1a0e

File tree

1 file changed

+45
-14
lines changed

1 file changed

+45
-14
lines changed

.github/workflows/python-package.yml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,42 +46,73 @@ jobs:
4646
repository: janhq/models
4747
ref: "feat/ci-python-models"
4848

49-
- name: use python
50-
uses: actions/setup-python@v5
51-
with:
52-
python-version: "3.11"
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: cmd
74+
run: |
75+
curl -o miniconda.exe https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
76+
start /wait "" miniconda.exe /InstallationType=JustMe /AddToPath=1 /RegisterPython=0 /S /D=%UserProfile%\Miniconda
77+
echo %UserProfile%\Miniconda >> %GITHUB_PATH%
5378
5479
- name: Install dependencies Windows and Linux
5580
if: runner.os == 'windows' || runner.os == 'linux'
5681
run: |
57-
python3 -m pip install --upgrade pip
58-
python3 -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
82+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
83+
conda activate ${{env.MODEL_NAME}}
84+
python -m pip install --upgrade pip
85+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.cuda.txt
5986
6087
- name: Install dependencies Mac
6188
if: runner.os == 'macOS'
6289
run: |
63-
python3 -m pip install --upgrade pip
64-
python3 -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
90+
conda create -y -n ${{env.MODEL_NAME}} python=3.11
91+
conda activate ${{env.MODEL_NAME}}
92+
python -m pip install --upgrade pip
93+
python -m pip install -r ${{env.MODEL_DIR}}/requirements.txt
6594
6695
- name: prepare python package windows
6796
if : runner.os == 'windows'
6897
shell: cmd
6998
run: |
99+
conda activate ${{env.MODEL_NAME}}
70100
for /f "delims=" %%a in ('where python') do set "PYTHON_PATH=%%a"
71101
echo %PYTHON_PATH%
72102
73103
- name: prepare python package unix
74104
if : runner.os != 'windows'
75105
run: |
106+
conda activate ${{env.MODEL_NAME}}
76107
PYTHON_PATH=$(which python)
77108
echo $PYTHON_PATH
78109
PYTHON_FOLDER=$(dirname $(dirname "$PYTHON_PATH"))
79110
echo "PYTHON_FOLDER=$PYTHON_FOLDER" >> $GITHUB_ENV
80111
echo "github end PYTHON_FOLDER: ${{env.PYTHON_FOLDER}}"
81112
82-
- name: Upload Artifact
83-
if : runner.os == 'macOS'
84-
uses: actions/upload-artifact@v4
85-
with:
86-
name: ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
87-
path: /Library/Frameworks/Python.framework/Versions/3.11
113+
# - name: Upload Artifact
114+
# if : runner.os == 'macOS'
115+
# uses: actions/upload-artifact@v4
116+
# with:
117+
# name: ${{env.MODEL_NAME}}-${{ matrix.os }}-${{ matrix.name }}
118+
# path: /Library/Frameworks/Python.framework/Versions/3.11

0 commit comments

Comments
 (0)