@@ -245,17 +245,65 @@ jobs:
245245 fi
246246 mv ${COMPONENT}/docs/build/html/* artifacts/docs/${TARGET}
247247
248- - name : Upload rendered docs for link checking
248+ - name : Write rendered docs file list
249249 if : ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
250- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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
251263 with :
252- name : docs-rendered-html
253- path : artifacts/docs/
254- if-no-files-found : error
255- retention-days : 3
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 }}
256306
257- # This is the GitHub Pages artifact format; the link checker needs a
258- # normal workflow artifact with the rendered HTML tree above.
259307 - name : Upload docs GitHub Pages artifact
260308 uses : actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
261309 with :
0 commit comments