Try installing C++ build dependencies again #31
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_ALL_LINUX: | | |
# First configure the base CentOS repository | |
echo "[base] | |
name=CentOS-7 - Base | |
baseurl=http://vault.centos.org/7.9.2009/os/x86_64/ | |
gpgcheck=0 | |
enabled=1" > /etc/yum.repos.d/CentOS-Base.repo | |
# Configure EPEL repository | |
echo "[epel] | |
name=Extra Packages for Enterprise Linux 7 - x86_64 | |
baseurl=http://archive.fedoraproject.org/pub/epel/7/x86_64/ | |
gpgcheck=0 | |
enabled=1" > /etc/yum.repos.d/epel.repo | |
# Install development tools and libraries | |
yum clean all | |
yum makecache --disablerepo=* --enablerepo=base,epel | |
yum install -y --disablerepo=* --enablerepo=base,epel \ | |
cmake \ | |
gcc \ | |
gcc-c++ \ | |
glibc-devel \ | |
gmp-devel \ | |
java-1.8.0-openjdk-devel \ | |
make \ | |
ninja-build | |
# Show what we installed for debugging | |
gcc --version | |
cmake --version | |
ninja --version | |
CIBW_BEFORE_ALL_MACOS: | | |
brew update | |
brew install gperf ninja | |
brew install SRI-CSL/sri-csl/libpoly | |
CIBW_BEFORE_BUILD: > | |
python3 -m pip install \ | |
Cython \ | |
meson \ | |
pyparsing \ | |
pytest \ | |
setuptools \ | |
toml \ | |
wheel | |
bash {project}/ci-scripts/cibw_build_before.sh | |
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: | | |
python3 -m venv ./upload-env | |
source ./upload-env/bin/activate | |
python3 -m pip install twine | |
python3 -m 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: | | |
python3 -m venv ./upload-env | |
source ./upload-env/bin/activate | |
python3 -m pip install twine | |
python3 -m twine upload --skip-existing --repository testpypi wheelhouse/*.whl |