Skip to content

Build Wheels

Build Wheels #26

Workflow file for this run

name: Build Wheels
on:
workflow_dispatch: # only manual triggers
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14, macos-latest, ubuntu-latest]
python: ["3.12"]
steps:
- uses: actions/checkout@v4 # clone repo into workflow environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "pybind11[global]"
pip install cibuildwheel
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_VERBOSITY: 1
# Optional: Skip 32-bit builds
CIBW_SKIP: "*-win32 *-manylinux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
yum clean all && \
yum makecache && \
yum install -y python3-devel
CIBW_ENVIRONMENT_LINUX: >
Python_ROOT_DIR="/opt/python/$(python -c 'import sys; print(f\"cp{sys.version_info.major}{sys.version_info.minor}-cp{sys.version_info.major}{sys.version_info.minor}\")')"
CMAKE_PREFIX_PATH="/opt/python/$(python -c 'import sys; print(f\"cp{sys.version_info.major}{sys.version_info.minor}-cp{sys.version_info.major}{sys.version_info.minor}\")')"
CMAKE_ARGS="-DPython_EXECUTABLE=$(which python)"
CIBW_ENVIRONMENT_MACOS: >
PYTHON_INCLUDE_DIR="$(python3-config --includes)"
PYTHON_LIBRARY="$(python3-config --prefix)/lib"
CMAKE_PREFIX_PATH="$(python3-config --prefix)"
- name: Store the wheels
uses: actions/upload-artifact@v4
with:
name: pyember-0.0.3-${{ matrix.os }}-${{ matrix.python }}.whl
path: ./wheelhouse/*.whl # cibuildwheel puts wheels in wheelhouse/
compression-level: 0
publish-to-testpypi:
needs: build_wheels
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/pyember/
permissions:
id-token: write
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: pyember-*.whl # Download wheels from all OS builds
path: dist/
merge-multiple: true # Merge all wheels into dist directory
- name: Publish wheels to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/