Skip to content

wheels

wheels #102

Workflow file for this run

name: wheels
on:
workflow_dispatch:
inputs:
upload_to_pypi:
description: 'Upload wheels to PyPI? (0: no, 1: yes)'
required: true
default: '0'
upload_to_release:
description: 'Upload wheels to github release page? (0: no, 1: yes)'
required: true
default: '0'
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_SKIP: "*-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_34
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS_LINUX: auto64
CIBW_TEST_COMMAND: "python -c \"import slangpy\""
# zip required for vcpkg, rest for glfw
CIBW_BEFORE_ALL_LINUX: yum install -y zip wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
# make sure slangpy wheel is build with testing data + corrected project directory
CIBW_ENVIRONMENT: BUILD_RELEASE_WHEEL=1
MACOSX_DEPLOYMENT_TARGET: 14.0
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "bash .github/scripts/sign_macos_bins.sh {wheel} {dest_dir}"
jobs:
wheels:
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 120
strategy:
matrix:
os: [windows, linux, macos]
platform: [x86_64, aarch64]
python: [cp39, cp310, cp311, cp312, cp313]
exclude:
# Exclude aarch64 for windows
- { os: windows, platform: aarch64 }
# Exclude x86_64 for macos
- { os: macos, platform: x86_64 }
include:
# Specify runners
- { os: windows, runs-on: [windows-latest] }
- { os: linux, runs-on: [ubuntu-latest] }
- { os: macos, runs-on: [macos-latest] }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# Used to host cibuildwheel.
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Install cibuildwheel.
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.0.0rc1
# Setup MSVC.
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# Build wheels.
- name: Build wheels
env:
CIBW_BUILD: ${{ matrix.python }}-*
run: |
python -m cibuildwheel --output-dir wheelhouse
# Copy wheels to artifact.
- name: Copy wheels to artifact
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.python }}
path: ./wheelhouse/*.whl
upload_pypi:
name: Upload wheels to PyPI
runs-on: ubuntu-latest
if: ${{ github.event.inputs.upload_to_pypi == '1'}}
needs: [wheels]
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: artifacts
# merge-multiple: true # Seems causing file corruption
# Manually combine artifacts into dist/
- name: Combine artifacts
shell: bash
run: |
mkdir -p dist/
find artifacts/ -name "*.whl" -exec cp {} dist/ \;
# Verify downloaded wheels before upload to PyPI.
- name: Verify downloaded wheels
shell: bash
run: |
pip install "setuptools>=77.0.0" "twine>=6.1.0" "packaging>=24.2.0"
echo "=== Build tools versions ==="
python -c "import setuptools; print(f'setuptools: {setuptools.__version__}')"
python -c "import twine; print(f'twine: {twine.__version__}')"
echo "=== Checking downloaded wheels individually ==="
for wheel in dist/*.whl; do
if [ -f "$wheel" ]; then
size=$(stat -c%s "$wheel" 2>/dev/null || stat -f%z "$wheel" 2>/dev/null || echo "unknown")
echo "Checking: $wheel (${size} bytes)"
if twine check --strict "$wheel"; then
echo " - Passes twine check"
else
echo " - Failed twine check"
exit 1
fi
echo ""
fi
done
- uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
upload_github_release:
name: Upload wheels to GitHub Release
runs-on: ubuntu-latest
if: ${{ github.event.inputs.upload_to_release == '1'}}
needs: [wheels]
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: artifacts
# merge-multiple: true # Seems causing file corruption
# Manually combine artifacts into dist/
- name: Combine artifacts
shell: bash
run: |
mkdir -p dist/
find artifacts/ -name "*.whl" -exec cp {} dist/ \;
- name: Upload wheels to GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: ${{contains(github.ref, 'draft')}}
prerelease: ${{contains(github.ref, 'draft')}}
files: dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}