Skip to content

Commit 89a2052

Browse files
committed
Merge branch 'main' into move_enum_explanations
2 parents 47e9c2d + ad7c96b commit 89a2052

16 files changed

Lines changed: 1192 additions & 874 deletions

File tree

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: "CI: Enforce assignee/label/milestone on PRs"
6+
7+
on:
8+
pull_request_target:
9+
types:
10+
- opened
11+
- edited
12+
- synchronize
13+
- assigned
14+
- unassigned
15+
- labeled
16+
- unlabeled
17+
- reopened
18+
- ready_for_review
19+
20+
jobs:
21+
check-metadata:
22+
name: PR has assignee, labels, and milestone
23+
if: github.repository_owner == 'NVIDIA'
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Check for assignee, labels, and milestone
27+
env:
28+
ASSIGNEES: ${{ toJson(github.event.pull_request.assignees) }}
29+
LABELS: ${{ toJson(github.event.pull_request.labels) }}
30+
MILESTONE: ${{ github.event.pull_request.milestone && github.event.pull_request.milestone.title || '' }}
31+
PR_URL: ${{ github.event.pull_request.html_url }}
32+
IS_BOT: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'copy-pr-bot[bot]' }}
33+
IS_DRAFT: ${{ github.event.pull_request.draft }}
34+
run: |
35+
if [ "$IS_BOT" = "true" ] || [ "$IS_DRAFT" = "true" ]; then
36+
echo "Skipping check for bot or draft PR."
37+
exit 0
38+
fi
39+
40+
ERRORS=""
41+
42+
ASSIGNEE_COUNT=$(echo "$ASSIGNEES" | jq 'length')
43+
if [ "$ASSIGNEE_COUNT" -eq 0 ]; then
44+
ERRORS="${ERRORS}- **Missing assignee**: assign at least one person to this PR.\n"
45+
fi
46+
47+
# Module labels identify which package the PR touches.
48+
# Cross-cutting labels exempt PRs from needing a module label.
49+
LABEL_NAMES=$(echo "$LABELS" | jq -r '.[].name')
50+
MODULE_LABELS="cuda.bindings cuda.core cuda.pathfinder"
51+
MODULE_EXEMPT_LABELS="CI/CD"
52+
HAS_MODULE=false
53+
for label in $LABEL_NAMES; do
54+
for mod in $MODULE_LABELS $MODULE_EXEMPT_LABELS; do
55+
if [ "$label" = "$mod" ]; then
56+
HAS_MODULE=true
57+
break 2
58+
fi
59+
done
60+
done
61+
62+
if [ "$HAS_MODULE" = "false" ]; then
63+
ERRORS="${ERRORS}- **Missing module label**: add at least one of: \`cuda.bindings\`, \`cuda.core\`, \`cuda.pathfinder\` (or a cross-cutting label such as \`CI/CD\`).\n"
64+
fi
65+
66+
# Type labels categorize the kind of change.
67+
TYPE_LABELS="bug enhancement feature documentation test example CI/CD packaging dependencies performance experiment RFC support P0 P1 P2"
68+
HAS_TYPE=false
69+
for label in $LABEL_NAMES; do
70+
for typ in $TYPE_LABELS; do
71+
if [ "$label" = "$typ" ]; then
72+
HAS_TYPE=true
73+
break 2
74+
fi
75+
done
76+
done
77+
78+
if [ "$HAS_TYPE" = "false" ]; then
79+
ERRORS="${ERRORS}- **Missing type label**: add at least one of: \`bug\`, \`enhancement\`, \`feature\`, \`documentation\`, \`test\`, \`example\`, \`CI/CD\`, \`packaging\`, \`dependencies\`, \`performance\`, \`experiment\`, \`RFC\`, \`support\`, \`P0\`, \`P1\`, \`P2\`.\n"
80+
fi
81+
82+
if [ -z "$MILESTONE" ]; then
83+
ERRORS="${ERRORS}- **Missing milestone**: assign a milestone to this PR.\n"
84+
fi
85+
86+
# Block PRs with labels that indicate they are not ready to merge.
87+
BLOCKED_PATTERNS="blocked DO NOT MERGE do not merge"
88+
for label in $LABEL_NAMES; do
89+
for pattern in $BLOCKED_PATTERNS; do
90+
if echo "$label" | grep -qi "$pattern"; then
91+
ERRORS="${ERRORS}- **Blocked label detected**: label \`$label\` prevents merging. Remove it when the PR is ready.\n"
92+
break
93+
fi
94+
done
95+
done
96+
97+
if [ -n "$ERRORS" ]; then
98+
echo "::error::This PR is missing required metadata. See the job summary for details."
99+
{
100+
echo "## PR Metadata Check Failed"
101+
echo ""
102+
printf '%b' "$ERRORS"
103+
echo ""
104+
echo "Please update the PR at: $PR_URL"
105+
} >> "$GITHUB_STEP_SUMMARY"
106+
exit 1
107+
fi
108+
109+
ASSIGNEE_LIST=$(echo "$ASSIGNEES" | jq -r '.[].login' | paste -sd ', ' -)
110+
LABEL_LIST=$(echo "$LABEL_NAMES" | paste -sd ', ' -)
111+
{
112+
echo "## PR Metadata Check Passed"
113+
echo ""
114+
echo "- **Assignees**: $ASSIGNEE_LIST"
115+
echo "- **Labels**: $LABEL_LIST"
116+
echo "- **Milestone**: $MILESTONE"
117+
} >> "$GITHUB_STEP_SUMMARY"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ jobs:
263263
}
264264
265265
- name: Install cuda.pathfinder extra wheels for testing
266+
if: ${{ !endsWith(matrix.PY_VER, 't') }} # see issue #1820
266267
shell: bash --noprofile --norc -xeuo pipefail {0}
267268
run: |
268269
pushd cuda_pathfinder
@@ -271,6 +272,7 @@ jobs:
271272
popd
272273
273274
- name: Run cuda.pathfinder tests with all_must_work
275+
if: ${{ !endsWith(matrix.PY_VER, 't') }} # see issue #1820
274276
env:
275277
CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: all_must_work
276278
CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: all_must_work

AGENTS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ guide for package-specific conventions and workflows.
1212
- `cuda_core/`: High-level Pythonic CUDA APIs built on top of bindings.
1313
- `cuda_python/`: Metapackage and docs aggregation.
1414

15+
# Pull requests
16+
17+
When creating pull requests with `gh pr create`, always assign at least one
18+
label and a milestone. CI enforces this via the `pr-metadata-check` workflow
19+
and will block PRs that are missing labels or a milestone. Use `--label` and
20+
`--milestone` flags, for example:
21+
22+
```
23+
gh pr create --title "..." --body "..." --label "bug" --milestone "v1.0"
24+
```
25+
26+
If you are unsure which label or milestone to use, check the existing labels
27+
and milestones on the repository with `gh label list` and `gh api
28+
repos/{owner}/{repo}/milestones --jq '.[].title'`, and pick the best match.
29+
30+
1531
# General
1632

1733
- When searching for text or files, prefer using `rg` or `rg --files`

cuda_bindings/tests/nvml/test_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_get_nv_link_supported_bw_modes(all_devices):
7272
for device in all_devices:
7373
with unsupported_before(device, None):
7474
modes = nvml.device_get_nvlink_supported_bw_modes(device)
75-
assert isinstance(modes, nvml.NvlinkSupportedBWModes_v1)
75+
assert isinstance(modes, nvml.NvlinkSupportedBwModes_v1)
7676
# #define NVML_NVLINK_TOTAL_SUPPORTED_BW_MODES 23
7777
assert len(modes.bw_modes) <= 23
7878
assert not hasattr(modes, "total_bw_modes")

0 commit comments

Comments
 (0)