Use Python 3.15b2 for now until cibuildwheel is updated (#2433) #4
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
| # SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| host-platform: | ||
| required: true | ||
| type: string | ||
| cuda-version: | ||
| required: true | ||
| type: string | ||
| defaults: | ||
| run: | ||
| shell: bash --noprofile --norc -xeuo pipefail {0} | ||
| permissions: | ||
| contents: read # This is required for actions/checkout | ||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: | ||
| - "3.10" | ||
| - "3.11" | ||
| - "3.12" | ||
| - "3.13" | ||
| - "3.14" | ||
| - "3.14t" | ||
| - "3.15" | ||
| - "3.15t" | ||
| name: py${{ matrix.python-version }} | ||
| runs-on: ${{ (inputs.host-platform == 'linux-64' && 'linux-amd64-cpu8') || | ||
| (inputs.host-platform == 'linux-aarch64' && 'linux-arm64-cpu8') || | ||
| (inputs.host-platform == 'win-64' && 'windows-2022') }} | ||
| steps: | ||
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup proxy cache | ||
| uses: nv-gha-runners/setup-proxy-cache@main | ||
| continue-on-error: true | ||
| # Skip cache on GitHub-hosted Windows runners. | ||
| if: ${{ inputs.host-platform != 'win-64' }} | ||
| with: | ||
| enable-apt: true | ||
| - name: Set up Python | ||
| id: setup-python1 | ||
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | ||
| with: | ||
| # WAR: setup-python is not relocatable, and cibuildwheel hard-wires to 3.12... | ||
| # see https://github.com/actions/setup-python/issues/871 | ||
| python-version: "3.12" | ||
| - name: Set up MSVC | ||
| if: ${{ startsWith(inputs.host-platform, 'win') }} | ||
| uses: ilammy/msvc-dev-cmd@v1 # TODO: ask admin to allow pinning commits | ||
| - name: Set environment variables | ||
| env: | ||
| CUDA_VER: ${{ inputs.cuda-version }} | ||
| HOST_PLATFORM: ${{ inputs.host-platform }} | ||
| PY_VER: ${{ matrix.python-version }} | ||
| SHA: ${{ github.sha }} | ||
| run: ./ci/tools/env-vars build | ||
| - name: Dump environment | ||
| run: | | ||
| env | ||
| - name: Install twine | ||
| run: | | ||
| pip install twine | ||
| # To keep the build workflow simple, all matrix jobs will build a wheel for later use within this workflow. | ||
| - name: Build and check cuda.pathfinder wheel | ||
| run: | | ||
| pushd cuda_pathfinder | ||
| pip wheel -v --no-deps . | ||
| popd | ||
| - name: List the cuda.pathfinder artifacts directory | ||
| run: | | ||
| if [[ "${{ inputs.host-platform }}" == win* ]]; then | ||
| export CHOWN=chown | ||
| else | ||
| export CHOWN="sudo chown" | ||
| fi | ||
| $CHOWN -R $(whoami) cuda_pathfinder/*.whl | ||
| ls -lahR cuda_pathfinder | ||
| # We only need/want a single pure python wheel, pick linux-64 index 0. | ||
| # This is what we will use for testing & releasing. | ||
| - name: Check cuda.pathfinder wheel | ||
| if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} | ||
| run: | | ||
| twine check cuda_pathfinder/*.whl | ||
| - name: Upload cuda.pathfinder build artifacts | ||
| if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: cuda-pathfinder-wheel | ||
| path: cuda_pathfinder/*.whl | ||
| if-no-files-found: error | ||
| - name: Build cuda.core wheel | ||
| uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 | ||
| env: | ||
| CIBW_BUILD: ${{ env.CIBW_BUILD }} | ||
| CIBW_ARCHS_LINUX: "native" | ||
| CIBW_BUILD_VERBOSITY: 1 | ||
| CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" | ||
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}" | ||
| CIBW_ENVIRONMENT: > | ||
| CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} | ||
| CIBW_ENABLE: "cpython-prerelease" | ||
| with: | ||
| package-dir: ./cuda_core/ | ||
| output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} | ||
| - name: List the cuda.core artifacts directory | ||
| run: | | ||
| if [[ "${{ inputs.host-platform }}" == win* ]]; then | ||
| export CHOWN=chown | ||
| else | ||
| export CHOWN="sudo chown" | ||
| fi | ||
| $CHOWN -R $(whoami) ${{ env.CUDA_CORE_ARTIFACTS_DIR }} | ||
| ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }} | ||
| - name: Check cuda.core wheel | ||
| run: | | ||
| twine check ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl | ||
| - name: Upload cuda.core build artifacts | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} | ||
| path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl | ||
| if-no-files-found: error | ||
| - name: Set up mini CTK | ||
| uses: ./.github/actions/fetch_ctk | ||
| continue-on-error: false | ||
| with: | ||
| host-platform: ${{ inputs.host-platform }} | ||
| cuda-version: ${{ inputs.cuda-version }} | ||
| - name: Build cuda.bindings wheel | ||
| uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 | ||
| env: | ||
| CIBW_BUILD: ${{ env.CIBW_BUILD }} | ||
| CIBW_ARCHS_LINUX: "native" | ||
| CIBW_BUILD_VERBOSITY: 1 | ||
| # CIBW mounts the host filesystem under /host | ||
| CIBW_ENVIRONMENT_LINUX: > | ||
| CUDA_PATH=/host/${{ env.CUDA_PATH }} | ||
| CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} | ||
| CIBW_ENVIRONMENT_WINDOWS: > | ||
| CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})" | ||
| CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }} | ||
| CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" | ||
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}" | ||
| CIBW_ENABLE: "cpython-prerelease" | ||
| with: | ||
| package-dir: ./cuda_bindings/ | ||
| output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} | ||
| - name: List the cuda.bindings artifacts directory | ||
| run: | | ||
| if [[ "${{ inputs.host-platform }}" == win* ]]; then | ||
| export CHOWN=chown | ||
| else | ||
| export CHOWN="sudo chown" | ||
| fi | ||
| $CHOWN -R $(whoami) ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} | ||
| ls -lahR ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} | ||
| - name: Check cuda.bindings wheel | ||
| run: | | ||
| twine check ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl | ||
| - name: Upload cuda.bindings build artifacts | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} | ||
| path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl | ||
| if-no-files-found: error | ||
| # We only need/want a single pure python wheel, pick linux-64 index 0. | ||
| - name: Build and check cuda-python wheel | ||
| if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} | ||
| run: | | ||
| pushd cuda_python | ||
| pip wheel -v --no-deps . | ||
| twine check *.whl | ||
| popd | ||
| - name: List the cuda-python artifacts directory | ||
| if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} | ||
| run: | | ||
| if [[ "${{ inputs.host-platform }}" == win* ]]; then | ||
| export CHOWN=chown | ||
| else | ||
| export CHOWN="sudo chown" | ||
| fi | ||
| $CHOWN -R $(whoami) cuda_python/*.whl | ||
| ls -lahR cuda_python | ||
| - name: Upload cuda-python build artifacts | ||
| if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: cuda-python-wheel | ||
| path: cuda_python/*.whl | ||
| if-no-files-found: error | ||
| - name: Set up Python | ||
| id: setup-python2 | ||
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | ||
| with: | ||
| <<<<<<< HEAD | ||
| # workaround for actions/runner-images#12377 (the cached 3.13.4 is buggy on Windows) | ||
| python-version: ${{ matrix.python-version == '3.13' && '3.13.5' || matrix.python-version }} | ||
| # allow prereleases only fetches prereleases for unreleased versions of Python | ||
| allow-prereleases: true | ||
| ======= | ||
| # TODO: Pin beta.2 precisely until cibuildwheel catches up (b4 broke ABI for Cython); | ||
| # this precise pin requires the explicit `freethreaded`. | ||
| # When 3.15 is officially supported we can also remove the `allow-prereleases` override. | ||
| python-version: ${{ startsWith(matrix.python-version, '3.15') && '3.15.0-beta.2' || matrix.python-version }} | ||
| freethreaded: ${{ endsWith(matrix.python-version, 't') }} | ||
| allow-prereleases: ${{ startsWith(matrix.python-version, '3.15') }} | ||
| >>>>>>> 3ef82d6892d (Use Python 3.15b2 for now until cibuildwheel is updated (#2433)) | ||
| - name: verify free-threaded build | ||
| if: endsWith(matrix.python-verison, 't') | ||
| run: python -c 'import sys; assert not sys._is_gil_enabled()' | ||
| - name: Set up Python include paths | ||
| run: | | ||
| if [[ "${{ inputs.host-platform }}" == linux* ]]; then | ||
| echo "CPLUS_INCLUDE_PATH=${Python3_ROOT_DIR}/include/python${{ matrix.python-version }}" >> $GITHUB_ENV | ||
| elif [[ "${{ inputs.host-platform }}" == win* ]]; then | ||
| echo "CL=/I\"${Python3_ROOT_DIR}\include\python${{ matrix.python-version }}\"" >> $GITHUB_ENV | ||
| fi | ||
| # For caching | ||
| echo "PY_EXT_SUFFIX=$(python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")" >> $GITHUB_ENV | ||
| - name: Install cuda.pathfinder (required for next step) | ||
| run: | | ||
| pip install cuda_pathfinder/*.whl | ||
| - name: Hide GNU link.exe so Meson finds MSVC link.exe | ||
| if: ${{ startsWith(inputs.host-platform, 'win') }} | ||
| run: | | ||
| if [ -f "/c/Program Files/Git/usr/bin/link.exe" ]; then | ||
| mv "/c/Program Files/Git/usr/bin/link.exe" "/c/Program Files/Git/usr/bin/link.exe.bak" | ||
| fi | ||
| - name: Download and patch numpy sdist (pre-release Python) | ||
| if: ${{ startsWith(matrix.python-version, '3.15') }} | ||
| run: | | ||
| pip download --no-binary numpy --no-deps "numpy>=1.21.1" -d numpy-sdist/ | ||
| cd numpy-sdist && tar xf numpy-*.tar.gz && rm numpy-*.tar.gz | ||
| # WAR: numpy 2.4.x ships [tool.cibuildwheel] config that is | ||
| # incompatible with cibuildwheel v4.0 (cpython-freethreading enable | ||
| # group, OpenBLAS before-build scripts, etc.). Strip the cibuildwheel | ||
| # sections but preserve [tool.meson-python] (vendored meson path). | ||
| python -c " | ||
| import glob | ||
| for f in glob.glob('numpy-*/pyproject.toml'): | ||
| lines, skip = open(f).readlines(), False | ||
| out = [] | ||
| for line in lines: | ||
| hdr = line.strip() | ||
| if hdr.startswith('[tool.cibuildwheel') or hdr.startswith('[[tool.cibuildwheel'): | ||
| skip = True | ||
| continue | ||
| if skip and hdr.startswith('[') and 'cibuildwheel' not in hdr: | ||
| skip = False | ||
| if not skip: | ||
| out.append(line) | ||
| open(f, 'w').writelines(out) | ||
| " | ||
| echo "NUMPY_SRC_DIR=$(pwd)/$(ls -d numpy-*/)" >> $GITHUB_ENV | ||
| - name: Build numpy wheel (pre-release Python) | ||
| if: ${{ startsWith(matrix.python-version, '3.15') }} | ||
| uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 | ||
| env: | ||
| CIBW_BUILD: ${{ env.CIBW_BUILD }} | ||
| CIBW_ARCHS_LINUX: "native" | ||
| CIBW_BUILD_VERBOSITY: 1 | ||
| CIBW_CONFIG_SETTINGS: "setup-args=-Dallow-noblas=true" | ||
| CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv setup-args=-Dallow-noblas=true" | ||
| CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" | ||
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" | ||
| CIBW_ENABLE: "cpython-prerelease" | ||
| with: | ||
| package-dir: ${{ env.NUMPY_SRC_DIR }} | ||
| output-dir: numpy-wheel/ | ||
| - name: Upload numpy wheel | ||
| if: ${{ startsWith(matrix.python-version, '3.15') }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }} | ||
| path: numpy-wheel/*.whl | ||
| if-no-files-found: error | ||
| - name: Install numpy wheel | ||
| if: ${{ startsWith(matrix.python-version, '3.15') }} | ||
| run: pip install numpy-wheel/*.whl | ||
| - name: Build cuda.bindings Cython tests | ||
| run: | | ||
| pip install $(ls ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl)[test] | ||
| pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }} | ||
| bash build_tests.sh | ||
| popd | ||
| - name: Upload cuda.bindings Cython tests | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests | ||
| path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }} | ||
| if-no-files-found: error | ||
| - name: Build cuda.core Cython tests | ||
| run: | | ||
| pip install $(ls ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl)[test] | ||
| pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }} | ||
| bash build_tests.sh | ||
| popd | ||
| - name: Upload cuda.core Cython tests | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests | ||
| path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }} | ||
| if-no-files-found: error | ||