Build Python wheels #37
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 Python wheels | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
upload: | ||
description: 'Upload wheels to PyPI? (0: no, 1: yes)' | ||
required: true | ||
default: '0' | ||
env: | ||
CIBW_TEST_COMMAND: "python -c \"import drjit\"" | ||
CIBW_TEST_REQUIRES: "" | ||
jobs: | ||
build_wheels: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, windows-latest, macos-13, macos-14] | ||
python: [cp38, cp39, cp310, cp311, cp312, cp313, cp313_stable] | ||
exclude: | ||
- os: macos-14 | ||
python: cp38 | ||
fail-fast: false | ||
name: > | ||
Check failure on line 25 in .github/workflows/wheels.yml
|
||
${{ matrix.python }} wheel for ${{ matrix.os }} | ||
${{ (startsWith(matrix.python, '_stable' && 'stable ABI' || '' }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: Wandalen/wretry.action@v1.2.0 | ||
with: | ||
action: actions/checkout@v3 | ||
with: | | ||
submodules: recursive | ||
attempt_limit: 3 | ||
attempt_delay: 2000 | ||
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.10' | ||
- name: Prepare compiler environment for Windows | ||
if: runner.os == 'Windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
with: | ||
arch: x64 | ||
- name: Install cibuildwheel | ||
run: | | ||
python -m pip install cibuildwheel==2.20.0 | ||
- name: Build wheel | ||
if: ${{ ! endsWith(matrix.python, '_stable') }} | ||
env: | ||
CIBW_BUILD: ${{ matrix.python }}-* | ||
run: | | ||
python -m cibuildwheel --output-dir wheelhouse | ||
- name: Build stable ABI wheel (UNIX) | ||
if: ${{ endsWith(matrix.python, '_stable') }} && runner.os != 'Windows' | ||
run: | | ||
stable_cp=$(echo ${{ matrix.python }} | cut -d_ -f1) | ||
echo "CIBW_BUILD=$(stable_cp)" >> $GITHUB_ENV | ||
echo "CIBW_CONFIG_SETTINGS=\"wheel.py-api=cp312 cmake.args=-DDRJIT_STABLE_ABI=ON\"" >> $GITHUB_ENV | ||
python -m cibuildwheel --output-dir wheelhouse | ||
- name: Build stable ABI wheel (Windows) | ||
if: ${{ endsWith(matrix.python, '_stable') }} && runner.os == 'Windows' | ||
run: | | ||
stable_cp=$(echo ${{ matrix.python }} | cut -d_ -f1) | ||
echo "CIBW_BUILD=$(stable_cp)" >> $GITHUB_ENV | ||
python -m cibuildwheel --output-dir wheelhouse | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: ./wheelhouse/*.whl | ||
upload_pypi: | ||
name: Upload wheels to PyPI | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.inputs.upload == '1'}} | ||
needs: [build_wheels] | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@v1.10.2 | ||
with: | ||
user: __token__ | ||
repository-url: https://test.pypi.org/legacy/ | ||
password: ${{ secrets.PYPI_PASSWORD }} |