Skip to content

Build and upload to PyPI #23

Build and upload to PyPI

Build and upload to PyPI #23

Workflow file for this run

name: Build and upload to PyPI
on:
workflow_dispatch:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies for Windows
if: runner.os == 'Windows'
run: |
New-Item -Path "C:\Program Files\" -Name "boost" -ItemType "directory"
Invoke-WebRequest -Uri https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip -OutFile "C:\Program Files\boost\boost_1_82_0.zip"
7z x -o"C:\Program Files\boost\" "C:\Program Files\boost\boost_1_82_0.zip"
- name: Install dependencies for Mac
if: runner.os == 'macOS'
run: |
brew update
brew install boost
- name: Build wheels
uses: pypa/[email protected]
env:
BUILD_EXTENSION: yes
CIBW_SKIP: "pp* *-win32 *-musllinux_x86_64 *_i686"
CIBW_BEFORE_ALL_LINUX: yum install -y boost-devel
CIBW_ENVIRONMENT_MACOS: CXXFLAGS='-I/opt/homebrew/Cellar/boost/1.85.0'
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_all:
needs: [build_wheels, make_sdist]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1