From e45bad48e95f59af33adc21d8acbf7fa1dae6a7b Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Tue, 5 May 2026 14:50:14 -0500 Subject: [PATCH 1/4] [3.14] Rewrite RTD configuration to use build.jobs rather than build.commands (GH-149429) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- .readthedocs.yml | 64 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 0a2c3f8345367f..b6359c381f28b7 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,23 +12,47 @@ build: tools: python: "3" - commands: - # https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition - # - # Cancel building pull requests when there aren't changes in the Doc directory. - # - # If there are no changes (git diff exits with 0) we force the command to return with 183. - # This is a special exit code on Read the Docs that will cancel the build immediately. - - | - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ]; - then - echo "No changes to Doc/ - exiting the build."; - exit 183; - fi - - - asdf plugin add uv - - asdf install uv latest - - asdf global uv latest - - make -C Doc venv html - - mkdir _readthedocs - - mv Doc/build/html _readthedocs/html + jobs: + post_checkout: + # https://docs.readthedocs.com/platform/stable/guides/build/skip-build.html#skip-builds-based-on-conditions + # + # Cancel building pull requests when there aren't changes in the Doc + # directory or RTD configuration, or if we can't cleanly merge the base + # branch. + - | + set -eEux; + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; + then + base_branch=3.14; + git fetch --depth=50 origin $base_branch; + for attempt in $(seq 10); + do + if ! git merge-base HEAD origin/$base_branch; + then + git fetch --deepen=50 origin $base_branch; + else + break; + fi; + done; + if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin/$base_branch; + then + echo "Unsuccessful merge with '$base_branch' branch, skipping the build"; + exit 183; + fi; + if git diff --exit-code --stat origin/$base_branch -- Doc/ .readthedocs.yml; + then + echo "No changes to Doc/ - skipping the build."; + exit 183; + fi; + fi; + create_environment: + - echo "Skipping default environment creation" + install: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + build: + html: + - make -C Doc venv html + - mkdir -p "$READTHEDOCS_OUTPUT" + - mv Doc/build/html "$READTHEDOCS_OUTPUT/" From 9981d11b0670f40bee15d17d4ba721dcf0f8bdc5 Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Tue, 5 May 2026 16:10:44 -0500 Subject: [PATCH 2/4] fixup! [3.14] Rewrite RTD configuration to use build.jobs rather than build.commands (GH-149429) --set-upstream on initial fetch --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index b6359c381f28b7..838ab1f5cb42a2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -24,7 +24,7 @@ build: if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; then base_branch=3.14; - git fetch --depth=50 origin $base_branch; + git fetch --set-upstream --depth=50 origin $base_branch; for attempt in $(seq 10); do if ! git merge-base HEAD origin/$base_branch; From 405895e35a4fe2e4585dc39fc168bdf72ab5d8e8 Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Tue, 5 May 2026 16:20:33 -0500 Subject: [PATCH 3/4] fixup! [3.14] Rewrite RTD configuration to use build.jobs rather than build.commands (GH-149429) no --set-upstream, add explicit origin/? --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 838ab1f5cb42a2..49f46785b94f45 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -24,7 +24,7 @@ build: if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; then base_branch=3.14; - git fetch --set-upstream --depth=50 origin $base_branch; + git fetch --depth=50 origin $base_branch:origin/$base_branch; for attempt in $(seq 10); do if ! git merge-base HEAD origin/$base_branch; From cbff54df5bbcba8949f42ce8c8788cc5386e1ef5 Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Wed, 6 May 2026 09:39:52 -0500 Subject: [PATCH 4/4] fixup! [3.14] Rewrite RTD configuration to use build.jobs rather than build.commands (GH-149429) Fixups from `main` --- .readthedocs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 49f46785b94f45..82a199c85a0375 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -24,22 +24,22 @@ build: if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; then base_branch=3.14; - git fetch --depth=50 origin $base_branch:origin/$base_branch; + git fetch --depth=50 origin $base_branch:origin-$base_branch; for attempt in $(seq 10); do - if ! git merge-base HEAD origin/$base_branch; + if ! git merge-base HEAD origin-$base_branch; then git fetch --deepen=50 origin $base_branch; else break; fi; done; - if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin/$base_branch; + if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin-$base_branch; then echo "Unsuccessful merge with '$base_branch' branch, skipping the build"; exit 183; fi; - if git diff --exit-code --stat origin/$base_branch -- Doc/ .readthedocs.yml; + if git diff --exit-code --stat origin-$base_branch -- Doc/ .readthedocs.yml; then echo "No changes to Doc/ - skipping the build."; exit 183;