name: Python
on:
push:
branches: [main]
paths:
- '**/*.rs'
- "!tests/*.rs"
- bindings/python/pyproject.toml
- .github/workflows/python.yml
tags: ["git-bot-feedback-py/v*"]
pull_request:
branches: [main]
paths:
- '**/*.rs'
- "!tests/*.rs"
- bindings/python/pyproject.toml
- .github/workflows/python.yml
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}
jobs:
wheels:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
- runner: ubuntu-latest
target: x86_64
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: x86
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: aarch64
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: armv7
manylinux: musllinux_1_2
- runner: windows-latest
target: x64
py-arch: x64
- runner: windows-latest
target: x86
py-arch: x86
- runner: windows-11-arm
target: aarch64
py-arch: arm64
pyo3-feature: pyo3/abi3-py311
- runner: macos-15-intel
target: x86_64
- runner: macos-15
target: aarch64
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v6.2.0
with:
python-version: '3.x'
architecture: ${{ matrix.py-arch || null }}
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b with:
target: ${{ matrix.target }}
args: >-
--release
--out dist
--find-interpreter
--manifest-path bindings/python/Cargo.toml
--features ${{ matrix.pyo3-feature || 'pyo3/abi3-py310' }}
${{ runner.os == 'Linux' && matrix.target != 'ppc64le' && '--zig' || '' }}
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} manylinux: ${{ matrix.manylinux || 'auto' }}
before-script-linux: |
case "${{ matrix.target }}" in
ppc64le)
apt-get update
apt-get install -y \
pkg-config \
gcc-powerpc64le-linux-gnu \
g++-powerpc64le-linux-gnu \
binutils-powerpc64le-linux-gnu \
libc6-dev-ppc64el-cross \
libfontconfig1-dev
;;
esac
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ runner.os }}-${{ matrix.target }}_${{ matrix.manylinux || '' }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Build sdist
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b with:
command: sdist
args: --out dist --manifest-path bindings/python/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/git-bot-feedback-py/v')
needs: [wheels, sdist]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b with:
skip-existing: true
check-dist:
needs: [wheels, sdist]
if: ${{ !startsWith(github.ref, 'refs/tags/git-bot-feedback-py/v') }}
name: Check package dist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
pattern: wheels-*
path: dist
merge-multiple: true
- uses: actions/setup-python@v6.2.0
with:
python-version: 3.x
- name: Check distributions
run: pipx run twine check dist/*