Skip to content

Commit dd81add

Browse files
authored
Merge branch 'main' into 12-next-docs
2 parents 3b35495 + c271903 commit dd81add

40 files changed

+819
-310
lines changed

.github/BACKPORT_BRANCH

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11.8.x

.github/ISSUE_TEMPLATE/release_checklist.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ body:
1212
label: Tasks for cuda-bindings / cuda-python release
1313
options:
1414
- label: "Push any internal updates for accommodating a new CTK release to the public (**IMPORTANT**: Need to wait for CTK posting!)"
15+
- label: "If it is a major release, create a new branch to backport to and update the branch name [here](../BACKPORT_BRANCH)"
1516
- label: Follow the check list for `cuda-core` below for the remaining steps
1617

1718
- type: checkboxes
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Preview or clean up docs built from PRs
2+
3+
# A re-implementation based on the logic of https://github.com/rossjrw/pr-preview-action/blob/41a957c44a456a34718e9bcf825363194db5e6d5/README.md, due to limitations illustrated in NVIDIA/cuda-python#380.
4+
5+
inputs:
6+
source-folder:
7+
required: true
8+
type: string
9+
10+
runs:
11+
using: composite
12+
steps:
13+
# The steps below are executed only when testing in a PR.
14+
# Note: the PR previews will be removed once merged to main (see below)
15+
- name: Get PR info
16+
if: ${{ github.ref_name != 'main' }}
17+
uses: nv-gha-runners/get-pr-info@main
18+
id: get-pr-info
19+
20+
- name: Extract PR number from info
21+
if: ${{ github.ref_name != 'main' }}
22+
shell: bash --noprofile --norc -xeuo pipefail {0}
23+
run: |
24+
PR_NUMBER="${{ fromJSON(steps.get-pr-info.outputs.pr-info).number }}"
25+
if [[ "$PR_NUMBER" == "" ]]; then
26+
echo "cannot extract PR number"
27+
exit 1
28+
else
29+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
30+
fi
31+
32+
- name: Deploy doc preview
33+
if: ${{ github.ref_name != 'main' }}
34+
uses: JamesIves/github-pages-deploy-action@v4
35+
with:
36+
git-config-name: cuda-python-bot
37+
git-config-email: [email protected]
38+
folder: ${{ inputs.source-folder }}
39+
target-folder: docs/pr-preview/pr-${{ env.PR_NUMBER }}/
40+
commit-message: "Deploy doc preview for PR ${{ env.PR_NUMBER }} (${{ github.sha }})"
41+
42+
- name: Leave a comment after deployment
43+
if: ${{ github.ref_name != 'main' }}
44+
uses: marocchino/sticky-pull-request-comment@v2
45+
with:
46+
header: pr-preview
47+
number: ${{ env.PR_NUMBER }}
48+
skip_unchanged: true
49+
message: |
50+
Doc Preview CI
51+
:---:
52+
| <p></p> :rocket: View preview at <br> https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}/ <br><br>
53+
| <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
54+
55+
# The steps below are executed only when building on main.
56+
- name: Get PR data
57+
if: ${{ github.ref_name == 'main' }}
58+
uses: actions/github-script@v7
59+
id: get-pr-data
60+
with:
61+
script: |
62+
return (
63+
await github.rest.repos.listPullRequestsAssociatedWithCommit({
64+
commit_sha: context.sha,
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
})
68+
).data[0];
69+
70+
- name: Extract PR number from data
71+
if: ${{ github.ref_name == 'main' }}
72+
shell: bash --noprofile --norc -xeuo pipefail {0}
73+
run: |
74+
PR_NUMBER="${{ fromJSON(steps.get-pr-data.outputs.result).number }}"
75+
if [[ "$PR_NUMBER" == "" ]]; then
76+
echo "cannot extract PR number"
77+
exit 1
78+
else
79+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
80+
fi
81+
82+
- name: Remove doc preview
83+
if: ${{ github.ref_name == 'main' }}
84+
uses: JamesIves/github-pages-deploy-action@v4
85+
with:
86+
git-config-name: cuda-python-bot
87+
git-config-email: [email protected]
88+
folder: ${{ inputs.source-folder }}
89+
target-folder: docs/pr-preview/pr-${{ env.PR_NUMBER }}/
90+
commit-message: "Clean up doc preview for PR ${{ env.PR_NUMBER }} (${{ github.sha }})"
91+
92+
- name: Leave a comment after removal
93+
if: ${{ github.ref_name == 'main' }}
94+
uses: marocchino/sticky-pull-request-comment@v2
95+
with:
96+
header: pr-preview
97+
number: ${{ env.PR_NUMBER }}
98+
hide_and_recreate: true
99+
hide_classify: "OUTDATED"
100+
message: |
101+
Doc Preview CI
102+
:---:
103+
Preview removed because the pull request was closed or merged.

.github/actions/fetch_ctk/action.yml

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,11 @@ runs:
2020
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}.tar.gz" >> $GITHUB_ENV
2121
2222
- name: Install dependencies
23-
shell: bash --noprofile --norc -xeuo pipefail {0}
24-
run: |
25-
dependencies=(zstd curl xz-utils)
26-
dependent_exes=(zstd curl xz)
27-
28-
not_found=0
29-
for dep in ${dependent_exes[@]}; do
30-
if ! (command -v curl 2>&1 >/dev/null); then
31-
not_found=1
32-
break
33-
fi
34-
done
35-
if [[ $not_found == 0 ]]; then
36-
echo "All dependencies are found. Do nothing."
37-
exit 0
38-
fi
39-
if ! (command -v sudo 2>&1 >/dev/null); then
40-
if [[ $EUID == 0 ]]; then
41-
alias SUDO=""
42-
else
43-
echo "The following oprations require root access."
44-
exit 1
45-
fi
46-
else
47-
alias SUDO="sudo"
48-
fi
49-
shopt -s expand_aliases
50-
SUDO apt update
51-
SUDO apt install -y ${dependencies[@]}
23+
uses: ./.github/actions/install_unix_deps
24+
continue-on-error: false
25+
with:
26+
dependencies: "zstd curl xz-utils"
27+
dependent_exes: "zstd curl xz"
5228

5329
- name: Download CTK cache
5430
id: ctk-get-cache
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Install dependencies on Ubuntu
2+
3+
description: Install needed dependencies, regardless if using GitHub- or self- hosted runners, container, sudo or not.
4+
5+
inputs:
6+
dependencies:
7+
required: true
8+
type: string
9+
dependent_exes:
10+
required: true
11+
type: string
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Install dependencies
17+
shell: bash --noprofile --norc -xeuo pipefail {0}
18+
run: |
19+
dependencies=(${{ inputs.dependencies }})
20+
dependent_exes=(${{ inputs.dependent_exes }})
21+
22+
not_found=0
23+
for dep in ${dependent_exes[@]}; do
24+
if ! (command -v $dep 2>&1 >/dev/null); then
25+
not_found=1
26+
break
27+
fi
28+
done
29+
if [[ $not_found == 0 ]]; then
30+
echo "All dependencies are found. Do nothing."
31+
exit 0
32+
fi
33+
if ! (command -v sudo 2>&1 >/dev/null); then
34+
if [[ $EUID == 0 ]]; then
35+
alias SUDO=""
36+
else
37+
echo "The following oprations require root access."
38+
exit 1
39+
fi
40+
else
41+
alias SUDO="sudo"
42+
fi
43+
shopt -s expand_aliases
44+
SUDO apt update
45+
SUDO apt install -y ${dependencies[@]}

.github/workflows/backport.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Backport merged pull request
1+
name: "CI: Backport the merged PR"
22

33
on:
44
pull_request_target:
@@ -14,16 +14,23 @@ jobs:
1414
backport:
1515
name: Backport pull request
1616
if: ${{ github.repository_owner == 'nvidia' &&
17-
github.event.pull_request.merged == true
17+
github.event.pull_request.merged == true &&
18+
contains( github.event.pull_request.labels.*.name, 'to-be-backported')
1819
}}
1920
runs-on: ubuntu-latest
2021
steps:
2122
- uses: actions/checkout@v4
23+
24+
- name: Load branch name
25+
id: get-branch
26+
run: |
27+
OLD_BRANCH=$(cat .github/BACKPORT_BRANCH)
28+
echo "OLD_BRANCH=${OLD_BRANCH}" >> $GITHUB_ENV
29+
2230
- name: Create backport pull requests
2331
uses: korthout/backport-action@v3
2432
with:
2533
copy_assignees: true
2634
copy_labels_pattern: true
2735
copy_requested_reviewers: true
28-
label_pattern: to-be-backported
29-
target_branches: 11.8.x
36+
target_branches: ${{ env.OLD_BRANCH }}

0 commit comments

Comments
 (0)