Skip to content

Commit 7dec124

Browse files
committed
ci: add selective wheel test plumbing
1 parent 3140b8f commit 7dec124

2 files changed

Lines changed: 115 additions & 64 deletions

File tree

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

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@ on:
2222
nruns:
2323
type: number
2424
default: 1
25-
# When true, cuda.bindings tests (and the Cython tests that depend on
26-
# them) are skipped even when CTK majors match. Callers set this based
27-
# on the output of the detect-changes job in ci.yml so PRs that only
28-
# touch unrelated modules avoid the expensive bindings test suite.
29-
skip-bindings-test:
25+
test-pathfinder:
3026
type: boolean
31-
default: false
27+
default: true
28+
test-bindings:
29+
type: boolean
30+
default: true
31+
test-core:
32+
type: boolean
33+
default: true
34+
test-python:
35+
type: boolean
36+
default: true
3237
run-id:
3338
description: >
3439
Workflow run ID to download artifacts from.
@@ -159,7 +164,7 @@ jobs:
159164
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
160165
PY_VER: ${{ matrix.PY_VER }}
161166
SHA: ${{ inputs.sha || github.sha }}
162-
SKIP_BINDINGS_TEST_OVERRIDE: ${{ inputs.skip-bindings-test && '1' || '0' }}
167+
SKIP_BINDINGS_TEST_OVERRIDE: ${{ !inputs.test-bindings && '1' || '0' }}
163168
run: ./ci/tools/env-vars test
164169

165170
- name: Apply extra matrix environment variables
@@ -169,6 +174,7 @@ jobs:
169174
run: echo "$MATRIX_ENV" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> "$GITHUB_ENV"
170175

171176
- name: Download cuda-pathfinder build artifacts
177+
if: ${{ inputs.test-pathfinder || inputs.test-bindings || inputs.test-core || inputs.test-python }}
172178
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
173179
with:
174180
name: cuda-pathfinder-wheel
@@ -177,7 +183,7 @@ jobs:
177183
github-token: ${{ secrets.GITHUB_TOKEN }}
178184

179185
- name: Download cuda-python build artifacts
180-
if: ${{ env.BINDINGS_SOURCE == 'main' }}
186+
if: ${{ inputs.test-python && env.BINDINGS_SOURCE == 'main' }}
181187
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
182188
with:
183189
name: cuda-python-wheel
@@ -186,7 +192,8 @@ jobs:
186192
github-token: ${{ secrets.GITHUB_TOKEN }}
187193

188194
- name: Download cuda.bindings build artifacts
189-
if: ${{ env.BINDINGS_SOURCE == 'main' }}
195+
if: ${{ (inputs.test-bindings || inputs.test-core || inputs.test-python) &&
196+
env.BINDINGS_SOURCE == 'main' }}
190197
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
191198
with:
192199
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
@@ -195,7 +202,8 @@ jobs:
195202
github-token: ${{ secrets.GITHUB_TOKEN }}
196203

197204
- name: Download cuda-python & cuda.bindings build artifacts from the prior branch
198-
if: ${{ env.BINDINGS_SOURCE == 'backport' }}
205+
if: ${{ (inputs.test-bindings || inputs.test-core || inputs.test-python) &&
206+
env.BINDINGS_SOURCE == 'backport' }}
199207
env:
200208
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201209
run: |
@@ -220,25 +228,28 @@ jobs:
220228
mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/
221229
rmdir $OLD_BASENAME
222230
223-
gh run download $LATEST_PRIOR_RUN_ID -p cuda-python-wheel -R NVIDIA/cuda-python
224-
ls -al cuda-python-wheel
225-
mv cuda-python-wheel/*.whl .
226-
rmdir cuda-python-wheel
231+
if ${{ inputs.test-python }}; then
232+
gh run download $LATEST_PRIOR_RUN_ID -p cuda-python-wheel -R NVIDIA/cuda-python
233+
ls -al cuda-python-wheel
234+
mv cuda-python-wheel/*.whl .
235+
rmdir cuda-python-wheel
236+
fi
227237
228238
- name: Display structure of downloaded cuda-python artifacts
229-
if: ${{ env.BINDINGS_SOURCE != 'published' }}
239+
if: ${{ inputs.test-python && env.BINDINGS_SOURCE != 'published' }}
230240
run: |
231241
pwd
232242
ls -lah cuda_python*.whl cuda_pathfinder/
233243
234244
- name: Display structure of downloaded cuda.bindings artifacts
235-
if: ${{ env.BINDINGS_SOURCE != 'published' }}
245+
if: ${{ (inputs.test-bindings || inputs.test-core || inputs.test-python) &&
246+
env.BINDINGS_SOURCE != 'published' }}
236247
run: |
237248
pwd
238249
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
239250
240251
- name: Download cuda.bindings Cython tests
241-
if: ${{ env.SKIP_CYTHON_TEST == '0' }}
252+
if: ${{ inputs.test-bindings && env.SKIP_CYTHON_TEST == '0' }}
242253
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
243254
with:
244255
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests
@@ -247,12 +258,13 @@ jobs:
247258
github-token: ${{ secrets.GITHUB_TOKEN }}
248259

249260
- name: Display structure of downloaded cuda.bindings Cython tests
250-
if: ${{ env.SKIP_CYTHON_TEST == '0' }}
261+
if: ${{ inputs.test-bindings && env.SKIP_CYTHON_TEST == '0' }}
251262
run: |
252263
pwd
253264
ls -lahR $CUDA_BINDINGS_CYTHON_TESTS_DIR
254265
255266
- name: Download cuda.core build artifacts
267+
if: ${{ inputs.test-core }}
256268
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
257269
with:
258270
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
@@ -261,12 +273,13 @@ jobs:
261273
github-token: ${{ secrets.GITHUB_TOKEN }}
262274

263275
- name: Display structure of downloaded cuda.core build artifacts
276+
if: ${{ inputs.test-core }}
264277
run: |
265278
pwd
266279
ls -lahR $CUDA_CORE_ARTIFACTS_DIR
267280
268281
- name: Download cuda.core Cython tests
269-
if: ${{ env.SKIP_CYTHON_TEST == '0' }}
282+
if: ${{ inputs.test-core && env.SKIP_CYTHON_TEST == '0' }}
270283
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
271284
with:
272285
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests
@@ -275,12 +288,13 @@ jobs:
275288
github-token: ${{ secrets.GITHUB_TOKEN }}
276289

277290
- name: Display structure of downloaded cuda.core Cython tests
278-
if: ${{ env.SKIP_CYTHON_TEST == '0' }}
291+
if: ${{ inputs.test-core && env.SKIP_CYTHON_TEST == '0' }}
279292
run: |
280293
pwd
281294
ls -lahR $CUDA_CORE_CYTHON_TESTS_DIR
282295
283296
- name: Download cuda.core test binaries
297+
if: ${{ inputs.test-core }}
284298
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
285299
with:
286300
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-test-binaries
@@ -289,6 +303,7 @@ jobs:
289303
github-token: ${{ secrets.GITHUB_TOKEN }}
290304

291305
- name: Display structure of downloaded cuda.core test binaries
306+
if: ${{ inputs.test-core }}
292307
run: |
293308
pwd
294309
ls -lahR $CUDA_CORE_TEST_BINARIES_DIR
@@ -304,7 +319,7 @@ jobs:
304319
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
305320

306321
- name: Enable Scientific Python Nightly Wheels for Python 3.15
307-
if: ${{ startsWith(matrix.PY_VER, '3.15') }}
322+
if: ${{ (inputs.test-bindings || inputs.test-core) && startsWith(matrix.PY_VER, '3.15') }}
308323
run: |
309324
echo "PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> "$GITHUB_ENV"
310325
echo "PIP_ONLY_BINARY=numpy" >> "$GITHUB_ENV"
@@ -318,7 +333,7 @@ jobs:
318333
cuda-version: ${{ matrix.CUDA_VER }}
319334

320335
- name: Set up latest cuda_sanitizer_api
321-
if: ${{ env.SETUP_SANITIZER == '1' }}
336+
if: ${{ (inputs.test-bindings || inputs.test-core) && env.SETUP_SANITIZER == '1' }}
322337
uses: ./.github/actions/fetch_ctk
323338
continue-on-error: false
324339
with:
@@ -327,22 +342,23 @@ jobs:
327342
cuda-components: "cuda_sanitizer_api"
328343

329344
- name: Set up compute-sanitizer
345+
if: ${{ inputs.test-bindings || inputs.test-core }}
330346
run: setup-sanitizer
331347

332348
- name: Set up test repetition on nightly runs
333349
run: echo "PYTEST_ADDOPTS=\"--count=${{ inputs.nruns }}\"" >> "$GITHUB_ENV"
334350

335351
# ── Standard test steps (skipped for nightly modes) ──
336352
- name: Run cuda.pathfinder tests with see_what_works
337-
if: ${{ inputs.test-mode == 'standard' }}
353+
if: ${{ inputs.test-mode == 'standard' && inputs.test-pathfinder }}
338354
env:
339355
CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: see_what_works
340356
CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: see_what_works
341357
CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: see_what_works
342358
run: run-tests pathfinder
343359

344360
- name: Run cuda.bindings tests
345-
if: ${{ inputs.test-mode == 'standard' && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
361+
if: ${{ inputs.test-mode == 'standard' && inputs.test-bindings && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
346362
env:
347363
CUDA_VER: ${{ matrix.CUDA_VER }}
348364
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
@@ -352,33 +368,43 @@ jobs:
352368
run: run-tests bindings
353369

354370
- name: Run cuda.bindings benchmarks (smoke test)
355-
if: ${{ inputs.test-mode == 'standard' && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
371+
if: ${{ inputs.test-mode == 'standard' && inputs.test-bindings && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
356372
run: |
357373
pip install pyperf
358374
pushd benchmarks/cuda_bindings
359375
python run_pyperf.py --debug-single-value
360376
popd
361377
362378
- name: Run cuda.core tests
363-
if: ${{ inputs.test-mode == 'standard' }}
379+
if: ${{ inputs.test-mode == 'standard' && inputs.test-core }}
364380
env:
365381
CUDA_VER: ${{ matrix.CUDA_VER }}
366382
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
367383
run: run-tests core
368384

369385
- name: Ensure cuda-python installable
370-
if: ${{ inputs.test-mode == 'standard' && env.BINDINGS_SOURCE == 'main' }}
386+
if: ${{ inputs.test-mode == 'standard' && inputs.test-python && env.BINDINGS_SOURCE == 'main' }}
371387
run: |
372-
# Subpackages are already installed from CI artifacts; --no-deps keeps
373-
# tag-release cuda-core wheels from being replaced by PyPI pins.
388+
# Package suites install their own dependencies. A metapackage-only
389+
# run has no preceding suite, so resolve its exact cuda-bindings pin
390+
# from this run while allowing its released cuda-core pin from PyPI.
391+
if ${{ inputs.test-bindings || inputs.test-core }}; then
392+
dependency_args=(--no-deps)
393+
else
394+
dependency_args=(
395+
--find-links ./cuda_pathfinder
396+
--find-links "${CUDA_BINDINGS_ARTIFACTS_DIR}"
397+
)
398+
fi
399+
wheel=$(ls cuda_python*.whl)
374400
if [[ "${{ matrix.LOCAL_CTK }}" == 1 ]]; then
375-
pip install --only-binary=:all: --no-deps cuda_python*.whl
401+
pip install --only-binary=:all: "${dependency_args[@]}" "${wheel}"
376402
else
377-
pip install --only-binary=:all: --no-deps $(ls cuda_python*.whl)[all]
403+
pip install --only-binary=:all: "${dependency_args[@]}" "${wheel}[all]"
378404
fi
379405
380406
- name: Install cuda.pathfinder extra wheels for testing
381-
if: ${{ inputs.test-mode == 'standard' }}
407+
if: ${{ inputs.test-mode == 'standard' && inputs.test-pathfinder }}
382408
run: |
383409
set -euo pipefail
384410
pushd cuda_pathfinder
@@ -387,7 +413,7 @@ jobs:
387413
popd
388414
389415
- name: Run cuda.pathfinder tests with all_must_work
390-
if: ${{ inputs.test-mode == 'standard' }}
416+
if: ${{ inputs.test-mode == 'standard' && inputs.test-pathfinder }}
391417
env:
392418
CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: all_must_work
393419
CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: all_must_work

0 commit comments

Comments
 (0)