Skip to content

Commit 41fdb86

Browse files
authored
Always build and run Cython tests + other CI improvements (#640)
* try to also build cuda.bindings Cython tests at the build stage * we can no longer lock host Python version * check if this hack from the test workflow also fixes cibuildwheel * also install test deps * AGENT_TOOLSDIRECTORY needs to be writable * test * test * test * ensure AGENT_TOOLSDIRECTORY is persistent * do this instead * fixes * fix windows * fix * fix dir * extra dot * ensure the Python include path is visible * fix python include path; only install essential build deps; add tests * fix escape; revert test dep installation handling * misc fixes * fix win artifact location; pin action commits; enable cuda.core cython tests * revert pinning ilammy/msvc-dev-cmd for now * set up a simple dependabot * fix spdx identifier * add cuda.core include path * try this * again * ensure cython tests are only run when testing against build CTK * try to avoid Cython 3.1 to speed up build time * pin exact commit for all non-NV GHA * move some reusable logics into build_tests.sh * fix path format, again * try enforcing double slashes
1 parent 4cb5389 commit 41fdb86

File tree

17 files changed

+220
-97
lines changed

17 files changed

+220
-97
lines changed

.github/actions/doc_preview/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runs:
2121
# Note: the PR previews will be removed once merged to main (see below)
2222
- name: Deploy doc preview
2323
if: ${{ github.ref_name != 'main' }}
24-
uses: JamesIves/github-pages-deploy-action@v4
24+
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
2525
with:
2626
git-config-name: cuda-python-bot
2727
git-config-email: [email protected]
@@ -31,7 +31,7 @@ runs:
3131

3232
- name: Leave a comment after deployment
3333
if: ${{ github.ref_name != 'main' }}
34-
uses: marocchino/sticky-pull-request-comment@v2
34+
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
3535
with:
3636
header: pr-preview
3737
number: ${{ inputs.pr-number }}
@@ -47,7 +47,7 @@ runs:
4747
# The steps below are executed only when building on main.
4848
- name: Remove doc preview
4949
if: ${{ github.ref_name == 'main' }}
50-
uses: JamesIves/github-pages-deploy-action@v4
50+
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
5151
with:
5252
git-config-name: cuda-python-bot
5353
git-config-email: [email protected]
@@ -57,7 +57,7 @@ runs:
5757

5858
- name: Leave a comment after removal
5959
if: ${{ github.ref_name == 'main' }}
60-
uses: marocchino/sticky-pull-request-comment@v2
60+
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
6161
with:
6262
header: pr-preview
6363
number: ${{ inputs.pr-number }}

.github/actions/fetch_ctk/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ runs:
3939

4040
- name: Download CTK cache
4141
id: ctk-get-cache
42-
uses: actions/cache/restore@v4
42+
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4343
continue-on-error: true
4444
with:
4545
key: ${{ env.CTK_CACHE_KEY }}
@@ -123,7 +123,7 @@ runs:
123123
- name: Upload CTK cache
124124
if: ${{ always() &&
125125
steps.ctk-get-cache.outputs.cache-hit != 'true' }}
126-
uses: actions/cache/save@v4
126+
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
127127
with:
128128
key: ${{ env.CTK_CACHE_KEY }}
129129
path: ./${{ env.CTK_CACHE_FILENAME }}

.github/actions/get_pr_number/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ runs:
2929
3030
- name: Get PR data (main branch)
3131
if: ${{ github.ref_name == 'main' }}
32-
uses: actions/github-script@v7
32+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
3333
id: get-pr-data
3434
with:
3535
script: |

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
version: 2
6+
updates:
7+
- package-ecosystem: github-actions
8+
directory: /
9+
schedule:
10+
interval: weekly

.github/workflows/backport.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
}}
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727

2828
- name: Load branch name
2929
id: get-branch
@@ -32,7 +32,7 @@ jobs:
3232
echo "OLD_BRANCH=${OLD_BRANCH}" >> $GITHUB_ENV
3333
3434
- name: Create backport pull requests
35-
uses: korthout/backport-action@v3
35+
uses: korthout/backport-action@436145e922f9561fc5ea157ff406f21af2d6b363 # v3.2.0
3636
with:
3737
copy_assignees: true
3838
copy_labels_pattern: true

.github/workflows/build-docs.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
shell: bash -el {0}
4848
steps:
4949
- name: Checkout ${{ github.event.repository.name }}
50-
uses: actions/checkout@v4
50+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5151
with:
5252
fetch-depth: 0
5353
ref: ${{ inputs.git-tag }}
@@ -56,7 +56,7 @@ jobs:
5656
# is resolved
5757

5858
- name: Set up miniforge
59-
uses: conda-incubator/setup-miniconda@v3
59+
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
6060
with:
6161
activate-environment: cuda-python-docs
6262
environment-file: ./cuda_python/docs/environment-docs.yml
@@ -103,7 +103,7 @@ jobs:
103103
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
104104
105105
- name: Download cuda-python build artifacts
106-
uses: actions/download-artifact@v4
106+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
107107
with:
108108
name: cuda-python-wheel
109109
path: .
@@ -117,14 +117,14 @@ jobs:
117117
118118
- name: Download cuda.bindings build artifacts
119119
if: ${{ !inputs.is-release }}
120-
uses: actions/download-artifact@v4
120+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
121121
with:
122122
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
123123
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
124124

125125
- name: Download cuda.bindings build artifacts
126126
if: ${{ inputs.is-release }}
127-
uses: actions/download-artifact@v4
127+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
128128
with:
129129
pattern: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
130130
merge-multiple: true
@@ -139,14 +139,14 @@ jobs:
139139
140140
- name: Download cuda.core build artifacts
141141
if: ${{ !inputs.is-release }}
142-
uses: actions/download-artifact@v4
142+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
143143
with:
144144
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
145145
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
146146

147147
- name: Download cuda.core build artifacts
148148
if: ${{ inputs.is-release }}
149-
uses: actions/download-artifact@v4
149+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
150150
with:
151151
pattern: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
152152
merge-multiple: true
@@ -221,7 +221,7 @@ jobs:
221221
222222
# TODO: Consider removing this step?
223223
- name: Upload doc artifacts
224-
uses: actions/upload-pages-artifact@v3
224+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
225225
with:
226226
path: artifacts/
227227
retention-days: 3
@@ -236,7 +236,7 @@ jobs:
236236

237237
- name: Deploy doc update
238238
if: ${{ github.ref_name == 'main' || inputs.is-release }}
239-
uses: JamesIves/github-pages-deploy-action@v4
239+
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
240240
with:
241241
git-config-name: cuda-python-bot
242242
git-config-email: [email protected]

.github/workflows/build-wheel.yml

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
1+
# Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -36,7 +36,7 @@ jobs:
3636
(inputs.host-platform == 'win-64' && 'windows-2019') }}
3737
steps:
3838
- name: Checkout ${{ github.event.repository.name }}
39-
uses: actions/checkout@v4
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4040
with:
4141
fetch-depth: 0
4242

@@ -47,17 +47,16 @@ jobs:
4747
if: ${{ inputs.host-platform != 'win-64' }}
4848

4949
- name: Set up Python
50-
if: ${{ startsWith(inputs.host-platform, 'linux') }}
51-
id: setup-python
52-
uses: actions/setup-python@v5
50+
id: setup-python1
51+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
5352
with:
54-
# WAR: setup-python is not relocatable...
53+
# WAR: setup-python is not relocatable, and cibuildwheel hard-wires to 3.12...
5554
# see https://github.com/actions/setup-python/issues/871
5655
python-version: "3.12"
5756

5857
- name: Set up MSVC
5958
if: ${{ startsWith(inputs.host-platform, 'win') }}
60-
uses: ilammy/msvc-dev-cmd@v1
59+
uses: ilammy/msvc-dev-cmd@v1 # TODO: ask admin to allow pinning commits
6160

6261
- name: Set environment variables
6362
run: |
@@ -76,12 +75,14 @@ jobs:
7675
echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
7776
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
7877
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
78+
echo "CUDA_CORE_CYTHON_TESTS_DIR=$(realpath "$REPO_DIR/cuda_core/tests/cython")" >> $GITHUB_ENV
7979
CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}"
8080
echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
8181
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
8282
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
83+
echo "CUDA_BINDINGS_CYTHON_TESTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/tests/cython")" >> $GITHUB_ENV
8384
echo "CIBW_BUILD=${CIBW_BUILD}" >> $GITHUB_ENV
84-
85+
8586
- name: Dump environment
8687
run: |
8788
env
@@ -112,7 +113,7 @@ jobs:
112113
twine check ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
113114
114115
- name: Upload cuda.core build artifacts
115-
uses: actions/upload-artifact@v4
116+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
116117
with:
117118
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
118119
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
@@ -159,7 +160,7 @@ jobs:
159160
twine check ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl
160161
161162
- name: Upload cuda.bindings build artifacts
162-
uses: actions/upload-artifact@v4
163+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
163164
with:
164165
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
165166
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl
@@ -187,8 +188,52 @@ jobs:
187188
188189
- name: Upload cuda-python build artifacts
189190
if: ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
190-
uses: actions/upload-artifact@v4
191+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
191192
with:
192193
name: cuda-python-wheel
193194
path: cuda_python/*.whl
194195
if-no-files-found: error
196+
197+
- name: Set up Python
198+
id: setup-python2
199+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
200+
with:
201+
python-version: ${{ matrix.python-version }}
202+
203+
- name: Set up Python include paths
204+
run: |
205+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
206+
echo "CPLUS_INCLUDE_PATH=${Python3_ROOT_DIR}/include/python${{ matrix.python-version }}" >> $GITHUB_ENV
207+
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
208+
echo "CL=/I\"${Python3_ROOT_DIR}\include\python${{ matrix.python-version }}\"" >> $GITHUB_ENV
209+
fi
210+
# For caching
211+
echo "PY_EXT_SUFFIX=$(python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")" >> $GITHUB_ENV
212+
213+
- name: Build cuda.bindings Cython tests
214+
run: |
215+
pip install $(ls ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl)[test]
216+
pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}
217+
bash build_tests.sh
218+
popd
219+
220+
- name: Upload cuda.bindings Cython tests
221+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
222+
with:
223+
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests
224+
path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }}
225+
if-no-files-found: error
226+
227+
- name: Build cuda.core Cython tests
228+
run: |
229+
pip install $(ls ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl)[test]
230+
pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
231+
bash build_tests.sh
232+
popd
233+
234+
- name: Upload cuda.core Cython tests
235+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
236+
with:
237+
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests
238+
path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }}
239+
if-no-files-found: error

.github/workflows/ci.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
CUDA_BUILD_VER: ${{ steps.get-vars.outputs.cuda_build_ver }}
2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
with:
2828
fetch-depth: 0
2929
- name: Get CUDA build version
@@ -45,8 +45,7 @@ jobs:
4545
name: Build ${{ matrix.host-platform }}, CUDA ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
4646
if: ${{ github.repository_owner == 'nvidia' }}
4747
secrets: inherit
48-
uses:
49-
./.github/workflows/build-wheel.yml
48+
uses: ./.github/workflows/build-wheel.yml
5049
with:
5150
host-platform: ${{ matrix.host-platform }}
5251
cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
@@ -66,8 +65,7 @@ jobs:
6665
- ci-vars
6766
- build
6867
secrets: inherit
69-
uses:
70-
./.github/workflows/test-wheel-linux.yml
68+
uses: ./.github/workflows/test-wheel-linux.yml
7169
with:
7270
build-type: pull-request
7371
host-platform: ${{ matrix.host-platform }}
@@ -87,8 +85,7 @@ jobs:
8785
- ci-vars
8886
- build
8987
secrets: inherit
90-
uses:
91-
./.github/workflows/test-wheel-windows.yml
88+
uses: ./.github/workflows/test-wheel-windows.yml
9289
with:
9390
build-type: pull-request
9491
host-platform: ${{ matrix.host-platform }}
@@ -106,8 +103,7 @@ jobs:
106103
- ci-vars
107104
- build
108105
secrets: inherit
109-
uses:
110-
./.github/workflows/build-docs.yml
106+
uses: ./.github/workflows/build-docs.yml
111107
with:
112108
build-ctk-ver: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
113109

@@ -121,5 +117,4 @@ jobs:
121117
- test-windows
122118
- doc
123119
secrets: inherit
124-
uses:
125-
./.github/workflows/status-check.yml
120+
uses: ./.github/workflows/status-check.yml

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ jobs:
2828
build-mode: none
2929
steps:
3030
- name: Checkout repository
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3232

3333
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@v3
34+
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3535
with:
3636
languages: ${{ matrix.language }}
3737
build-mode: ${{ matrix.build-mode }}
3838
queries: security-extended
3939

4040
- name: Perform CodeQL Analysis
41-
uses: github/codeql-action/analyze@v3
41+
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
4242
with:
4343
category: "/language:${{matrix.language}}"

.github/workflows/release-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ inputs.git-tag }}
3434
steps:
3535
- name: Checkout Source
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3737
with:
3838
fetch-depth: 0
3939
ref: ${{ inputs.git-tag }}

0 commit comments

Comments
 (0)