[pre-commit.ci] pre-commit autoupdate (#44) #136
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
name: Build and upload to PyPI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# linux-64 | |
- os: ubuntu-latest | |
python: 311 | |
platform_id: manylinux_x86_64 | |
- os: ubuntu-latest | |
python: 311 | |
platform_id: musllinux_x86_64 | |
# macos-x86-64 | |
- os: macos-13 | |
python: 311 | |
platform_id: macosx_x86_64 | |
# macos-x86-64 | |
- os: macos-14 | |
python: 311 | |
platform_id: macosx_arm64 | |
# windows-64 | |
- os: windows-latest | |
python: 311 | |
platform_id: win_amd64 | |
# linux-aarch64 | |
- os: ARM64 | |
python: 311 | |
platform_id: manylinux_aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ilammy/setup-nasm@v1 | |
if: matrix.platform_id == 'win_amd64' | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_ARCHS: all | |
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- run: python -m pip install build | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Build sdist for cmd | |
run: cd cmd && pipx run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-cmd | |
path: cmd/dist/* | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 |