Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P/38224/jupyter sphinx optional test2 #70

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions .ci/create-changes-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highli
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>' >> CHANGES.html
echo '<script>hljs.highlightAll();</script>' >> CHANGES.html
cat >> CHANGES.html << EOF
<style>
p.diff a:first-child {
font-weight: bold;
font-size: x-large;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
// This URL is hardcoded in the file .github/workflows/doc-publish.yml.
Expand Down
78 changes: 54 additions & 24 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,57 @@ jobs:
- name: Start container
id: container
# Try to continue when "exporting to GitHub Actions Cache" failed with timeout
if: (success() || failure())
run: |
docker run --name BUILD -dit \
--mount type=bind,src=$(pwd),dst=$(pwd) \
--workdir $(pwd) \
${{ env.BUILD_IMAGE }} /bin/sh

#
# On PRs and pushes to develop
# On pull request and push to develop events
#

- name: Get workflow run-id
id: get_run_id
if: steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/') && github.event_name == 'pull_request'
run: |
RESPONSE=$(curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs?event=push&branch=develop&status=completed")
RUN_ID=$(echo "$RESPONSE" | jq -r --arg name "${{ github.workflow }}" --arg conclusion "success" \
'.workflow_runs[] | select(.name == $name and .conclusion == $conclusion) | .id' | head -n 1)
echo "RUN_ID=$RUN_ID" >> $GITHUB_ENV

- name: Download old doc
id: download-doc
if: steps.get_run_id.outcome == 'success'
uses: actions/download-artifact@v4
with:
name: doc-develop
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ env.RUN_ID }}

- name: Store old doc
id: worktree
if: (success() || failure()) && steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
if: steps.download-doc.outcome == 'success'
run: |
git config --global --add safe.directory $(pwd)
git config --global user.email "ci-sage@example.com"
git config --global user.name "Build documentation workflow"
mkdir -p doc
# Check if we are on PR
unzip doc.zip
PR_NUMBER=""
if [[ -n "$GITHUB_REF" ]]; then
if [[ "$GITHUB_REF" =~ refs/pull/([0-9]+)/merge ]]; then
PR_NUMBER="${BASH_REMATCH[1]}"
fi
if [[ "$GITHUB_REF" =~ refs/pull/([0-9]+)/merge ]]; then
PR_NUMBER="${BASH_REMATCH[1]}"
fi
# If so, then prepare to create CHANGES.html
# Create CHANGES.html
if [[ -n "$PR_NUMBER" ]]; then
# mathjax path in old doc (regex)
mathjax_path_from="[-./A-Za-z_]*/tex-chtml[.]js?v=[0-9a-f]*"
# mathjax path in new doc
mathjax_path_to=$(docker exec -e SAGE_USE_CDNS=yes BUILD /sage/sage -python -c "from sage_docbuild.conf import mathjax_path; print(mathjax_path)")
new_version=$(docker exec BUILD cat src/VERSION.txt)
docker cp BUILD:/sage/local/share/doc/sage/html doc/
# Wipe out chronic diffs between old doc and new doc
(cd doc && \
find . -name "*.html" | xargs sed -i -e '/class="sidebar-brand-text"/ s/Sage [0-9a-z.]* /Sage '"$new_version"' /' \
Expand All @@ -159,14 +176,14 @@ jobs:
# Create git repo from old doc
(cd doc && \
git init && \
(echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && \
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; \
(echo "*.svg binary"; echo "*.pdf binary") > .gitattributes && \
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore && \
git add -A && git commit --quiet -m 'old')
fi

- name: Build doc
id: docbuild
if: (success() || failure()) && steps.worktree.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
if: steps.container.outcome == 'success' && !startsWith(github.ref, 'refs/tags/')
# Always non-incremental because of the concern that
# incremental docbuild may introduce broken links (inter-file references) though build succeeds
run: |
Expand All @@ -175,18 +192,22 @@ jobs:
export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5
make doc-clean doc-uninstall
export SAGE_USE_CDNS=yes
export SAGE_DOCBUILD_OPTS="--no-preparsed-examples --include-tests-blocks"
./config.status && make sagemath_doc_html-no-deps
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}

- name: Copy doc
id: copy
if: (success() || failure()) && steps.docbuild.outcome == 'success'
if: steps.docbuild.outcome == 'success'
run: |
set -ex
# We copy everything to a local folder
docker cp --follow-link BUILD:/sage/local/share/doc/sage/html doc
docker cp --follow-link BUILD:/sage/local/share/doc/sage/index.html doc
# Check if we are on PR
# Simpler "docker cp --follow-link ... doc" does not work
mkdir -p doc
mkdir -p temp
docker cp --follow-link BUILD:/sage/local/share/doc/sage/html temp
docker cp --follow-link BUILD:/sage/local/share/doc/sage/index.html temp
cp -r -L temp/* doc/
# Check if we are on pull request event
PR_NUMBER=""
if [[ -n "$GITHUB_REF" ]]; then
if [[ "$GITHUB_REF" =~ refs/pull/([0-9]+)/merge ]]; then
Expand Down Expand Up @@ -218,19 +239,28 @@ jobs:

- name: Upload doc
id: upload
if: (success() || failure()) && steps.copy.outcome == 'success'
if: steps.copy.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: doc
path: doc.zip

- name: Upload doc-develop
# artifact doc-develop is used for doc build on pull request event
id: upload-push
if: steps.copy.outcome == 'success' && github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: doc-${{ github.ref_name }}
path: doc.zip

#
# On release tags: live doc and wheels
# On release tag event
#

- name: Build live doc
id: buildlivedoc
if: (success() || failure()) && startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/')
run: |
export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5
export PATH="build/bin:$PATH"
Expand All @@ -246,7 +276,7 @@ jobs:

- name: Copy live doc
id: copylivedoc
if: (success() || failure()) && steps.buildlivedoc.outcome == 'success'
if: steps.buildlivedoc.outcome == 'success'
run: |
mkdir -p ./livedoc
# We copy everything to a local folder
Expand All @@ -256,7 +286,7 @@ jobs:
zip -r livedoc.zip livedoc

- name: Upload live doc
if: (success() || failure()) && steps.copylivedoc.outcome == 'success'
if: steps.copylivedoc.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: livedoc
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/sagemath_doc_html/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon jmol ipywidgets jupyter_sphinx sage_docbuild elliptic_curves furo fpylll graphs
sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon jmol ipywidgets sage_docbuild elliptic_curves furo fpylll graphs

# Building the documentation has many dependencies, because all
# documented modules are imported and because we use matplotlib to
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/sagemath_doc_html/dependencies_optional
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jupyter_sphinx
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ AC_ARG_ENABLE([cvxopt],
AC_ARG_ENABLE([notebook],
AS_HELP_STRING([--disable-notebook],
[disable build of the Jupyter notebook and related packages]), [
for pkg in notebook nbconvert beautifulsoup4 sagenb_export nbformat nbclient terminado send2trash prometheus_client mistune pandocfilters bleach defusedxml jsonschema jupyter_jsmol argon2_cffi argon2_cffi_bindings webencodings tinycss2 ipympl soupsieve fastjsonschema anyio arrow async_lru fqdn isoduration json5 jsonpointer jsonschema_specifications jupyter_events jupyter_lsp jupyter_server jupyter_server_terminals jupyterlab jupyterlab_server jupyterlab_pygments jupyterlab_mathjax2 notebook_shim overrides python_json_logger pyyaml referencing rfc3339_validator rfc3986_validator sniffio types_python_dateutil uri_template webcolors websocket_client; do
for pkg in notebook nbconvert beautifulsoup4 sagenb_export nbformat nbclient terminado send2trash prometheus_client mistune pandocfilters bleach defusedxml jsonschema jupyter_jsmol argon2_cffi argon2_cffi_bindings webencodings tinycss2 ipympl soupsieve fastjsonschema anyio arrow async_lru fqdn isoduration json5 jsonpointer jsonschema_specifications jupyter_events jupyter_lsp jupyter_server jupyter_server_terminals jupyterlab jupyterlab_server jupyterlab_pygments jupyterlab_mathjax2 jupyter_sphinx notebook_shim overrides python_json_logger pyyaml referencing rfc3339_validator rfc3986_validator sniffio types_python_dateutil uri_template webcolors websocket_client; do
AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval])
done
])
Expand Down
5 changes: 5 additions & 0 deletions src/doc/ca/intro/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/de/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/de/thematische_anleitungen/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/de/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/el/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/constructions/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/developer/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/faq/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/installation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/prep/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/reference/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release, latex_elements, exclude_patterns
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/reference/conf_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release, exclude_patterns
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/thematic_tutorials/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/thematic_tutorials/numerical_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
Loading
Loading