Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,6 @@ jobs:
./build_all_docs.sh latest-only
else
./build_all_docs.sh
# At release time, we don't want to update the latest docs
rm -rf build/html/latest
# Nor the shared version-switcher file at the docs root: the theme
# fetches it from one URL for every version, and main deploys own it.
# A release built from a branch would overwrite it with a stale list.
rm -f build/html/nv-versions.json build/html/versions.json
fi
ls -l build
popd
Expand All @@ -346,12 +340,6 @@ jobs:
./build_docs.sh latest-only
else
./build_docs.sh
# At release time, we don't want to update the latest docs
rm -rf build/html/latest
# Nor the shared version-switcher file at the docs root: the theme
# fetches it from one URL for every version, and main deploys own it.
# A release built from a branch would overwrite it with a stale list.
rm -f build/html/nv-versions.json build/html/versions.json
fi
ls -l build
popd
Expand All @@ -363,6 +351,10 @@ jobs:
fi
mv "${COMPONENT}"/docs/build/html/* "artifacts/docs/${TARGET}"

- name: Remove shared files from release docs
if: ${{ inputs.is-release }}
run: bash .ci-control/ci/tools/remove_shared_release_docs.sh artifacts/docs

# Check links and anchors in the rendered HTML built above.
# Links in authored Markdown and reST files are checked separately by the
# ordinary Linux/Windows pre-commit jobs.
Expand Down
13 changes: 13 additions & 0 deletions ci/tools/remove_shared_release_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

payload=$1
# The main docs build owns these paths at each component root.
for root in "$payload" "$payload"/cuda-{bindings,core,pathfinder}; do
rm -rf -- "$root/latest"
rm -f -- "$root"/{nv-versions.json,versions.json,objects.inv}
done
43 changes: 43 additions & 0 deletions ci/tools/tests/test_release_docs_payload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import shutil
import subprocess
from pathlib import Path

import pytest


@pytest.mark.parametrize(
"components",
[("cuda-bindings",), ("", "cuda-bindings", "cuda-core", "cuda-pathfinder")],
ids=["bindings", "all"],
)
@pytest.mark.agent_authored(model="GPT-6")
def test_release_docs_preserve_shared_files(tmp_path, components):
payload = tmp_path / "payload"
pages = tmp_path / "pages"
shared = ("objects.inv", "nv-versions.json", "versions.json", "latest/index.html")
versioned = ("12.9.11/objects.inv", "12.9.11/release/12.9.11-notes.html")

for component in components:
for name in shared:
path = pages / component / name
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text("main", encoding="utf-8")
for name in (*shared, *versioned):
path = payload / component / name
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text("release", encoding="utf-8")

tool = Path(__file__).resolve().parents[1] / "remove_shared_release_docs.sh"
subprocess.run(["bash", str(tool), str(payload)], check=True) # noqa: S603, S607

# Simulate the Pages deploy's overlay of the staged files.
shutil.copytree(payload, pages, dirs_exist_ok=True)
for component in components:
for name in shared:
path = pages / component / name
assert path.read_text(encoding="utf-8") == "main", path.relative_to(pages)
for name in versioned:
assert (pages / component / name).read_text(encoding="utf-8") == "release"
Loading