From 87ca432070b7579e5336d2dc56906cef2972f597 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:19:20 +0100 Subject: [PATCH 1/9] Adapt to multidoc for v0.61 --- .github/workflows/ci.yml | 14 ++++++++++++++ doc/source/conf.py | 8 +++++++- ...{requirements_docs.txt => requirements_doc.txt} | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) rename requirements/{requirements_docs.txt => requirements_doc.txt} (94%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58c15a76cb1..52c42192768 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ env: RESET_DOC_BUILD_CACHE: 0 RESET_AUTOSUMMARY_CACHE: 0 PACKAGE_NAME: PyMAPDL + DOCUMENTATION_CNAME: 'mapdl.docs.pyansys.com' jobs: @@ -349,3 +350,16 @@ jobs: overwrite: "{ title: `Release FAILED!`, }" + + upload_docs_release: + name: "Upload release documentation" + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: [release] + steps: + - name: Deploy the stable documentation + uses: pyansys/actions/doc-deploy-stable@v2 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + python-version: '3.9' \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 7512dcd8ea4..0639a9b916d 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -4,10 +4,11 @@ import warnings import numpy as np -from pyansys_sphinx_theme import pyansys_logo_black +from ansys_sphinx_theme import get_version_match, pyansys_logo_black import pyvista from sphinx_gallery.sorting import FileNameSortKey +cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com") from ansys.mapdl.core import __version__ # Manage errors @@ -176,6 +177,11 @@ "additional_breadcrumbs": [ ("PyAnsys", "https://docs.pyansys.com/"), ], + "switcher": { + "json_url": f"https://{cname}/release/versions.json", + "version_match": get_version_match(__version__), + }, + "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], } # -- Options for HTMLHelp output --------------------------------------------- diff --git a/requirements/requirements_docs.txt b/requirements/requirements_doc.txt similarity index 94% rename from requirements/requirements_docs.txt rename to requirements/requirements_doc.txt index 20e9540c061..59bb05bbe48 100644 --- a/requirements/requirements_docs.txt +++ b/requirements/requirements_doc.txt @@ -8,7 +8,7 @@ matplotlib==3.5.1 numpydoc==1.2 pandas==1.4.1 plotly==5.6.0 -pyansys_sphinx_theme==0.2.3 +ansys_sphinx_theme==0.8.0 pypandoc==1.7.4 pytest-sphinx==0.3.1 pythreejs==2.3.0 From 067eb3fd08e8ec96364642e095a9e0c80a8285c9 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:24:03 +0100 Subject: [PATCH 2/9] Adapt precommit for the patch for multidoc for v0.61 --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79dad9763ee..c7e239a22dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,8 +13,8 @@ repos: "--force-sort-within-sections", "--skip-glob", "*__init__.py", ] -- repo: https://gitlab.com/PyCQA/flake8 - rev: 3.9.2 +- repo: https://github.com/PyCQA/flake8 + rev: 6.0.0 hooks: - id: flake8 From bb9a72ff07bc0fcbd4c6a3f5bc0e97d110bd8369 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:27:09 +0100 Subject: [PATCH 3/9] Resolve style error --- doc/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 0639a9b916d..af8e1b0d732 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -3,8 +3,8 @@ import os import warnings -import numpy as np from ansys_sphinx_theme import get_version_match, pyansys_logo_black +import numpy as np import pyvista from sphinx_gallery.sorting import FileNameSortKey @@ -177,7 +177,7 @@ "additional_breadcrumbs": [ ("PyAnsys", "https://docs.pyansys.com/"), ], - "switcher": { + "switcher": { "json_url": f"https://{cname}/release/versions.json", "version_match": get_version_match(__version__), }, From 61c145bc8964f956f030fc633c840ea8512f10f0 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:33:21 +0100 Subject: [PATCH 4/9] rename reqirement.doc in ci/cd --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52c42192768..2c1d59711d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,7 +137,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements/requirements_docs*.txt') }} + key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements/requirements_doc*.txt') }} restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} @@ -193,7 +193,7 @@ jobs: - name: Install Docs Build Requirements run: | - pip install -r requirements/requirements_docs.txt + pip install -r requirements/requirements_doc.txt - name: Build Documentation run: | From 0e9c06a6c5045b0029a7f15948850361aa690dc3 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:43:10 +0100 Subject: [PATCH 5/9] Modify make file --- .github/workflows/ci.yml | 14 +++++++++----- doc/Makefile | 35 +++++++++++++---------------------- doc/make.bat | 10 +++------- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c1d59711d4..a738bea4831 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,10 @@ env: PACKAGE_NAME: PyMAPDL DOCUMENTATION_CNAME: 'mapdl.docs.pyansys.com' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: stylecheck: @@ -178,7 +182,7 @@ jobs: - name: Cache docs build directory uses: actions/cache@v2 with: - path: doc/build + path: doc/_build key: doc-build-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }} restore-keys: | doc-build-${{ steps.version.outputs.PYMAPDL_VERSION }} @@ -201,14 +205,14 @@ jobs: - name: Zip documentation run: | - cd doc/build/html + cd doc/_build/html zip -r PyMAPDL_documentation.zip * - name: Upload HTML Documentation uses: actions/upload-artifact@v2 with: name: HTML-Documentation - path: doc/build/html/PyMAPDL_documentation.zip + path: doc/_build/html/PyMAPDL_documentation.zip retention-days: 7 - name: Deploy @@ -218,7 +222,7 @@ jobs: repository-name: pyansys/pymapdl-docs token: ${{ steps.get_workflow_token.outputs.token }} BRANCH: gh-pages - FOLDER: doc/build/html + FOLDER: doc/_build/html CLEAN: true - name: Build PDF Documentation @@ -229,7 +233,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: PDF-Documentation - path: doc/build/latex/pymapdl*.pdf + path: doc/_build/latex/pymapdl*.pdf retention-days: 7 build_test: diff --git a/doc/Makefile b/doc/Makefile index 5a82ab57bb0..d68c6ff0b3e 100755 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,43 +1,34 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. SPHINXOPTS = -j auto SPHINXBUILD = sphinx-build SOURCEDIR = source -BUILDDIR = build +BUILDDIR = _build + # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - .PHONY: help Makefile - # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - - # customized clean due to examples gallery clean: rm -rf $(BUILDDIR)/* rm -rf source/examples find . -type d -name "_autosummary" -exec rm -rf {} + - # customized clean due to examples gallery clean-except-examples: rm -rf $(BUILDDIR)/* rm -rf images/auto-generated find . -type d -name "_autosummary" -exec rm -rf {} + - # customized to build the pdf rather than using latexpdf due to various issues # with our docs like GIFs being written as PNG. pdf: @$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) python validate_png.py # clean-up GIFs mislabeled as PNG - cd build/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true - (test -f build/latex/*.pdf && echo pdf exists) || exit 1 + cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true + (test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1 # manually deploy to https://github.com/pyansys/pymapdl-docs # WARNING: Use with care as this overwrites history of gh-pages @@ -47,12 +38,12 @@ deploy: @echo "This overwrites the history of gh-pages." @echo "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ] @echo "Deploying..." - touch build/html/.nojekyll - echo "mapdldocs.pyansys.com" >> build/html/CNAME - cd build/html && git init - cd build/html && git add . - cd build/html && git checkout -b gh-pages - cd build/html && git commit -am "manual build" - cd build/html && git remote add origin https://github.com/pyansys/pymapdl-docs - cd build/html && git push -u origin gh-pages --force - rm -rf build/html/.git + touch $(BUILDDIR)/html/.nojekyll + echo "mapdldocs.pyansys.com" >> $(BUILDDIR)/html/CNAME + cd $(BUILDDIR)/html && git init + cd $(BUILDDIR)/html && git add . + cd $(BUILDDIR)/html && git checkout -b gh-pages + cd $(BUILDDIR)/html && git commit -am "manual build" + cd $(BUILDDIR)/html && git remote add origin https://github.com/pyansys/pymapdl-docs + cd $(BUILDDIR)/html && git push -u origin gh-pages --force + rm -rf $(BUILDDIR)/html/.git \ No newline at end of file diff --git a/doc/make.bat b/doc/make.bat index 6247f7e2317..e3e38e32e76 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -1,14 +1,12 @@ @ECHO OFF - pushd %~dp0 - REM Command file for Sphinx documentation - if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=source -set BUILDDIR=build +set BUILDDIR=_build + if "%1" == "" goto help @@ -24,12 +22,10 @@ if errorlevel 9009 ( echo.http://sphinx-doc.org/ exit /b 1 ) - %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% goto end :help %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - :end -popd +popd \ No newline at end of file From 416fe16afa3a143273b124636791fbefbbebc2b0 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:46:18 +0100 Subject: [PATCH 6/9] Modify deploy actions --- .github/workflows/ci.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a738bea4831..288e9c2f95c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,16 +215,6 @@ jobs: path: doc/_build/html/PyMAPDL_documentation.zip retention-days: 7 - - name: Deploy - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - uses: JamesIves/github-pages-deploy-action@4.1.4 - with: - repository-name: pyansys/pymapdl-docs - token: ${{ steps.get_workflow_token.outputs.token }} - BRANCH: gh-pages - FOLDER: doc/_build/html - CLEAN: true - - name: Build PDF Documentation working-directory: doc run: make pdf @@ -354,7 +344,18 @@ jobs: overwrite: "{ title: `Release FAILED!`, }" - + upload_dev_docs: + name: "Upload dev documentation" + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: [docs_build] + steps: + - name: Deploy the latest documentation + uses: pyansys/actions/doc-deploy-dev@v2 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + upload_docs_release: name: "Upload release documentation" if: github.event_name == 'push' && contains(github.ref, 'refs/tags') @@ -366,4 +367,5 @@ jobs: with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - python-version: '3.9' \ No newline at end of file + python-version: '3.9' + From a1b130508dc5d0b4442e2daf093cbe73bce0db07 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 7 Dec 2022 13:53:38 +0100 Subject: [PATCH 7/9] Modify theme name --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index af8e1b0d732..da2e79431c2 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -168,7 +168,7 @@ # -- Options for HTML output ------------------------------------------------- html_short_title = html_title = "PyMAPDL" -html_theme = "pyansys_sphinx_theme" +html_theme = "ansys_sphinx_theme" html_logo = pyansys_logo_black html_theme_options = { "github_url": "https://github.com/pyansys/pymapdl", From e7db84a5657519c184454a6a0513da794a081873 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Garrido Date: Wed, 7 Dec 2022 15:54:41 +0100 Subject: [PATCH 8/9] FIX: output doc/_build dir --- doc/validate_png.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/validate_png.py b/doc/validate_png.py index 16d495e2b5f..921d5d3b85e 100644 --- a/doc/validate_png.py +++ b/doc/validate_png.py @@ -9,7 +9,7 @@ from PIL import Image this_path = os.path.dirname(os.path.abspath(__file__)) -check_path = os.path.join(this_path, "build", "latex") +check_path = os.path.join(this_path, "_build", "latex") if not os.path.isdir(check_path): raise FileNotFoundError(f"Invalid path {check_path}") From 360d048e3949c0bc19bb7125c2c6a17c4c3e4498 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Garrido Date: Wed, 7 Dec 2022 15:56:31 +0100 Subject: [PATCH 9/9] CI: deploy only stable --- .github/workflows/ci.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 288e9c2f95c..fc52c7736c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -344,18 +344,7 @@ jobs: overwrite: "{ title: `Release FAILED!`, }" - upload_dev_docs: - name: "Upload dev documentation" - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: [docs_build] - steps: - - name: Deploy the latest documentation - uses: pyansys/actions/doc-deploy-dev@v2 - with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} - + upload_docs_release: name: "Upload release documentation" if: github.event_name == 'push' && contains(github.ref, 'refs/tags')