1
+ # Note: This name is referred to in the test job, so make sure any changes are sync'd up!
1
2
name : " CI: Build and test"
2
3
3
4
concurrency :
42
43
# (matrix.host-platform == 'win-64' && 'windows-amd64-cpu8') }}
43
44
outputs :
44
45
BUILD_CTK_VER : ${{ steps.pass_env.outputs.CUDA_VERSION }}
46
+ defaults :
47
+ run :
48
+ shell : bash --noprofile --norc -xeuo pipefail {0}
45
49
steps :
46
50
- name : Checkout ${{ github.event.repository.name }}
47
51
uses : actions/checkout@v4
62
66
uses : ilammy/msvc-dev-cmd@v1
63
67
64
68
- name : Set environment variables
65
- shell : bash --noprofile --norc -xeuo pipefail {0}
66
69
run : |
67
70
PYTHON_VERSION_FORMATTED=$(echo '${{ matrix.python-version }}' | tr -d '.')
68
71
if [[ "${{ matrix.host-platform }}" == linux* ]]; then
@@ -75,14 +78,17 @@ jobs:
75
78
fi
76
79
77
80
echo "PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV
78
- echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}-${{ github.sha }}" >> $GITHUB_ENV
81
+ CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}"
82
+ echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
83
+ echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
79
84
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
80
- echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ matrix.cuda-version }}-${{ matrix.host-platform }}-${{ github.sha }}" >> $GITHUB_ENV
85
+ CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ matrix.cuda-version }}-${{ matrix.host-platform }}"
86
+ echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
87
+ echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
81
88
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
82
89
echo "CIBW_BUILD=${CIBW_BUILD}" >> $GITHUB_ENV
83
-
90
+
84
91
- name : Dump environment
85
- shell : bash --noprofile --norc -xeuo pipefail {0}
86
92
run : |
87
93
env
88
94
97
103
output-dir : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
98
104
99
105
- name : List the cuda.core artifacts directory
100
- shell : bash --noprofile --norc -xeuo pipefail {0}
101
106
run : |
102
107
if [[ "${{ matrix.host-platform }}" == win* ]]; then
103
108
export CHOWN=chown
@@ -108,7 +113,6 @@ jobs:
108
113
ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
109
114
110
115
- name : Check cuda.core wheel
111
- shell : bash --noprofile --norc -xeuo pipefail {0}
112
116
run : |
113
117
pip install twine
114
118
twine check ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
@@ -146,7 +150,6 @@ jobs:
146
150
output-dir : ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
147
151
148
152
- name : List the cuda.bindings artifacts directory
149
- shell : bash --noprofile --norc -xeuo pipefail {0}
150
153
run : |
151
154
if [[ "${{ matrix.host-platform }}" == win* ]]; then
152
155
export CHOWN=chown
@@ -158,7 +161,6 @@ jobs:
158
161
159
162
# TODO: enable this after NVIDIA/cuda-python#297 is resolved
160
163
# - name: Check cuda.bindings wheel
161
- # shell: bash --noprofile --norc -xeuo pipefail {0}
162
164
# run: |
163
165
# twine check ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl
164
166
@@ -205,7 +207,7 @@ jobs:
205
207
runner : H100
206
208
name : Test (${{ matrix.host-platform }}, Python ${{ matrix.python-version }}, CUDA ${{ matrix.cuda-version }}, Runner ${{ matrix.runner }})
207
209
# The build stage could fail but we want the CI to keep moving.
208
- if : ${{ github.repository_owner == 'nvidia' && always () }}
210
+ if : ${{ github.repository_owner == 'nvidia' && !cancelled () }}
209
211
permissions :
210
212
id-token : write # This is required for configure-aws-credentials
211
213
contents : read # This is required for actions/checkout
@@ -221,9 +223,11 @@ jobs:
221
223
NVIDIA_VISIBLE_DEVICES : ${{ env.NVIDIA_VISIBLE_DEVICES }}
222
224
needs :
223
225
- build
226
+ defaults :
227
+ run :
228
+ shell : bash --noprofile --norc -xeuo pipefail {0}
224
229
steps :
225
230
- name : Ensure GPU is working
226
- shell : bash --noprofile --norc -xeuo pipefail {0}
227
231
run : nvidia-smi
228
232
229
233
- name : Checkout ${{ github.event.repository.name }}
@@ -232,7 +236,6 @@ jobs:
232
236
fetch-depth : 0
233
237
234
238
- name : Set environment variables
235
- shell : bash --noprofile --norc -xeuo pipefail {0}
236
239
run : |
237
240
PYTHON_VERSION_FORMATTED=$(echo '${{ matrix.python-version }}' | tr -d '.')
238
241
if [[ "${{ matrix.host-platform }}" == linux* ]]; then
@@ -251,20 +254,56 @@ jobs:
251
254
fi
252
255
253
256
# make outputs from the previous job as env vars
254
- echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}-${{ github.sha }}" >> $GITHUB_ENV
257
+ CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}"
258
+ echo "PYTHON_VERSION_FORMATTED=${PYTHON_VERSION_FORMATTED}" >> $GITHUB_ENV
259
+ echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
260
+ echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
255
261
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
256
- echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ needs.build.outputs.BUILD_CTK_VER }}-${{ matrix.host-platform }}-${{ github.sha }}" >> $GITHUB_ENV
262
+ CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ needs.build.outputs.BUILD_CTK_VER }}-${{ matrix.host-platform }}"
263
+ echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
264
+ echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
257
265
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
258
266
echo "SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" >> $GITHUB_ENV
259
267
268
+ - name : Install dependencies
269
+ uses : ./.github/actions/install_unix_deps
270
+ continue-on-error : false
271
+ with :
272
+ # gcc for Cython tests, jq/wget for artifact fetching
273
+ dependencies : " build-essential jq wget"
274
+ dependent_exes : " gcc jq wget"
275
+
260
276
- name : Download cuda.bindings build artifacts
277
+ if : ${{ env.SKIP_CUDA_BINDINGS_TEST == '0'}}
261
278
uses : actions/download-artifact@v4
262
279
with :
263
280
name : ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
264
281
path : ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
265
282
283
+ - name : Download cuda.bindings build artifacts from the prior branch
284
+ if : ${{ env.SKIP_CUDA_BINDINGS_TEST == '1'}}
285
+ env :
286
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
287
+ run : |
288
+ # See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt.
289
+ # gh is needed for artifact fetching.
290
+ mkdir -p -m 755 /etc/apt/keyrings \
291
+ && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
292
+ && cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
293
+ && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
294
+ && 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 \
295
+ && apt update \
296
+ && apt install gh -y
297
+
298
+ OLD_BRANCH=$(cat .github/BACKPORT_BRANCH)
299
+ OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ matrix.host-platform }}*"
300
+ LATEST_PRIOR_RUN_ID=$(gh run list -b ${OLD_BRANCH} -L 1 -w "CI: Build and test" -s completed -R NVIDIA/cuda-python --json databaseId | jq '.[]| .databaseId')
301
+ gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python
302
+ ls -al $OLD_BASENAME
303
+ mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
304
+ mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/
305
+
266
306
- name : Display structure of downloaded cuda.bindings artifacts
267
- shell : bash --noprofile --norc -xeuo pipefail {0}
268
307
run : |
269
308
pwd
270
309
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
@@ -276,7 +315,6 @@ jobs:
276
315
path : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
277
316
278
317
- name : Display structure of downloaded cuda.core build artifacts
279
- shell : bash --noprofile --norc -xeuo pipefail {0}
280
318
run : |
281
319
pwd
282
320
ls -lahR $CUDA_CORE_ARTIFACTS_DIR
@@ -298,7 +336,6 @@ jobs:
298
336
299
337
- name : Run cuda.bindings tests
300
338
if : ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }}
301
- shell : bash --noprofile --norc -xeuo pipefail {0}
302
339
run : |
303
340
ls $CUDA_PATH
304
341
@@ -310,8 +347,6 @@ jobs:
310
347
pip install -r requirements.txt
311
348
pytest -rxXs tests/
312
349
if [[ "${{ matrix.host-platform }}" == linux* ]]; then
313
- # cython tests require gcc
314
- apt install -y build-essential
315
350
bash tests/cython/build_tests.sh
316
351
elif [[ "${{ matrix.host-platform }}" == win* ]]; then
317
352
# TODO: enable this once win-64 runners are up
@@ -321,18 +356,14 @@ jobs:
321
356
popd
322
357
323
358
- name : Run cuda.core tests
324
- shell : bash --noprofile --norc -xeuo pipefail {0}
325
359
run : |
326
- if [[ ${{ matrix.python-version }} == "3.13" ]]; then
327
- # TODO: remove this hack once cuda-python has a cp313 build
328
- if [[ $SKIP_CUDA_BINDINGS_TEST == 1 ]]; then
329
- echo "Python 3.13 + cuda-python ${{ matrix.cuda-version }} is not supported, skipping the test..."
330
- exit 0
331
- fi
332
- fi
333
-
334
360
# If build/test majors match: cuda.bindings is installed in the previous step.
335
- # If mismatch: cuda.bindings is installed from PyPI.
361
+ # If mismatch: cuda.bindings is installed from the backport branch.
362
+ if [[ "${SKIP_CUDA_BINDINGS_TEST}" == 1 ]]; then
363
+ pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
364
+ pip install *.whl
365
+ popd
366
+ fi
336
367
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ matrix.cuda-version }})"
337
368
pushd "${CUDA_CORE_ARTIFACTS_DIR}"
338
369
pip install $(ls *.whl)["cu${TEST_CUDA_MAJOR}"]
@@ -346,7 +377,7 @@ jobs:
346
377
doc :
347
378
name : Docs
348
379
# The build stage could fail but we want the CI to keep moving.
349
- if : ${{ github.repository_owner == 'nvidia' && always () }}
380
+ if : ${{ github.repository_owner == 'nvidia' && !cancelled () }}
350
381
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
351
382
permissions :
352
383
id-token : write
0 commit comments