Skip to content

Commit 5e3c658

Browse files
committed
Merge remote-tracking branch 'origin/main' into ajost/context-safe-buffer-cleanup
2 parents 5bf078f + 51d402c commit 5e3c658

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: griffe API check
6+
7+
description: >-
8+
Check a package's public API (as defined by `__all__`) for changes using
9+
griffe.
10+
11+
inputs:
12+
package-name:
13+
description: "Importable package name to check, e.g. cuda.core"
14+
required: true
15+
package-dir:
16+
description: "Directory to search for the package sources, e.g. cuda_core"
17+
required: true
18+
merge-base:
19+
description: >-
20+
Git ref/sha to compare the current code against, typically the PR's
21+
merge-base with its target branch.
22+
required: true
23+
24+
runs:
25+
using: composite
26+
steps:
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
29+
with:
30+
enable-cache: false
31+
32+
- name: Check API
33+
shell: bash --noprofile --norc -euo pipefail {0}
34+
env:
35+
PACKAGE_NAME: ${{ inputs.package-name }}
36+
PACKAGE_DIR: ${{ inputs.package-dir }}
37+
MERGE_BASE: ${{ inputs.merge-base }}
38+
run: |
39+
uvx griffe check "$PACKAGE_NAME" \
40+
--search "$PACKAGE_DIR" \
41+
--find-stubs-packages \
42+
--against "$MERGE_BASE" \
43+
--format github \
44+
2>&1

‎.github/workflows/ci.yml‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
test_bindings: ${{ steps.compose.outputs.test_bindings }}
104104
test_core: ${{ steps.compose.outputs.test_core }}
105105
test_pathfinder: ${{ steps.compose.outputs.test_pathfinder }}
106+
pr_merge_base: ${{ steps.filter.outputs.merge_base }}
106107
steps:
107108
- name: Checkout repository
108109
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
@@ -156,6 +157,7 @@ jobs:
156157
echo "python_meta=$(has_match '^cuda_python/')"
157158
echo "test_helpers=$(has_match '^cuda_python_test_helpers/')"
158159
echo "shared=$(has_match '^(\.github/|ci/|scripts/|toolshed/|conftest\.py$|pyproject\.toml$|pixi\.(toml|lock)$|pytest\.ini$|ruff\.toml$)')"
160+
echo "merge_base=${base}"
159161
} >> "$GITHUB_OUTPUT"
160162
161163
- name: Compose gating outputs
@@ -228,6 +230,89 @@ jobs:
228230
echo "test_pathfinder=${test_pathfinder}"
229231
} >> "$GITHUB_OUTPUT"
230232
233+
api-check-core-vs-release:
234+
name: API check (cuda_core vs. latest release)
235+
if: >-
236+
${{ !fromJSON(needs.should-skip.outputs.skip) &&
237+
fromJSON(needs.detect-changes.outputs.core) }}
238+
runs-on: ubuntu-latest
239+
needs:
240+
- should-skip
241+
- detect-changes
242+
permissions:
243+
contents: read
244+
steps:
245+
- name: Checkout repository
246+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
247+
with:
248+
fetch-depth: 1
249+
filter: blob:none
250+
251+
- name: Find latest release tag
252+
id: latest-tag
253+
shell: bash --noprofile --norc -euo pipefail {0}
254+
env:
255+
GH_TOKEN: ${{ github.token }}
256+
run: |
257+
# --paginate fetches all pages; jq outputs one name per line per page;
258+
# head -1 takes the first (newest) match since GitHub returns tags
259+
# newest-first. Fails hard if no cuda-core-v* tag is found.
260+
tag="$(gh api "repos/$GITHUB_REPOSITORY/tags" --paginate \
261+
--jq '.[] | select(.name | startswith("cuda-core-v")) | .name' \
262+
| head -1)"
263+
if [[ -z "${tag}" ]]; then
264+
echo "::error::No cuda-core-v* tag found in the repository." >&2
265+
exit 1
266+
fi
267+
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
268+
269+
- name: Fetch release tag
270+
shell: bash --noprofile --norc -euo pipefail {0}
271+
run: |
272+
git fetch --depth=1 --filter=blob:none origin \
273+
"refs/tags/${{ steps.latest-tag.outputs.tag }}:refs/tags/${{ steps.latest-tag.outputs.tag }}"
274+
275+
- name: Check cuda_core public API
276+
id: griffe
277+
uses: ./.github/actions/griffe-api-check
278+
with:
279+
package-name: cuda.core
280+
package-dir: cuda_core
281+
merge-base: ${{ steps.latest-tag.outputs.tag }}
282+
283+
api-check-core-vs-base:
284+
name: API check (cuda_core vs. merge base)
285+
if: >-
286+
${{ startsWith(github.ref_name, 'pull-request/') &&
287+
!fromJSON(needs.should-skip.outputs.skip) &&
288+
fromJSON(needs.detect-changes.outputs.core) }}
289+
runs-on: ubuntu-latest
290+
needs:
291+
- should-skip
292+
- detect-changes
293+
permissions:
294+
contents: read
295+
steps:
296+
- name: Checkout repository
297+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
298+
with:
299+
fetch-depth: 1
300+
filter: blob:none
301+
302+
- name: Fetch merge base commit
303+
shell: bash --noprofile --norc -euo pipefail {0}
304+
run: |
305+
git fetch --depth=1 --filter=blob:none origin \
306+
"${{ needs.detect-changes.outputs.pr_merge_base }}"
307+
308+
- name: Check cuda_core public API
309+
id: griffe
310+
uses: ./.github/actions/griffe-api-check
311+
with:
312+
package-name: cuda.core
313+
package-dir: cuda_core
314+
merge-base: ${{ needs.detect-changes.outputs.pr_merge_base }}
315+
231316
# NOTE: Build jobs are intentionally split by platform rather than using a single
232317
# matrix. This allows each test job to depend only on its corresponding build,
233318
# so faster platforms can proceed through build & test without waiting for slower

0 commit comments

Comments
 (0)