Workflow file for this run
This file contains hidden or 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 And Publish PyPI Wheels | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| jobs: | |
| unit_tests: | |
| name: unit tests | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Run lightweight unit tests | |
| run: python -m unittest tests.test_torch_interop_patch tests.test_project_metadata -v | |
| build_linux_wheels: | |
| name: linux / manylinux_2_28 | |
| runs-on: ubuntu-22.04 | |
| needs: unit_tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Build Linux wheels | |
| uses: pypa/cibuildwheel@v3.3.0 | |
| env: | |
| CIBW_BUILD: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64" | |
| CIBW_SKIP: "*-musllinux_*" | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_BEFORE_ALL_LINUX: >- | |
| dnf install -y dnf-plugins-core gcc-toolset-13 && | |
| rpm --import https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/D42D0685.pub && | |
| dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && | |
| dnf clean expire-cache && | |
| dnf install -y cuda-toolkit-12-5 && | |
| ln -sfn /usr/local/cuda-12.5 /usr/local/cuda && | |
| /usr/local/cuda/bin/nvcc --version | |
| CIBW_ENVIRONMENT_LINUX: >- | |
| CUDA_HOME=/usr/local/cuda | |
| CUDA_PATH=/usr/local/cuda | |
| CUDA_ROOT=/usr/local/cuda | |
| CUDA_BIN_PATH=/usr/local/cuda | |
| CUDACXX=/usr/local/cuda/bin/nvcc | |
| PIP_CONSTRAINT=/project/.github/constraints/drjit-build.txt | |
| CC=/opt/rh/gcc-toolset-13/root/usr/bin/gcc | |
| CXX=/opt/rh/gcc-toolset-13/root/usr/bin/g++ | |
| CUDAHOSTCXX=/opt/rh/gcc-toolset-13/root/usr/bin/g++ | |
| PATH=/usr/local/cuda/bin:$PATH | |
| LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: >- | |
| auditwheel repair | |
| --exclude libcuda.so.1 | |
| --exclude libnvoptix.so.1 | |
| --exclude libdrjit-core.so | |
| --exclude libdrjit-extra.so | |
| --exclude libnanothread.so | |
| -w {dest_dir} {wheel} | |
| with: | |
| output-dir: dist | |
| - name: Upload Linux wheel artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux | |
| path: dist/*.whl | |
| if-no-files-found: error | |
| build_windows_wheels: | |
| name: windows / py${{ matrix.python_version }} | |
| runs-on: windows-2022 | |
| needs: unit_tests | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python_version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install CUDA Toolkit | |
| uses: Jimver/cuda-toolkit@v0.2.29 | |
| with: | |
| cuda: "12.5.0" | |
| method: local | |
| log-file-suffix: "windows-py${{ matrix.python_version }}.log" | |
| - name: Show toolchain | |
| shell: bash | |
| run: | | |
| python --version | |
| cmake --version || true | |
| nvcc --version | |
| - name: Install build frontend | |
| run: python -m pip install --upgrade pip build cmake ninja | |
| - name: Build wheel | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: "4" | |
| PIP_CONSTRAINT: ${{ github.workspace }}\.github\constraints\drjit-build.txt | |
| run: python -m build --wheel | |
| - name: Upload Windows wheel artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-py${{ matrix.python_version }} | |
| path: dist/*.whl | |
| if-no-files-found: error | |
| build_sdist: | |
| name: sdist | |
| runs-on: ubuntu-22.04 | |
| needs: unit_tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build frontend | |
| run: python -m pip install --upgrade pip build | |
| - name: Build source distribution | |
| run: python -m build --sdist | |
| - name: Upload sdist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| publish: | |
| name: Publish To PyPI | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: | |
| - build_linux_wheels | |
| - build_windows_wheels | |
| - build_sdist | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/rayd | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download wheel artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - name: Download sdist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist | |
| - name: Remove non-package files | |
| shell: bash | |
| run: find dist -maxdepth 1 -type f ! \( -name '*.whl' -o -name '*.tar.gz' \) -delete | |
| - name: Publish distributions | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist | |
| verbose: true |