Skip to content

Commit ae2cff2

Browse files
committed
Split rendered docs link check workflow
1 parent 0a43789 commit ae2cff2

3 files changed

Lines changed: 137 additions & 76 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 21 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -253,55 +253,7 @@ jobs:
253253
run: |
254254
echo "${{ github.sha }}" > artifacts/docs/.preview-commit
255255
256-
# TODO: Consider removing this step?
257-
- name: Upload doc artifacts
258-
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
259-
with:
260-
path: artifacts/
261-
retention-days: 3
262-
263-
- name: Deploy or clean up doc preview
264-
if: ${{ !inputs.is-release }}
265-
uses: ./.github/actions/doc_preview
266-
with:
267-
source-folder: ${{ (github.ref_name != 'main' && 'artifacts/docs') ||
268-
'artifacts/empty_docs' }}
269-
pr-number: ${{ env.PR_NUMBER }}
270-
271-
- name: Wait for doc preview deployment
272-
if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
273-
env:
274-
PREVIEW_URL: https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}
275-
EXPECTED_SHA: ${{ github.sha }}
276-
run: |
277-
preview_ready=0
278-
marker_url="${PREVIEW_URL}/.preview-commit"
279-
for attempt in {1..60}; do
280-
marker=$(curl -fsSL "${marker_url}" || true)
281-
if [[ "${marker}" == "${EXPECTED_SHA}" ]]; then
282-
preview_ready=1
283-
break
284-
fi
285-
echo "Waiting for doc preview marker ${marker_url} (${attempt}/60)"
286-
sleep 10
287-
done
288-
if [[ "${preview_ready}" != "1" ]]; then
289-
echo "error: doc preview marker did not update to ${EXPECTED_SHA}" >&2
290-
exit 1
291-
fi
292-
echo "Doc preview is available at ${PREVIEW_URL}"
293-
294-
- name: Restore lychee cache
295-
id: restore-lychee-cache
296-
if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
297-
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
298-
with:
299-
path: .lycheecache
300-
key: docs-preview-lychee-${{ env.PR_NUMBER }}-${{ github.sha }}
301-
restore-keys: |
302-
docs-preview-lychee-${{ env.PR_NUMBER }}-
303-
304-
- name: Write lychee doc preview URL list
256+
- name: Write doc preview link-check URL list
305257
if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
306258
env:
307259
PREVIEW_URL: https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}
@@ -315,36 +267,29 @@ jobs:
315267
fi
316268
wc -l lychee-preview-urls.txt
317269
318-
- name: Check doc preview links
270+
- name: Upload doc preview link-check URL list
319271
if: ${{ !inputs.is-release && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
320-
uses: lycheeverse/lychee-action@6da1d14f3a43098a294b7696d93d938aa8d20fc0 # unreleased: supports v0.24.x archive layout
272+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
273+
with:
274+
name: docs-preview-linkcheck-urls
275+
path: lychee-preview-urls.txt
276+
if-no-files-found: error
277+
retention-days: 3
278+
279+
# TODO: Consider removing this step?
280+
- name: Upload doc artifacts
281+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
321282
with:
322-
args: >-
323-
--files-from ${{ github.workspace }}/lychee-preview-urls.txt
324-
--include-fragments=full
325-
--cache
326-
--max-cache-age 1d
327-
--max-concurrency 16
328-
--host-concurrency 2
329-
--host-request-interval 250ms
330-
--max-retries 3
331-
--retry-wait-time 5
332-
--timeout 30
333-
--no-progress
334-
fail: true
335-
failIfEmpty: true
336-
format: markdown
337-
jobSummary: false
338-
lycheeVersion: v0.24.2
339-
output: lychee-preview.md
340-
token: ${{ github.token }}
341-
342-
- name: Save lychee cache
343-
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 != '' }}
344-
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
283+
path: artifacts/
284+
retention-days: 3
285+
286+
- name: Deploy or clean up doc preview
287+
if: ${{ !inputs.is-release }}
288+
uses: ./.github/actions/doc_preview
345289
with:
346-
path: .lycheecache
347-
key: ${{ steps.restore-lychee-cache.outputs.cache-primary-key }}
290+
source-folder: ${{ (github.ref_name != 'main' && 'artifacts/docs') ||
291+
'artifacts/empty_docs' }}
292+
pr-number: ${{ env.PR_NUMBER }}
348293

349294
- name: Deploy doc update
350295
if: ${{ github.ref_name == 'main' || inputs.is-release }}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: "CI: Check rendered docs links"
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
url-artifact:
11+
description: "Artifact containing the rendered doc preview URL list"
12+
required: false
13+
default: docs-preview-linkcheck-urls
14+
type: string
15+
16+
jobs:
17+
check:
18+
name: Check rendered docs links
19+
if: ${{ github.repository_owner == 'nvidia' && startsWith(github.ref_name, 'pull-request/') }}
20+
runs-on: ubuntu-latest
21+
permissions:
22+
actions: read
23+
contents: read
24+
pull-requests: read
25+
defaults:
26+
run:
27+
shell: bash -el {0}
28+
steps:
29+
- name: Checkout ${{ github.event.repository.name }}
30+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+
32+
- name: Get PR number
33+
uses: ./.github/actions/get_pr_number
34+
35+
- name: Download doc preview link-check URL list
36+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
37+
with:
38+
name: ${{ inputs.url-artifact }}
39+
path: linkcheck-input
40+
41+
- name: Wait for doc preview deployment
42+
env:
43+
PREVIEW_URL: https://nvidia.github.io/cuda-python/pr-preview/pr-${{ env.PR_NUMBER }}
44+
EXPECTED_SHA: ${{ github.sha }}
45+
run: |
46+
preview_ready=0
47+
marker_url="${PREVIEW_URL}/.preview-commit"
48+
for attempt in {1..60}; do
49+
marker=$(curl -fsSL "${marker_url}" || true)
50+
if [[ "${marker}" == "${EXPECTED_SHA}" ]]; then
51+
preview_ready=1
52+
break
53+
fi
54+
echo "Waiting for doc preview marker ${marker_url} (${attempt}/60)"
55+
sleep 10
56+
done
57+
if [[ "${preview_ready}" != "1" ]]; then
58+
echo "error: doc preview marker did not update to ${EXPECTED_SHA}" >&2
59+
exit 1
60+
fi
61+
echo "Doc preview is available at ${PREVIEW_URL}"
62+
63+
- name: Restore lychee cache
64+
id: restore-lychee-cache
65+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
66+
with:
67+
path: .lycheecache
68+
key: docs-preview-lychee-${{ env.PR_NUMBER }}-${{ github.sha }}
69+
restore-keys: |
70+
docs-preview-lychee-${{ env.PR_NUMBER }}-
71+
72+
- name: Check doc preview links
73+
uses: lycheeverse/lychee-action@6da1d14f3a43098a294b7696d93d938aa8d20fc0 # unreleased: supports v0.24.x archive layout
74+
with:
75+
args: >-
76+
--files-from ${{ github.workspace }}/linkcheck-input/lychee-preview-urls.txt
77+
--include-fragments=full
78+
--cache
79+
--max-cache-age 1d
80+
--max-concurrency 16
81+
--host-concurrency 2
82+
--host-request-interval 250ms
83+
--max-retries 3
84+
--retry-wait-time 5
85+
--timeout 30
86+
--no-progress
87+
fail: true
88+
failIfEmpty: true
89+
format: markdown
90+
jobSummary: false
91+
lycheeVersion: v0.24.2
92+
output: lychee-preview.md
93+
token: ${{ github.token }}
94+
95+
- name: Save lychee cache
96+
if: ${{ always() && steps.restore-lychee-cache.outputs.cache-hit != 'true' && steps.restore-lychee-cache.outputs.cache-primary-key != '' }}
97+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
98+
with:
99+
path: .lycheecache
100+
key: ${{ steps.restore-lychee-cache.outputs.cache-primary-key }}

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,18 @@ jobs:
412412
with:
413413
is-release: ${{ github.ref_type == 'tag' }}
414414

415+
doc-linkcheck:
416+
name: Docs link check
417+
if: ${{ github.repository_owner == 'nvidia' && startsWith(github.ref_name, 'pull-request/') && needs.doc.result == 'success' }}
418+
permissions:
419+
actions: read
420+
contents: read
421+
pull-requests: read
422+
needs:
423+
- doc
424+
secrets: inherit
425+
uses: ./.github/workflows/check-doc-links.yml
426+
415427
checks:
416428
name: Check job status
417429
if: always()
@@ -425,6 +437,7 @@ jobs:
425437
- test-linux-aarch64
426438
- test-windows
427439
- doc
440+
- doc-linkcheck
428441
steps:
429442
- name: Exit
430443
run: |
@@ -460,6 +473,9 @@ jobs:
460473
if ${{ needs.doc.result == 'cancelled' || needs.doc.result == 'failure' }}; then
461474
exit 1
462475
fi
476+
if ${{ needs.doc-linkcheck.result == 'cancelled' || needs.doc-linkcheck.result == 'failure' }}; then
477+
exit 1
478+
fi
463479
if ${{ needs.test-sdist-linux.result == 'cancelled' ||
464480
needs.test-sdist-linux.result == 'failure' ||
465481
needs.test-sdist-windows.result == 'cancelled' ||

0 commit comments

Comments
 (0)