Skip to content

Python

Python #92

Workflow file for this run

name: Python
on:
push:
tags:
- "python-*"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-wheels:
# Heavily cribbed from https://github.com/pydantic/pydantic-core/blob/1ced3e6b4e87b03c460952f1970a97b1c8cbc605/.github/workflows/ci.yml#L399-L508
name: Build wheels on ${{ matrix.os }} (${{ matrix.target }} - all${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }})
strategy:
fail-fast: false
matrix:
os: [linux, macos, windows]
target: [x86_64, aarch64]
manylinux: [auto]
include:
- os: linux
manylinux: auto
target: i686
- os: linux
manylinux: auto
target: aarch64
- os: linux
manylinux: auto
target: armv7
- os: linux
manylinux: auto
target: ppc64le
- os: linux
manylinux: auto
target: s390x
- os: linux
manylinux: musllinux_1_1
target: x86_64
- os: linux
manylinux: musllinux_1_1
target: aarch64
- os: linux
manylinux: musllinux_1_1
target: armv7
- os: macos
target: x86_64
- os: macos
target: aarch64
- os: windows
target: x86_64
- os: windows
target: i686
python-architecture: x86
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
- os: windows
target: aarch64
interpreter: 3.11 3.12 3.13
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
architecture: ${{ matrix.python-architecture || 'x64' }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' }} --manifest-path python/Cargo.toml
before-script-linux: sudo apt-get update && sudo apt-get install libssl-dev
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_all_${{ matrix.manylinux }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path python/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
# 🤔 should we test out built wheels here? seems nice
release:
name: Release
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/')
needs:
- build-wheels
- sdist
environment:
name: pypi
url: https://pypi.org/p/stacrs
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi_files_*
merge-multiple: true
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*