Skip to content

PyPI

PyPI #72

Workflow file for this run

name: PyPI
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: wheels
cancel-in-progress: false
jobs:
# TODO add bundled builds for platforms where we don't have pre-built libraries
linux:
runs-on: ubuntu-22.04
strategy:
matrix:
platform:
- target: x86_64
manylinux: auto
duckdb-slug: amd64
- target: aarch64
manylinux: "2_28"
duckdb-slug: aarch64
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Install Pythons
run: uv python install 3.10
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.10 --auditwheel check
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: ${{ matrix.platform.manylinux }}
before-script-linux: |
yum install -y unzip
curl -L -O https://github.com/duckdb/duckdb/releases/download/v1.2.0/libduckdb-linux-${{ matrix.platform.duckdb-slug }}.zip
unzip libduckdb-linux-${{ matrix.platform.duckdb-slug }}.zip -d /opt/duckdb
export DUCKDB_LIB_DIR=/opt/duckdb
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
env:
DUCKDB_VERSION: "1.2.0"
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Install Python
run: uv python install 3.10
- name: Install libduckdb
run: |
wget https://github.com/duckdb/duckdb/releases/download/v${DUCKDB_VERSION}/libduckdb-osx-universal.zip
mkdir -p ./opt/duckdb
unzip libduckdb-osx-universal.zip -d ${{ github.workspace }}/opt/duckdb
- name: Install delocate
run: |
uv venv
uv pip install delocate
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/opt/duckdb
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.10
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Repair wheel
run: .venv/bin/delocate-wheel -v dist/*.whl
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs:
- linux
- macos
- sdist
environment:
name: pypi
url: https://pypi.org/p/stacrs
permissions:
id-token: write
contents: write
attestations: write
steps:
- uses: actions/download-artifact@v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: "wheels-*/*"
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*