@@ -3,30 +3,80 @@ name: "CI: Test wheels"
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
- host-platform :
6
+ build-type :
7
7
type : string
8
8
required : true
9
- python-version :
9
+ host-platform :
10
10
type : string
11
11
required : true
12
12
build-ctk-ver :
13
13
type : string
14
14
required : true
15
- cuda-version :
16
- type : string
17
- required : true
18
- local-ctk :
15
+ matrix_filter :
19
16
type : string
20
- required : true
21
- runner :
22
- type : string
23
- required : true
17
+ default : " ."
24
18
25
19
jobs :
20
+ compute-matrix :
21
+ runs-on : ubuntu-latest
22
+ env :
23
+ BUILD_TYPE : ${{ inputs.build-type }}
24
+ ARCH : ${{ (inputs.host-platform == 'win-64' && 'amd64') }}
25
+ outputs :
26
+ MATRIX : ${{ steps.compute-matrix.outputs.MATRIX }}
27
+ steps :
28
+ - name : Validate Test Type
29
+ run : |
30
+ if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then
31
+ echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'."
32
+ exit 1
33
+ fi
34
+ - name : Compute Python Test Matrix
35
+ id : compute-matrix
36
+ run : |
37
+ set -eo pipefail
38
+
39
+ # Please keep the matrices sorted in ascending order by the following:
40
+ #
41
+ # [PY_VER, CUDA_VER, LOCAL_CTK]
42
+ #
43
+ export MATRICES="
44
+ pull-request:
45
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '0' }
46
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '1' }
47
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '0' }
48
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '1' }
49
+ nightly:
50
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '0' }
51
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '11.8.0', LOCAL_CTK: '1' }
52
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '0' }
53
+ - { ARCH: ${ARCH}, PY_VER: '3.12', CUDA_VER: '12.8.0', LOCAL_CTK: '1' }
54
+ "
55
+
56
+ # Use the nightly matrix for branch tests
57
+ MATRIX_TYPE="${BUILD_TYPE}"
58
+ if [[ "${MATRIX_TYPE}" == "branch" ]]; then
59
+ MATRIX_TYPE="nightly"
60
+ fi
61
+ export MATRIX_TYPE
62
+ TEST_MATRIX=$(yq -n 'env(MATRICES) | .[strenv(MATRIX_TYPE)]')
63
+ export TEST_MATRIX
64
+
65
+ MATRIX="$(
66
+ yq -n -o json 'env(TEST_MATRIX)' | \
67
+ jq -c '${{ inputs.matrix_filter }} | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end'
68
+ )"
69
+
70
+ echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}"
71
+
26
72
test :
27
73
# The build stage could fail but we want the CI to keep moving.
74
+ needs : compute-matrix
75
+ strategy :
76
+ fail-fast : false
77
+ matrix : ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
28
78
if : ${{ github.repository_owner == 'nvidia' && !cancelled() }}
29
- runs-on : ${{ (inputs.runner == 'default' && inputs.host-platform == 'win-64' && ' cuda-python-windows-gpu-github') }}
79
+ runs-on : ' cuda-python-windows-gpu-github'
30
80
steps :
31
81
- name : Checkout ${{ github.event.repository.name }}
32
82
uses : actions/checkout@v4
@@ -42,18 +92,18 @@ jobs:
42
92
43
93
- name : Set environment variables
44
94
run : |
45
- $PYTHON_VERSION_FORMATTED = '${{ inputs.python-version }}' -replace '\.'
95
+ $PYTHON_VERSION_FORMATTED = '${{ matrix.PY_VER }}' -replace '\.'
46
96
$REPO_DIR = $PWD.Path
47
97
48
98
$BUILD_CUDA_MAJOR = '${{ inputs.build-ctk-ver }}' -split '\.' | Select-Object -First 1
49
- $TEST_CUDA_MAJOR = '${{ inputs.cuda-version }}' -split '\.' | Select-Object -First 1
99
+ $TEST_CUDA_MAJOR = '${{ matrix.CUDA_VER }}' -split '\.' | Select-Object -First 1
50
100
if ($BUILD_CUDA_MAJOR -ne $TEST_CUDA_MAJOR) {
51
101
$SKIP_CUDA_BINDINGS_TEST = 1
52
102
} else {
53
103
$SKIP_CUDA_BINDINGS_TEST = 0
54
104
}
55
105
56
- if ('${{ inputs.local-ctk }}' -eq '1') {
106
+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
57
107
if ($TEST_CUDA_MAJOR -eq '12') {
58
108
$MINI_CTK_DEPS = '["nvcc", "nvrtc", "nvjitlink"]'
59
109
} else {
@@ -149,23 +199,23 @@ jobs:
149
199
Get-Location
150
200
Get-ChildItem -Recurse -Force $env:CUDA_CORE_ARTIFACTS_DIR | Select-Object Mode, LastWriteTime, Length, FullName
151
201
152
- - name : Set up Python ${{ inputs.python-version }}
202
+ - name : Set up Python ${{ matrix.PY_VER }}
153
203
uses : actions/setup-python@v5
154
204
with :
155
- python-version : ${{ inputs.python-version }}
205
+ python-version : ${{ matrix.PY_VER }}
156
206
157
207
- name : Set up mini CTK
158
- if : ${{ inputs.local-ctk == '1' }}
208
+ if : ${{ matrix.LOCAL_CTK == '1' }}
159
209
# Note: The GH-hosted Windows GPU runner does not have Git for Windows pre-installed,
160
210
# so we cannot use our own fetch_ctk action unfortunately...
161
211
uses : Jimver/cuda-toolkit@v0.2.21
162
212
with :
163
- cuda : ${{ inputs.cuda-version }}
213
+ cuda : ${{ matrix.CUDA_VER }}
164
214
method : ' network'
165
215
sub-packages : ${{ env.MINI_CTK_DEPS }}
166
216
167
217
- name : Update PATH
168
- if : ${{ inputs.local-ctk == '1' }}
218
+ if : ${{ matrix.LOCAL_CTK == '1' }}
169
219
run : |
170
220
# mimics actual CTK installation
171
221
echo $PATH
@@ -175,7 +225,7 @@ jobs:
175
225
if : ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }}
176
226
run : |
177
227
Push-Location $env:CUDA_BINDINGS_ARTIFACTS_DIR
178
- if ('${{ inputs.local-ctk }}' -eq '1') {
228
+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
179
229
Get-ChildItem $env:CUDA_PATH
180
230
echo $PATH
181
231
pip install (Get-ChildItem -Filter *.whl).FullName
@@ -196,14 +246,14 @@ jobs:
196
246
# If mismatch: cuda.bindings is installed from the backport branch.
197
247
if ($env:SKIP_CUDA_BINDINGS_TEST -eq '1') {
198
248
Push-Location $env:CUDA_BINDINGS_ARTIFACTS_DIR
199
- if ('${{ inputs.local-ctk }}' -eq '1') {
249
+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
200
250
pip install (Get-ChildItem -Filter *.whl).FullName
201
251
} else {
202
252
pip install "$((Get-ChildItem -Filter *.whl).FullName)[all]"
203
253
}
204
254
Pop-Location
205
255
}
206
- $TEST_CUDA_MAJOR = '${{ inputs.cuda-version }}' -split '\.' | Select-Object -First 1
256
+ $TEST_CUDA_MAJOR = '${{ matrix.CUDA_VER }}' -split '\.' | Select-Object -First 1
207
257
Push-Location $env:CUDA_CORE_ARTIFACTS_DIR
208
258
pip install "$((Get-ChildItem -Filter *.whl).FullName)[cu${TEST_CUDA_MAJOR}]"
209
259
Pop-Location
@@ -215,7 +265,7 @@ jobs:
215
265
216
266
- name : Ensure cuda-python installable
217
267
run : |
218
- if ('${{ inputs.local-ctk }}' -eq '1') {
268
+ if ('${{ matrix.LOCAL_CTK }}' -eq '1') {
219
269
pip install (Get-ChildItem -Filter cuda_python*.whl).FullName
220
270
} else {
221
271
pip install "$((Get-ChildItem -Filter cuda_python*.whl).FullName)[all]"
0 commit comments