Skip to content

Use Python 3.15b2 for now until cibuildwheel is updated (#2433) #4

Use Python 3.15b2 for now until cibuildwheel is updated (#2433)

Use Python 3.15b2 for now until cibuildwheel is updated (#2433) #4

# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: "CI: Test wheels"
on:
workflow_call:
inputs:
build-type:
type: string
required: true
host-platform:
type: string
required: true
build-ctk-ver:
type: string
required: true
matrix_filter:
type: string
default: "."
defaults:
run:
shell: bash --noprofile --norc -xeuo pipefail {0}
jobs:
compute-matrix:
runs-on: ubuntu-latest
env:
BUILD_TYPE: ${{ inputs.build-type }}
ARCH: ${{ (inputs.host-platform == 'linux-64' && 'amd64') ||
(inputs.host-platform == 'linux-aarch64' && 'arm64') }}
outputs:
MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }}
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 1
- name: Validate Test Type
run: |
if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then
echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'."
exit 1
fi
- name: Compute Python Test Matrix
id: compute-matrix
run: |
# Use the nightly matrix for branch tests
MATRIX_TYPE="${BUILD_TYPE}"
if [[ "${MATRIX_TYPE}" == "branch" ]]; then
MATRIX_TYPE="nightly"
fi
# Read base matrix from JSON file for the specific architecture
TEST_MATRIX=$(jq --arg arch "$ARCH" --arg matrix_type "$MATRIX_TYPE" '
.linux[$matrix_type] |
map(select(.ARCH == $arch))
' ci/test-matrix.json)
# Add special runner for amd64 if applicable
if [[ "${ARCH}" == "amd64" ]]; then
SPECIAL_RUNNERS=$(jq '
.linux.special_runners.amd64
' ci/test-matrix.json)
TEST_MATRIX=$(jq --argjson special "$SPECIAL_RUNNERS" '. + $special' <<< "$TEST_MATRIX")
fi
MATRIX="$(
jq -c '${{ inputs.matrix_filter }} | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end' <<< "$TEST_MATRIX"
)"
echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}"
test:
name: py${{ matrix.PY_VER }}, ${{ matrix.CUDA_VER }}, ${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}, GPU ${{ matrix.GPU }}
needs: compute-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
runs-on: "linux-${{ matrix.ARCH }}-gpu-${{ matrix.GPU }}-${{ matrix.DRIVER }}-1"
# The build stage could fail but we want the CI to keep moving.
if: ${{ github.repository_owner == 'nvidia' && !cancelled() }}
# Our self-hosted runners require a container
# TODO: use a different (nvidia?) container
container:
options: -u root --security-opt seccomp=unconfined --shm-size 16g
image: ubuntu:22.04
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
steps:
- name: Ensure GPU is working
run: nvidia-smi
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/actions/install_unix_deps
continue-on-error: false
with:
# for artifact fetching
dependencies: "jq wget"
dependent_exes: "jq wget"
- name: Set environment variables
env:
BUILD_CUDA_VER: ${{ inputs.build-ctk-ver }}
CUDA_VER: ${{ matrix.CUDA_VER }}
HOST_PLATFORM: ${{ inputs.host-platform }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
PY_VER: ${{ matrix.PY_VER }}
SHA: ${{ github.sha }}
run: ./ci/tools/env-vars test
- name: Install GitHub CLI
# gh is needed for artifact fetching in subsequent steps
run: |
# See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt.
mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y
- name: Download cuda-pathfinder build artifacts from main branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
MAIN_BRANCH="main"
PATHFINDER_BASENAME="cuda-pathfinder-wheel"
LATEST_MAIN_RUN_ID=$(gh run list -b ${MAIN_BRANCH} -L 1 -w "CI" -s success -R NVIDIA/cuda-python --json databaseId | jq '.[]| .databaseId')
if [[ "$LATEST_MAIN_RUN_ID" == "" ]]; then
echo "LATEST_MAIN_RUN_ID not found!"
exit 1
fi
gh run download $LATEST_MAIN_RUN_ID -p ${PATHFINDER_BASENAME} -R NVIDIA/cuda-python
ls -al $PATHFINDER_BASENAME
mkdir -p ./cuda_pathfinder
mv $PATHFINDER_BASENAME/*.whl ./cuda_pathfinder/
rmdir $PATHFINDER_BASENAME
- name: Download cuda-python build artifacts
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0'}}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: cuda-python-wheel
path: .
- name: Download cuda.bindings build artifacts
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0'}}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
- name: Download cuda-python & cuda.bindings build artifacts from the prior branch
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '1'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
OLD_BRANCH=$(cat .github/BACKPORT_BRANCH)
OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*"
LATEST_PRIOR_RUN_ID=$(gh run list -b ${OLD_BRANCH} -L 1 -w "build-and-test.yml" -s success -R NVIDIA/cuda-python --json databaseId | jq '.[]| .databaseId')
if [[ "$LATEST_PRIOR_RUN_ID" == "" ]]; then
echo "LATEST_PRIOR_RUN_ID not found!"
exit 1
fi
gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python
ls -al $OLD_BASENAME
mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/
rmdir $OLD_BASENAME
gh run download $LATEST_PRIOR_RUN_ID -p cuda-python-wheel -R NVIDIA/cuda-python
ls -al cuda-python-wheel
mv cuda-python-wheel/*.whl .
rmdir cuda-python-wheel
- name: Display structure of downloaded cuda-python artifacts
run: |
pwd
ls -lahR .
- name: Display structure of downloaded cuda.bindings artifacts
run: |
pwd
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
- name: Download cuda.bindings Cython tests
if: ${{ env.SKIP_CYTHON_TEST == '0' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests
path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}
- name: Display structure of downloaded cuda.bindings Cython tests
if: ${{ env.SKIP_CYTHON_TEST == '0' }}
run: |
pwd
ls -lahR $CUDA_BINDINGS_CYTHON_TESTS_DIR
- name: Set up Python ${{ matrix.PY_VER }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
<<<<<<< HEAD

Check failure on line 217 in .github/workflows/test-wheel-linux.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/test-wheel-linux.yml

Invalid workflow file

You have an error in your yaml syntax on line 217
python-version: ${{ matrix.PY_VER }}
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.PY_VER, '3.15') && '3.15.0-beta.2' || matrix.PY_VER }}
freethreaded: ${{ endsWith(matrix.PY_VER, 't') }}
allow-prereleases: ${{ startsWith(matrix.PY_VER, '3.15') }}
>>>>>>> 3ef82d6892d (Use Python 3.15b2 for now until cibuildwheel is updated (#2433))
env:
# we use self-hosted runners on which setup-python behaves weirdly...
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
- name: Set up mini CTK
if: ${{ matrix.LOCAL_CTK == '1' }}
uses: ./.github/actions/fetch_ctk
continue-on-error: false
with:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ matrix.CUDA_VER }}
- name: Set up latest cuda_sanitizer_api
if: ${{ env.SETUP_SANITIZER == '1' }}
uses: ./.github/actions/fetch_ctk
continue-on-error: false
with:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ env.LATEST_CUDA_VERSION }}
cuda-components: "cuda_sanitizer_api"
- name: Set up compute-sanitizer
run: setup-sanitizer
- name: Download numpy wheel (pre-release Python)
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: numpy-python${{ env.PYTHON_VERSION_FORMATTED }}-${{ inputs.host-platform }}
path: numpy-wheel
- name: Install numpy wheel (pre-release Python)
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
run: pip install numpy-wheel/*.whl
- name: Run cuda.bindings tests
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests bindings
- name: Ensure cuda-python installable
run: |
if [[ "${{ matrix.LOCAL_CTK }}" == 1 ]]; then
pip install cuda_python*.whl
else
pip install $(ls cuda_python*.whl)[all]
fi