Skip to content

Commit b5d3769

Browse files
authored
DOC: implement multi-doc in v0.62 (#1678)
* MAINT: rename requirements_docs.txt -> requirements_doc.txt * DOC: update to ansys-sphinx-theme * DOC: update conf.py file * DOC: rename build to _build dir * CI: update * FIX: do not use latest pyvista * CI: deploy only stable * FIX: pyvista aliasing command * FIX: script for validating images
1 parent 1f9edc3 commit b5d3769

File tree

8 files changed

+50
-41
lines changed

8 files changed

+50
-41
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
1515
PYMAPDL_START_INSTANCE: FALSE
1616
PYANSYS_OFF_SCREEN: True
17+
DOCUMENTATION_CNAME: "mapdl.docs.pyansys.com"
1718
DOCKER_PACKAGE: ghcr.io/pyansys/pymapdl/mapdl
1819
DOCKER_IMAGE_VERSION_DOCS_BUILD: v21.2.1
1920
# Following env vars when changed will "reset" the mentioned cache,
@@ -27,6 +28,10 @@ env:
2728
RESET_AUTOSUMMARY_CACHE: 0
2829
PACKAGE_NAME: PyMAPDL
2930

31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.ref }}
33+
cancel-in-progress: true
34+
3035
jobs:
3136

3237
stylecheck:
@@ -197,43 +202,28 @@ jobs:
197202
198203
- name: Install Docs Build Requirements
199204
run: |
200-
pip install -r requirements/requirements_docs.txt
205+
pip install -r requirements/requirements_doc.txt
201206
202207
- name: Build Documentation
203208
run: |
204209
xvfb-run make -C doc html SPHINXOPTS="-j auto -W --keep-going"
205210
206-
- name: Zip documentation
207-
run: |
208-
cd doc/build/html
209-
zip -r PyMAPDL_documentation.zip *
210-
211211
- name: Upload HTML Documentation
212212
uses: actions/upload-artifact@v2
213213
with:
214-
name: HTML-Documentation
215-
path: doc/build/html/PyMAPDL_documentation.zip
214+
name: documentation-html
215+
path: doc/_build/html
216216
retention-days: 7
217217

218-
- name: Deploy
219-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
220-
uses: JamesIves/[email protected]
221-
with:
222-
repository-name: pyansys/pymapdl-docs
223-
token: ${{ steps.get_workflow_token.outputs.token }}
224-
BRANCH: gh-pages
225-
FOLDER: doc/build/html
226-
CLEAN: true
227-
228218
- name: Build PDF Documentation
229219
working-directory: doc
230220
run: make pdf
231221

232222
- name: Upload PDF Documentation
233223
uses: actions/upload-artifact@v2
234224
with:
235-
name: PDF-Documentation
236-
path: doc/build/latex/pymapdl*.pdf
225+
name: documentation-pdf
226+
path: doc/_build/latex/pymapdl*.pdf
237227
retention-days: 7
238228

239229
build_test:
@@ -359,3 +349,16 @@ jobs:
359349
overwrite: "{
360350
title: `Release FAILED!`,
361351
}"
352+
353+
upload_docs_release:
354+
name: "Upload release documentation"
355+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
356+
runs-on: ubuntu-latest
357+
needs: [Release]
358+
steps:
359+
- name: Deploy the stable documentation
360+
uses: pyansys/actions/doc-deploy-stable@v2
361+
with:
362+
cname: ${{ env.DOCUMENTATION_CNAME }}
363+
token: ${{ secrets.GITHUB_TOKEN }}
364+
python-version: '3.10'

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
"--force-sort-within-sections",
1414
"--skip-glob", "*__init__.py",
1515
]
16-
- repo: https://gitlab.com/PyCQA/flake8
16+
- repo: https://github.com/PyCQA/flake8
1717
rev: 3.9.2
1818
hooks:
1919
- id: flake8

doc/Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
SPHINXOPTS = -j auto
66
SPHINXBUILD = sphinx-build
77
SOURCEDIR = source
8-
BUILDDIR = build
8+
BUILDDIR = _build
99

1010
# Put it first so that "make" without argument is like "make help".
1111
help:
@@ -36,8 +36,8 @@ clean-except-examples:
3636
pdf:
3737
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3838
python validate_png.py # clean-up GIFs mislabeled as PNG
39-
cd build/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
40-
(test -f build/latex/*.pdf && echo pdf exists) || exit 1
39+
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
40+
(test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1
4141

4242
# manually deploy to https://github.com/pyansys/pymapdl-docs
4343
# WARNING: Use with care as this overwrites history of gh-pages
@@ -47,12 +47,12 @@ deploy:
4747
@echo "This overwrites the history of gh-pages."
4848
@echo "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]
4949
@echo "Deploying..."
50-
touch build/html/.nojekyll
51-
echo "mapdldocs.pyansys.com" >> build/html/CNAME
52-
cd build/html && git init
53-
cd build/html && git add .
54-
cd build/html && git checkout -b gh-pages
55-
cd build/html && git commit -am "manual build"
56-
cd build/html && git remote add origin https://github.com/pyansys/pymapdl-docs
57-
cd build/html && git push -u origin gh-pages --force
58-
rm -rf build/html/.git
50+
touch $(BUILDDIR)/html/.nojekyll
51+
echo "mapdldocs.pyansys.com" >> $(BUILDDIR)/html/CNAME
52+
cd $(BUILDIR)/html && git init
53+
cd $(BUILDIR)/html && git add .
54+
cd $(BUILDIR)/html && git checkout -b gh-pages
55+
cd $(BUILDIR)/html && git commit -am "manual build"
56+
cd $(BUILDIR)/html && git remote add origin https://github.com/pyansys/pymapdl-docs
57+
cd $(BUILDIR)/html && git push -u origin gh-pages --force
58+
rm -rf $(BUILDDIR)/html/.git

doc/source/conf.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import os
44
import warnings
55

6+
from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black
67
import numpy as np
7-
from pyansys_sphinx_theme import pyansys_logo_black
88
import pyvista
99
from sphinx_gallery.sorting import FileNameSortKey
1010

@@ -45,6 +45,7 @@
4545

4646
# The short X.Y version
4747
release = version = __version__
48+
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")
4849

4950

5051
# -- General configuration ---------------------------------------------------
@@ -106,7 +107,7 @@
106107
}
107108

108109
# Favicon
109-
html_favicon = "favicon.png"
110+
html_favicon = ansys_favicon
110111

111112
# notfound.extension
112113
notfound_template = "404.rst"
@@ -179,12 +180,17 @@
179180

180181
# -- Options for HTML output -------------------------------------------------
181182
html_short_title = html_title = "PyMAPDL"
182-
html_theme = "pyansys_sphinx_theme"
183+
html_theme = "ansys_sphinx_theme"
183184
html_logo = pyansys_logo_black
184185
html_theme_options = {
185186
"github_url": "https://github.com/pyansys/pymapdl",
186187
"show_prev_next": False,
187188
"show_breadcrumbs": True,
189+
"switcher": {
190+
"json_url": f"https://{cname}/release/versions.json",
191+
"version_match": get_version_match(__version__),
192+
},
193+
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
188194
"additional_breadcrumbs": [
189195
("PyAnsys", "https://docs.pyansys.com/"),
190196
],

doc/source/examples/technology_showcase_examples/techdemo-1/ex_0-tecbrakesqueal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Start this example by launching MAPDL and loading the model.
220220
pyvista.global_theme.background = 'white'
221221
pyvista.global_theme.window_size = [600, 400]
222222
pyvista.global_theme.axes.show = True
223-
pyvista.global_theme.antialiasing = True
223+
pyvista.global_theme.anti_aliasing = "fxaa"
224224
pyvista.global_theme.show_scalar_bar = True
225225

226226
from ansys.mapdl.core import examples

doc/source/examples/technology_showcase_examples/techdemo-28/ex_28-tecfricstir.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ cylindrical shape tool, as shown in the following figure:
121121
pyvista.global_theme.background = 'white'
122122
pyvista.global_theme.window_size = [600, 400]
123123
pyvista.global_theme.axes.show = True
124-
pyvista.global_theme.antialiasing = True
124+
pyvista.global_theme.anti_aliasing = "fxaa"
125125
pyvista.global_theme.show_scalar_bar = True
126126
mytheme = pyvista.global_theme
127127

doc/validate_png.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from PIL import Image
1010

1111
this_path = os.path.dirname(os.path.abspath(__file__))
12-
check_path = os.path.join(this_path, "build", "latex")
12+
check_path = os.path.join(this_path, "_build", "latex")
1313
if not os.path.isdir(check_path):
1414
raise FileNotFoundError(f"Invalid path {check_path}")
1515

requirements/requirements_docs.txt renamed to requirements/requirements_doc.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ matplotlib==3.5.2
88
numpydoc==1.3.1
99
pandas==1.4.2
1010
plotly==5.8.0
11-
pyansys_sphinx_theme==0.3.1
11+
ansys-sphinx-theme==0.8.0
1212
pypandoc==1.8.1
1313
pytest-sphinx==0.4.0
1414
pythreejs==2.3.0
15-
https://github.com/pyvista/pyvista/archive/main.zip # need latest
15+
# https://github.com/pyvista/pyvista/archive/main.zip # need latest
1616
sphinx-autobuild==2021.3.14
1717
sphinx-autodoc-typehints==1.18.1
1818
sphinx-copybutton==0.5.0

0 commit comments

Comments
 (0)