Build Wheels #38
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 Wheels | |
on: | |
workflow_dispatch: # only manual triggers | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest] | |
python: ["3.9", "3.10", "3.11", "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/hostedtoolcache/Python/3.12.8/x64" | |
CMAKE_PREFIX_PATH="/opt/hostedtoolcache/Python/3.12.8/x64" | |
PYTHON_INCLUDE_DIR="/opt/hostedtoolcache/Python/3.12.8/x64/include/python3.12" | |
PYTHON_LIBRARY="/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12" | |
CMAKE_ARGS="-DPython_EXECUTABLE=/opt/hostedtoolcache/Python/3.12.8/x64/bin/python3.12" | |
- name: Store the wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
# temporary label, will be renamed according to PEP 427 | |
name: wheels-${{ matrix.os }}-${{ matrix.python }} | |
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: wheels-* # 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/ |