Skip to content

Merge pull request #200 from neutrinoceros/mnt/setup-uv-9 #384

Merge pull request #200 from neutrinoceros/mnt/setup-uv-9

Merge pull request #200 from neutrinoceros/mnt/setup-uv-9 #384

Workflow file for this run

name: Build wheels and publish to PyPI
on:
push:
branches:
- main
tags:
- v*
pull_request:
paths:
- .github/workflows/wheels.yaml
- setup.py
- pyproject.toml
workflow_dispatch:
permissions: {}
jobs:
build_wheels:
name: Build ${{ matrix.archs }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
archs: x86_64
select: '*manylinux*'
id: manylinux_x86_64
- os: ubuntu-latest
archs: x86_64
select: '*musllinux*'
id: musllinux_x86_64
- os: macos-latest
archs: x86_64
select: '*'
id: macos_x86_64
- os: macos-latest
archs: arm64
select: '*'
id: macos_arm64
- os: windows-latest
archs: AMD64
select: '*'
id: windows_AMD64
steps:
- name: Checkout repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: false
- name: Build wheels for CPython
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
with:
output-dir: dist
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ matrix.select }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-${{ matrix.os }}-${{ matrix.id }}
path: ./dist/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: false
- name: Build sdist
run: uv build --sdist
- name: Upload sdist
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sdist
path: dist/*.tar.gz
check_manifest:
name: Check MANIFEST.in
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: '3.13'
activate-environment: true
enable-cache: false
- name: Install build time dependencies
run: |
uv pip install Cython numpy setuptools wheel check-manifest
- name: Build
run: uv pip install --no-build-isolation .
- run: check-manifest
deploy:
name: Publish to PyPI
needs: [build_wheels, build_sdist, check_manifest]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: sdist
path: dist
- name: Download wheels
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
pattern: wheels-*
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 # zizmor: ignore[use-trusted-publishing]
with:
user: __token__
password: ${{ secrets.pypi_token }}