forked from abetlen/llama-cpp-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from xhedit/conv
merge from master
- Loading branch information
Showing
7 changed files
with
190 additions
and
901 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,162 @@ | ||
name: Publish to PyPI | ||
name: Publish | ||
|
||
# Based on: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
|
||
on: workflow_dispatch | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
pypi: | ||
description: 'Upload wheels to PyPI? 1 = yes, 0 = no' | ||
default: '0' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish | ||
build-linux: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install build | ||
python3 -m pip install .[all] -v | ||
- name: Build Wheel | ||
id: build-wheel-sdist | ||
run: | | ||
python -m build -n | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'wheel' | ||
path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel | ||
|
||
build-windows: | ||
|
||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install .[all] -v | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'wheel' | ||
path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel | ||
|
||
|
||
build-macos: | ||
|
||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip build | ||
python3 -m pip install -e .[all] | ||
- name: Build source distribution | ||
run: | | ||
python3 -m build --sdist | ||
- name: Publish distribution to PyPI | ||
# TODO: move to tag based releases | ||
# if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install .[all] --verbose | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'wheel' | ||
path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel | ||
|
||
# build-linux-opencl: | ||
|
||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# with: | ||
# submodules: "recursive" | ||
# - name: Set up Python 3.8 | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: "3.8" | ||
# - name: Set up OpenCL & CLBlast | ||
# run: | | ||
# wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null | ||
# echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | ||
# sudo apt-get update | ||
# sudo apt-get install -y --no-install-recommends llvm intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers libclblast-dev | ||
# - name: Install dependencies | ||
# run: | | ||
# python3 -m pip install --upgrade pip | ||
# CMAKE_ARGS="-DLLAMA_CLBLAST=on" python3 -m pip install .[all] --verbose | ||
|
||
|
||
build-macos-metal: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
CMAKE_ARGS="-DLLAMA_METAL=on" python3 -m pip install .[all] --verbose | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'wheel' | ||
path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel | ||
|
||
publish-to-pypi: | ||
name: Publish Python distribution to PyPI | ||
if: inputs.pypi == '1' | ||
needs: ["build-linux", "build-windows", "build-macos", "build-macos-metal"] | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/llama_cpp_python | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- name: Download the wheel | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: wheel | ||
path: dist/ | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@v1.8.10 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.