💚 use maturin in CI

This commit is contained in:
Nate Sesti 2023-12-02 15:00:22 -08:00
parent 82dcfdffad
commit 7742438719
2 changed files with 107 additions and 10 deletions

View file

@ -39,11 +39,108 @@ jobs:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: cd server && poetry run pytest
pypi-deployment:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10.8"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10.8"
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10.8"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing *
- name: Check out code
uses: actions/checkout@v2
@ -57,18 +154,9 @@ jobs:
python -m pip install --upgrade pip
pip install poetry
- name: Install project dependencies
run: cd server && poetry install
- name: Configure Poetry Token
run: cd server && poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
- name: Bump the version
run: cd server && poetry version patch
- name: Build and publish the package
run: cd server && poetry publish --build
- name: Commit changes
run: |
git config --local user.email "action@github.com"

View file

@ -90,6 +90,10 @@ jobs:
run: |
pip install pyinstaller
- name: Install Maturin
run: |
pip install maturin
- name: Install Dependencies
run: |
pip install -r server/requirements.txt
@ -124,6 +128,11 @@ jobs:
# python setup.py build_static build
# if: matrix.os == 'ubuntu-latest'
- name: Build the Rust library
run: |
cd server
maturin develop
- name: Install tiktoken vocab file
# Done to avoid extra network request to download the vocab file
run: |