Don't delete .so files generated as part of build #28
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 Wheels | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- setuptools | |
workflow_dispatch: | |
inputs: | |
deploy_target: | |
type: choice | |
description: "Choose the deployment target" | |
options: | |
- None | |
- PyPI | |
- Test PyPI | |
jobs: | |
build_wheels: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
name: [manylinux-x86_64, manylinux-aarch64, macos-x86_64, macos-arm64] | |
include: | |
- name: manylinux-x86_64 | |
os: ubuntu-latest | |
arch: x86_64 | |
- name: manylinux-aarch64 | |
os: ubuntu-24.04-arm | |
arch: aarch64 | |
shell: bash | |
- name: macos-x86_64 | |
os: macos-13 | |
macos-target: 10.13 | |
- name: macos-arm64 | |
os: macos-14 | |
macos-target: 11 | |
extra_macos_packages: "" # We can specify additional packages per architecture if needed | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# cibuildwheel requires the pyproject.toml to be present already | |
- name: Place pyproject.toml | |
run: | | |
mkdir -p ./build/python | |
cp ./python/pyproject.toml ./build/python/ | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
with: | |
# Where the setup.py/pyproject.toml build infrastructure is | |
package-dir: ./build/python | |
env: | |
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" | |
CIBW_SKIP: "*-win32 *-win_amd64 *-win_arm64 *-musllinux_*" | |
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
CIBW_BEFORE_BUILD: > | |
python3 -m pip install \ | |
Cython \ | |
meson \ | |
pyparsing \ | |
pytest \ | |
setuptools \ | |
toml \ | |
wheel | |
bash {project}/ci-scripts/cibw_build_before.sh | |
CIBW_BEFORE_ALL_MACOS: | | |
brew update | |
brew install gperf ninja | |
brew install SRI-CSL/sri-csl/libpoly | |
CIBW_ENVIRONMENT_MACOS: > | |
DYLD_LIBRARY_PATH="$(pwd)/install/lib:$DYLD_LIBRARY_PATH" | |
MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos-target }} | |
CIBW_TEST_COMMAND: pytest {project}/tests | |
- name: Upload wheels to PyPI | |
if: > | |
github.event_name == 'release' || | |
(github.event_name == 'workflow_dispatch' && | |
github.event.inputs.deploy_target == 'PyPI') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
pip install twine | |
twine upload --skip-existing wheelhouse/*.whl | |
- name: Upload wheels to TestPyPI | |
if: > | |
github.event_name == 'workflow_dispatch' && | |
github.event.inputs.deploy_target == 'Test PyPI' || | |
(github.event_name == 'push' && github.ref == 'refs/heads/setuptools') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: | | |
pip install twine | |
twine upload --skip-existing --repository testpypi wheelhouse/*.whl |