1- # SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+ # SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22#
33# SPDX-License-Identifier: Apache-2.0
44
4545 shell : bash -el {0}
4646 steps :
4747 - name : Checkout ${{ github.event.repository.name }}
48- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48+ uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
4949 with :
50- fetch-depth : 0
50+ fetch-depth : 1
5151 ref : ${{ inputs.git-tag }}
5252
5353 - name : Read build CTK version
@@ -91,15 +91,18 @@ jobs:
9191
9292 if [[ ${{ inputs.is-release }} == "true" ]]; then
9393 FILE_HASH="*"
94- COMMIT_HASH="${{ inputs.git-tag }}"
94+ DOCS_GITHUB_REF="${{ inputs.git-tag }}"
95+ if [[ -z "${DOCS_GITHUB_REF}" ]]; then
96+ DOCS_GITHUB_REF="${GITHUB_REF_NAME}"
97+ fi
9598 else
9699 FILE_HASH="${{ github.sha }}"
97- COMMIT_HASH ="${{ github.sha }}"
100+ DOCS_GITHUB_REF ="${{ github.sha }}"
98101 fi
99102
100103 # make outputs from the previous job as env vars
101104 CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64"
102- echo "COMMIT_HASH =${COMMIT_HASH }" >> $GITHUB_ENV
105+ echo "CUDA_PYTHON_DOCS_GITHUB_REF =${DOCS_GITHUB_REF }" >> $GITHUB_ENV
103106 echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
104107 echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${FILE_HASH}" >> $GITHUB_ENV
105108 echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
@@ -242,8 +245,66 @@ jobs:
242245 fi
243246 mv ${COMPONENT}/docs/build/html/* artifacts/docs/${TARGET}
244247
245- # TODO: Consider removing this step?
246- - name : Upload doc artifacts
248+ - name : Write rendered docs file list
249+ if : ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
250+ run : |
251+ find "${GITHUB_WORKSPACE}/artifacts/docs" -type f -name '*.html' ! -path '*/_static/*' \
252+ | LC_ALL=C sort > lychee-rendered-html-files.txt
253+ if [[ ! -s lychee-rendered-html-files.txt ]]; then
254+ echo "error: no rendered HTML pages found for lychee" >&2
255+ exit 1
256+ fi
257+ wc -l lychee-rendered-html-files.txt
258+
259+ - name : Restore lychee cache
260+ if : ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
261+ id : restore-lychee-cache
262+ uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
263+ with :
264+ path : .lycheecache
265+ key : docs-rendered-lychee-${{ env.PR_NUMBER }}-${{ github.sha }}
266+ restore-keys : |
267+ docs-rendered-lychee-${{ env.PR_NUMBER }}-
268+
269+ - name : Check rendered docs links
270+ if : ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
271+ uses : lycheeverse/lychee-action@6da1d14f3a43098a294b7696d93d938aa8d20fc0 # unreleased: supports v0.24.x archive layout
272+ with :
273+ # PR-preview canonical URLs are checked by the preview deployment workflow.
274+ # The cuda-bindings #id links are docutils "problematic" anchors from generated API docs.
275+ # TODO: Remove this exclusion after cybind stops emitting those problematic anchors.
276+ # Preferred Networks rejects hosted-runner GETs, but the URL is browser reachable.
277+ args : >-
278+ --files-from ${{ github.workspace }}/lychee-rendered-html-files.txt
279+ --include-fragments=full
280+ --cache
281+ --max-cache-age 1d
282+ --max-concurrency 16
283+ --host-concurrency 2
284+ --host-request-interval 250ms
285+ --max-retries 3
286+ --retry-wait-time 5
287+ --timeout 30
288+ --no-progress
289+ --exclude '^https://nvidia\.github\.io/cuda-python/pr-preview/pr-[0-9]+/'
290+ --exclude '^file://.*/cuda-bindings/latest/module/(driver|runtime)\.html#id[0-9]+$'
291+ --exclude '^https://www\.preferred\.jp/en/?$'
292+ fail : true
293+ failIfEmpty : true
294+ format : markdown
295+ jobSummary : false
296+ lycheeVersion : v0.24.2
297+ output : lychee-rendered-html.md
298+ token : ${{ github.token }}
299+
300+ - name : Save lychee cache
301+ if : ${{ always() && !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') && steps.restore-lychee-cache.outputs.cache-hit != 'true' && steps.restore-lychee-cache.outputs.cache-primary-key != '' }}
302+ uses : actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
303+ with :
304+ path : .lycheecache
305+ key : ${{ steps.restore-lychee-cache.outputs.cache-primary-key }}
306+
307+ - name : Upload docs GitHub Pages artifact
247308 uses : actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
248309 with :
249310 path : artifacts/
@@ -265,5 +326,5 @@ jobs:
265326 git-config-email : cuda-python-bot@users.noreply.github.com
266327 folder : artifacts/docs/
267328 target-folder : docs/
268- commit-message : " Deploy ${{ (inputs.is-release && 'release') || 'latest' }} docs: ${{ env.COMMIT_HASH }}"
329+ commit-message : " Deploy ${{ (inputs.is-release && 'release') || 'latest' }} docs: ${{ env.CUDA_PYTHON_DOCS_GITHUB_REF }}"
269330 clean : false
0 commit comments