Skip to content

[v0.1.0] 2025-09-06

[v0.1.0] 2025-09-06 #6

Workflow file for this run

name: Build Wheels
on:
push:
branches: [ master, main ]
tags: [ 'v*' ]
pull_request:
branches: [ master, main ]
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-24.04
arch: x86_64
- os: windows-2022
arch: AMD64
- os: macos-13
arch: x86_64
- os: macos-14
arch: arm64
steps:
- name: Checkout PyHelios
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Required for setuptools-scm
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8' # Use lowest supported version for compatibility
- name: Setup MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install Helios dependencies (Linux)
if: runner.os == 'Linux'
run: |
cd helios-core/utilities
sudo bash dependencies.sh ALL
- name: Install Helios dependencies (macOS)
if: runner.os == 'macOS'
run: |
cd helios-core/utilities
# Install base + visualization dependencies (no GPU/CUDA for macOS builds)
bash dependencies.sh BASE
bash dependencies.sh VIS
- name: Debug environment (macOS)
if: runner.os == 'macOS'
run: |
echo "=== Directory structure ==="
ls -la
echo "=== PyHelios build scripts ==="
ls -la build_scripts/
echo "=== Helios core ==="
ls -la helios-core/ || echo "helios-core not found"
echo "=== Python version and location ==="
python --version
which python
echo "=== Environment ==="
env | grep -E "(PYTHON|PATH)" | head -10
- name: Install CUDA Toolkit (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
# Download CUDA 12.6 installer
Invoke-WebRequest -Uri "https://developer.download.nvidia.com/compute/cuda/12.6.2/network_installers/cuda_12.6.2_windows_network.exe" -OutFile "cuda_installer.exe"
# Install CUDA toolkit components needed for compilation
Start-Process -FilePath ".\cuda_installer.exe" -ArgumentList "-s","nvcc_12.6","cudart_12.6","nvrtc_12.6","nvrtc_dev_12.6","visual_studio_integration_12.6" -Wait
# Add CUDA to PATH for subsequent steps
echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install cibuildwheel and repair tools
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
# Install platform-specific wheel repair tools
if [ "${{ runner.os }}" = "Linux" ]; then
python -m pip install auditwheel
elif [ "${{ runner.os }}" = "macOS" ]; then
python -m pip install delocate
fi
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
# Build for Python 3.8+ on all platforms
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
# Skip 32-bit builds and PyPy
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux* pp*"
# Architecture configuration based on runner
CIBW_ARCHS: ${{ matrix.arch }}
# Platform-specific build commands with broad CUDA compatibility
CIBW_BEFORE_BUILD_MACOS: "python build_scripts/prepare_wheel.py --buildmode release --nogpu --verbose"
CIBW_BEFORE_BUILD_WINDOWS: "set CMAKE_RC_COMPILER= && set PYHELIOS_CUDA_ARCHITECTURES=50;60;70;75;80;86;90 && python build_scripts/prepare_wheel.py --buildmode release --verbose"
CIBW_BEFORE_BUILD_LINUX: "export PYHELIOS_CUDA_ARCHITECTURES=50;60;70;75;80;86;90 && python build_scripts/prepare_wheel.py --buildmode release --verbose"
# Test wheel installation
CIBW_TEST_COMMAND: "python -c 'import pyhelios; print(f\"PyHelios {pyhelios.__version__} imported successfully\")'"
CIBW_TEST_REQUIRES: "pytest"
# Repair wheels to bundle dependencies
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair -w {dest_dir} {wheel}"
- name: Debug build failure
if: failure()
run: |
echo "=== Build Failure Diagnostics ==="
echo "Build directory contents:"
find pyhelios_build -name "*.so" -o -name "*.dll" -o -name "*.dylib" 2>/dev/null || echo "No build directory found"
echo ""
echo "Plugin directory contents:"
ls -la pyhelios/plugins/ 2>/dev/null || echo "No plugins directory found"
echo ""
echo "Wheel directory contents:"
ls -la wheelhouse/ 2>/dev/null || echo "No wheelhouse directory found"
echo ""
echo "Python environment:"
python --version
pip list | grep -E "(cibuildwheel|auditwheel|delocate)" || echo "Wheel tools not found"
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse/*.whl
retention-days: 7
test_wheels:
name: Test wheels on ${{ matrix.os }} Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: build_wheels
strategy:
matrix:
include:
- os: ubuntu-24.04
python-version: '3.8'
- os: ubuntu-24.04
python-version: '3.11'
- os: windows-2022
python-version: '3.8'
- os: windows-2022
python-version: '3.11'
- os: macos-13
python-version: '3.8'
- os: macos-13
python-version: '3.11'
- os: macos-14
python-version: '3.8'
- os: macos-14
python-version: '3.11'
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: wheelhouse
- name: Install wheel
run: |
python -m pip install --upgrade pip
python -m pip install --find-links wheelhouse --no-index pyhelios
- name: Test basic functionality
run: |
python -c "
import pyhelios
from pyhelios import Context, WeberPennTree, WPTType
from pyhelios.types import vec2, vec3, RGBcolor
print(f'PyHelios version: {pyhelios.__version__}')
# Test basic Context operations
context = Context()
center = vec3(1, 2, 3)
color = RGBcolor(0.5, 0.5, 0.5)
uuid = context.addPatch(center=center, size=vec2(1, 1), color=color)
print(f'Added patch with UUID: {uuid}')
# Test plugin availability reporting
from pyhelios.plugins import print_plugin_status
print_plugin_status()
"
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build_wheels, test_wheels]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/pyhelios
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: wheelhouse
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: wheelhouse/
verify-metadata: false # Skip metadata verification due to dynamic versioning