deploy python sdk #9
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
name: deploy python sdk | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy_to_pypi: | |
description: "Whether to deploy to PyPI (true) or TestPyPI (false)" | |
required: false | |
default: "false" | |
jobs: | |
deploy-python-sdk-linux: | |
strategy: | |
matrix: | |
os: ["ubuntu-20.04", "ubuntu-22.04", "buildjet-4vcpu-ubuntu-2204-arm"] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: korvus | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Validate cargo is working | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
command: version | |
- name: Install dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
TZ: Etc/UTC | |
run: | | |
sudo apt update | |
sudo apt-get -y install software-properties-common | |
sudo add-apt-repository -y ppa:deadsnakes/ppa | |
sudo add-apt-repository -y ppa:apt-fast/stable | |
sudo apt update | |
sudo apt-get -y install apt-fast | |
sudo apt-fast -y install \ | |
python3.7 python3.7-dev \ | |
python3.8 python3.8-dev \ | |
python3.9 python3.9-dev \ | |
python3.10 python3.10-dev \ | |
python3.11 python3.11-dev \ | |
python3.12 python3.12-dev \ | |
python3-pip \ | |
git | |
pip install maturin | |
pip install patchelf | |
- name: Build and deploy wheels to TestPyPI | |
if: github.event.inputs.deploy_to_pypi == 'false' | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
PYTHON_STUB_FILE: "python/korvus/korvus.pyi" | |
run: maturin publish -r testpypi -i python3.7 -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --skip-existing -F python | |
- name: Build and deploy wheels to PyPI | |
if: github.event.inputs.deploy_to_pypi == 'true' | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
PYTHON_STUB_FILE: "python/korvus/korvus.pyi" | |
run: maturin publish -i python3.7 -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --skip-existing -F python | |
deploy-python-sdk-mac: | |
runs-on: macos-latest | |
defaults: | |
run: | |
working-directory: korvus | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Validate cargo is working | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
command: version | |
- name: Install dependencies | |
run: | | |
# brew upgrade | |
# brew update | |
brew install python@3.8 | |
brew install python@3.9 | |
brew install python@3.10 | |
brew install python@3.11 | |
brew install python@3.12 | |
pip3 install maturin --break-system-packages | |
- name: Build and deploy wheels to TestPyPI | |
if: github.event.inputs.deploy_to_pypi == 'false' | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
PYTHON_STUB_FILE: "python/korvus/korvus.pyi" | |
run: maturin publish -r testpypi -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --skip-existing -F python | |
- name: Build and deploy wheels to PyPI | |
if: github.event.inputs.deploy_to_pypi == 'true' | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
PYTHON_STUB_FILE: "python/korvus/korvus.pyi" | |
run: maturin publish -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --skip-existing -F python | |
deploy-python-sdk-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
defaults: | |
run: | |
working-directory: korvus | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Validate cargo is working | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
command: version | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install maturin | |
- name: Build and deploy wheels to TestPyPI | |
if: github.event.inputs.deploy_to_pypi == 'false' | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
PYTHON_STUB_FILE: "python/korvus/korvus.pyi" | |
run: maturin publish -r testpypi -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --skip-existing -F python | |
- name: Build and deploy wheels to PyPI | |
if: github.event.inputs.deploy_to_pypi == 'true' | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
PYTHON_STUB_FILE: "python/korvus/korvus.pyi" | |
run: maturin publish -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --skip-existing -F python |