Skip to content

Commit

Permalink
CI: Add deploy to github pages (#163)
Browse files Browse the repository at this point in the history
* CI: Add deploy step in doc-build

* REFACT: Cleanup doc config file

* REFACTOR: Use ansys action to deploy
  • Loading branch information
SMoraisAnsys authored Jul 12, 2024
1 parent e4263bb commit afa1635
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 95 deletions.
35 changes: 9 additions & 26 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ on:
- cron: "0 3 * * *"

env:
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'pyaedt-examples'
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
DOCUMENTATION_CNAME: 'examples.aedt.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.10'
ON_CI: True
PACKAGE_NAME: 'pyaedt-examples'
PYAEDT_NON_GRAPHICAL: '1'
PYAEDT_DOC_GENERATION: '1'

Expand Down Expand Up @@ -93,28 +94,10 @@ jobs:
path: doc/_build/latex
retention-days: 7

release:
if: github.event_name == 'refs/heads/main' && !contains(github.ref, 'refs/tags')
needs: [doc-build, doc-style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4

- name: Display structure of downloaded files
run: ls -R

- name: Zip HTML documentation
uses: vimtor/action-zip@v1.2
- name: Deploy
if: contains(github.ref, 'refs/heads/main')
uses: ansys/actions/doc-deploy-dev@v4
with:
files: documentation-html
dest: documentation-html.zip

- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
./documentation-html.zip
./documentation-pdf/*.pdf
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: 'documentation-html'
71 changes: 2 additions & 69 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@
from pathlib import Path
from pprint import pformat
from docutils.nodes import document

# import re
import shutil
from typing import Any
from sphinx.application import Sphinx
import sys
import warnings

# from sphinx_gallery.sorting import FileNameSortKey
from ansys_sphinx_theme import (
ansys_favicon,
ansys_logo_white,
ansys_logo_white_cropped,
# get_version_match,
latex,
pyansys_logo_black,
watermark,
Expand Down Expand Up @@ -51,9 +45,6 @@
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")
release = version = "0.1.dev0"

# os.environ["PYAEDT_NON_GRAPHICAL"] = "1"
# os.environ["PYAEDT_DOC_GENERATION"] = "1"

# -- Connect functions (hooks) to Sphinx events -----------------------------

class PrettyPrintDirective(Directive):
Expand Down Expand Up @@ -343,20 +334,6 @@ def setup(app):
# separating the parameter name and type",
}

# numpydoc_validation_exclude = { # set of regex
# r"\.AEDTMessageManager.add_message$", # bad SS05
# r"\.Modeler3D\.create_choke$", # bad RT05
# r"HistoryProps.", # bad RT05 because of the base class named OrderedDict
# }

# # Add any paths that contain templates here, relative to this directory.
# templates_path = ["_templates"]

# # disable generating the sphinx nested documentation
# if "PYAEDT_CI_NO_AUTODOC" in os.environ:
# templates_path.clear()


# Copy button customization ---------------------------------------------------
# exclude traditional Python prompts from the copied code
copybutton_prompt_text = r">>> ?|\.\.\. "
Expand All @@ -370,21 +347,9 @@ def setup(app):
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [
# "_build",
# "sphinx_boogergreen_theme_1",
# "Thumbs.db",
# ".DS_Store",
# "*.txt",
"conf.py",
# "constants.py",
]

# inheritance_graph_attrs = dict(rankdir="RL", size='"8.0, 10.0"', fontsize=14, ratio="compress")
# inheritance_node_attrs = dict(
# shape="ellipse", fontsize=14, height=0.75, color="dodgerblue1", style="filled"
# )


# -- Options for HTML output -------------------------------------------------

source_suffix = {".rst": "restructuredtext", ".md": "markdown"}
Expand All @@ -410,47 +375,15 @@ def setup(app):
}

# Pyvista customization
# pyvista.set_error_output_file("errors.txt")
# Ensure that offscreen rendering is used for docs generation
# pyvista.OFF_SCREEN = True
# Preferred plotting style for documentation
# pyvista.set_plot_theme('document')
# must be less than or equal to the XVFB window size

# Must be less than or equal to the XVFB window size
pyvista.global_theme["window_size"] = np.array([1024, 768])

# Save figures in specified directory
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
if not os.path.exists(pyvista.FIGURE_PATH):
os.makedirs(pyvista.FIGURE_PATH)

# # suppress annoying matplotlib bug
# warnings.filterwarnings(
# "ignore",
# category=UserWarning,
# message="Matplotlib is currently using agg so figures are not shown.",
# )

# necessary for pyvista when building the sphinx gallery
# pyvista.BUILDING_GALLERY = True

# jinja_contexts = {
# "main_toctree": {
# "run_examples": config["run_examples"],
# },
# }
# def prepare_jinja_env(jinja_env) -> None:
# """
# Customize the jinja env.
#
# Notes
# -----
# See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment
# """
# jinja_env.globals["project_name"] = project
#
#
# autoapi_prepare_jinja_env = prepare_jinja_env

# -- Options for HTML output -------------------------------------------------
html_short_title = html_title = "PyAEDT Examples"
html_theme = "ansys_sphinx_theme"
Expand Down

0 comments on commit afa1635

Please sign in to comment.