@@ -7,30 +7,80 @@ name: "CI: Test wheels"
77on :
88 workflow_call :
99 inputs :
10- host-platform :
10+ build-type :
1111 type : string
1212 required : true
13- python-version :
13+ host-platform :
1414 type : string
1515 required : true
1616 build-ctk-ver :
1717 type : string
1818 required : true
19- cuda-version :
19+ matrix_filter :
2020 type : string
21- required : true
22- local-ctk :
23- type : string
24- required : true
25- runner :
26- type : string
27- required : true
21+ default : " ."
2822
2923jobs :
24+ compute-matrix :
25+ runs-on : ubuntu-latest
26+ env :
27+ BUILD_TYPE : ${{ inputs.build-type }}
28+ ARCH : ${{ (inputs.host-platform == 'win-64' && 'amd64') }}
29+ outputs :
30+ MATRIX : ${{ steps.compute-matrix.outputs.MATRIX }}
31+ steps :
32+ - name : Validate Test Type
33+ run : |
34+ if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then
35+ echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'."
36+ exit 1
37+ fi
38+ - name : Compute Python Test Matrix
39+ id : compute-matrix
40+ run : |
41+ set -eo pipefail
42+
43+ # Please keep the matrices sorted in ascending order by the following:
44+ #
45+ # [PY_VER, CUDA_VER, LOCAL_CTK]
46+ #
47+ export MATRICES="
48+ pull-request:
49+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '0' }
50+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '1' }
51+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '0' }
52+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '1' }
53+ nightly:
54+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '0' }
55+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '1' }
56+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '0' }
57+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '1' }
58+ "
59+
60+ # Use the nightly matrix for branch tests
61+ MATRIX_TYPE="${BUILD_TYPE}"
62+ if [[ "${MATRIX_TYPE}" == "branch" ]]; then
63+ MATRIX_TYPE="nightly"
64+ fi
65+ export MATRIX_TYPE
66+ TEST_MATRIX=$(yq -n 'env(MATRICES) | .[strenv(MATRIX_TYPE)]')
67+ export TEST_MATRIX
68+
69+ MATRIX="$(
70+ yq -n -o json 'env(TEST_MATRIX)' | \
71+ jq -c '${{ inputs.matrix_filter }} | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end'
72+ )"
73+
74+ echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}"
75+
3076 test :
3177 # The build stage could fail but we want the CI to keep moving.
78+ needs : compute-matrix
79+ strategy :
80+ fail-fast : false
81+ matrix : ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
3282 if : ${{ github.repository_owner == 'nvidia' && !cancelled() }}
33- runs-on : ${{ (inputs.runner == 'default' && inputs.host-platform == 'win-64' && ' cuda-python-windows-gpu-github') }}
83+ runs-on : ' cuda-python-windows-gpu-github'
3484 steps :
3585 - name : Checkout ${{ github.event.repository.name }}
3686 uses : actions/checkout@v4
@@ -46,11 +96,11 @@ jobs:
4696
4797 - name : Set environment variables
4898 run : |
49- $PYTHON_VERSION_FORMATTED = '${{ inputs.python-version }}' -replace '\.'
99+ $PYTHON_VERSION_FORMATTED = '${{ matrix.PY_VER }}' -replace '\.'
50100 $REPO_DIR = $PWD.Path
51101
52102 $BUILD_CUDA_MAJOR = '${{ inputs.build-ctk-ver }}' -split '\.' | Select-Object -First 1
53- $TEST_CUDA_MAJOR = '${{ inputs.cuda-version }}' -split '\.' | Select-Object -First 1
103+ $TEST_CUDA_MAJOR = '${{ matrix.CUDA_VER }}' -split '\.' | Select-Object -First 1
54104 if ($BUILD_CUDA_MAJOR -ne $TEST_CUDA_MAJOR) {
55105 $SKIP_CUDA_BINDINGS_TEST = 1
56106 } else {
@@ -174,24 +224,24 @@ jobs:
174224 Get-Location
175225 Get-ChildItem -Recurse -Force $env:CUDA_CORE_ARTIFACTS_DIR | Select-Object Mode, LastWriteTime, Length, FullName
176226
177- - name : Set up Python ${{ inputs.python-version }}
227+ - name : Set up Python ${{ matrix.PY_VER }}
178228 uses : actions/setup-python@v5
179229 with :
180- python-version : ${{ inputs.python-version }}
230+ python-version : ${{ matrix.PY_VER }}
181231
182232 - name : Set up mini CTK
183- if : ${{ inputs.local-ctk == '1' }}
233+ if : ${{ matrix.LOCAL_CTK == '1' }}
184234 uses : ./.github/actions/fetch_ctk
185235 continue-on-error : false
186236 with :
187237 host-platform : ${{ inputs.host-platform }}
188- cuda-version : ${{ inputs.cuda-version }}
238+ cuda-version : ${{ matrix.CUDA_VER }}
189239
190240 - name : Run cuda.bindings tests
191241 if : ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }}
192242 run : |
193243 Push-Location $env:CUDA_BINDINGS_ARTIFACTS_DIR
194- if ('${{ inputs.local-ctk }}' -eq '1') {
244+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
195245 Get-ChildItem $env:CUDA_PATH
196246 echo $PATH
197247 pip install (Get-ChildItem -Filter *.whl).FullName
@@ -212,14 +262,14 @@ jobs:
212262 # If mismatch: cuda.bindings is installed from the backport branch.
213263 if ($env:SKIP_CUDA_BINDINGS_TEST -eq '1') {
214264 Push-Location $env:CUDA_BINDINGS_ARTIFACTS_DIR
215- if ('${{ inputs.local-ctk }}' -eq '1') {
265+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
216266 pip install (Get-ChildItem -Filter *.whl).FullName
217267 } else {
218268 pip install "$((Get-ChildItem -Filter *.whl).FullName)[all]"
219269 }
220270 Pop-Location
221271 }
222- $TEST_CUDA_MAJOR = '${{ inputs.cuda-version }}' -split '\.' | Select-Object -First 1
272+ $TEST_CUDA_MAJOR = '${{ matrix.CUDA_VER }}' -split '\.' | Select-Object -First 1
223273 Push-Location $env:CUDA_CORE_ARTIFACTS_DIR
224274 pip install "$((Get-ChildItem -Filter *.whl).FullName)[cu${TEST_CUDA_MAJOR}]"
225275 Pop-Location
@@ -231,7 +281,7 @@ jobs:
231281
232282 - name : Ensure cuda-python installable
233283 run : |
234- if ('${{ inputs.local-ctk }}' -eq '1') {
284+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
235285 pip install (Get-ChildItem -Filter cuda_python*.whl).FullName
236286 } else {
237287 pip install "$((Get-ChildItem -Filter cuda_python*.whl).FullName)[all]"
0 commit comments