python release #56
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
# Build and publish python bindings. | |
# | |
# Publishing only happens for tag pushes with the tag beginning with 'v'. | |
name: python release | |
on: | |
push: | |
tags: | |
- "*" | |
schedule: | |
# Run every Monday at 12:00 | |
- cron: 0 12 * * 1 | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
PYTHON_VERSION: "3.7" | |
MATURIN_VERSION: "1.0.1" | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
MATURIN_USERNAME: "seanglaredb" | |
PROTOC: "${{ github.workspace }}/deps/protoc/bin/protoc" | |
jobs: | |
linux: | |
runs-on: ubuntu-2004-8-cores | |
strategy: | |
fail-fast: true | |
matrix: | |
target: [x86_64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v1 | |
- name: install protoc | |
run: just protoc | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
manylinux: "auto" | |
docker-options: "--env PROTOC=${{ env.PROTOC }}" | |
target: ${{ matrix.target }} | |
args: --release --out dist -m bindings/python/Cargo.toml | |
sccache: "true" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
windows: | |
runs-on: windows-latest-8-cores | |
strategy: | |
fail-fast: true | |
matrix: | |
target: [x64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v1 | |
- name: install protoc | |
run: just protoc | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist | |
working-directory: bindings/python | |
sccache: "true" | |
container: "off" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: bindings/python/dist | |
macos: | |
runs-on: macos-12-xl | |
strategy: | |
fail-fast: true | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v1 | |
- name: install protoc | |
run: just protoc | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist | |
working-directory: bindings/python | |
sccache: "true" | |
container: "off" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: bindings/python/dist | |
release: | |
name: Release | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: [linux, macos, windows] | |
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: --skip-existing * |