Skip to content

Commit

Permalink
DOC: enable multi-version documentation (#1191)
Browse files Browse the repository at this point in the history
* FEAT: enable multi-version documentation

* FIX: remove CNAME and .nojekyll creation in Makefile

* CI: update workflows for multi-version doc
  • Loading branch information
jorgepiloto authored Dec 14, 2022
1 parent 274acd3 commit ffef500
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 34 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
# It applies 7 days retention policy by default.
RESET_EXAMPLES_CACHE: 6
API_CODE_CACHE: 3
DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com'

jobs:
stylecheck:
Expand Down Expand Up @@ -116,15 +117,6 @@ jobs:
steps:
- uses: actions/checkout@v3

# used for documentation deployment
- name: Get Bot Application Token
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') && matrix.image-tag == 'v23.1.0'
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}

- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -206,17 +198,12 @@ jobs:
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}
- name: Build Documentation
run: make build-doc DOCS_CNAME=fluent.docs.pyansys.com
run: make build-doc
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Zip HTML Documentation before upload
run: |
sudo apt install zip -y
zip -r doc.zip doc/_build/html
- name: Upload HTML Documentation
if: matrix.image-tag == 'v23.1.0'
uses: actions/upload-artifact@v3
Expand All @@ -225,15 +212,14 @@ jobs:
path: doc.zip
retention-days: 7

- name: Deploy
- name: Deploy stable documentation
uses: pyansys/actions/doc-deploy-stable@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev') && matrix.image-tag == 'v23.1.0'
uses: JamesIves/[email protected]
with:
repository-name: pyansys/pyfluent-docs
token: ${{ secrets.DOC_DEPLOYMENT_PAT }}
BRANCH: gh-pages
FOLDER: doc/_build/html
CLEAN: true
doc-artifact-name: 'HTML-Documentation-tag-${{ matrix.image-tag }}'
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}


build:
name: Build
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/nightly-doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: '0 4 * * *'
workflow_dispatch:

env:
DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com'

jobs:
nightly_docs_build:
runs-on: [self-hosted, pyfluent]
Expand Down Expand Up @@ -58,18 +61,22 @@ jobs:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Build Documentation
run: make build-doc DOCS_CNAME=dev.fluent.docs.pyansys.com
run: make build-doc
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Deploy
- name: Upload HTML documentation
if: matrix.image-tag == 'v23.1.0'
uses: JamesIves/[email protected]
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: doc/_build/html
retention-days: 7

- name: "Deploy development documentation"
uses: pyansys/actions/doc-deploy-dev@v2
with:
repository-name: pyansys/pyfluent-dev-docs
token: ${{ secrets.DOC_DEPLOYMENT_PAT }}
BRANCH: gh-pages
FOLDER: doc/_build/html
CLEAN: true
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ build-doc:
@sudo rm -rf /home/ansys/.local/share/ansys_fluent_core/examples/*
@pip install -r requirements/requirements_doc.txt
@xvfb-run make -C doc html
@touch doc/_build/html/.nojekyll
@echo "$(DOCS_CNAME)" >> doc/_build/html/CNAME

compare-flobject:
@python .ci/compare_flobject.py
9 changes: 8 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Sphinx documentation configuration file."""
from datetime import datetime
import os
import platform
import subprocess

from ansys_sphinx_theme import ansys_favicon, pyansys_logo_black
from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black
from sphinx_gallery.sorting import FileNameSortKey

import ansys.fluent.core as pyfluent
Expand All @@ -16,6 +17,7 @@
project = "ansys.fluent.core"
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
author = "ANSYS Inc."
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")

# The short X.Y version
release = version = __version__
Expand Down Expand Up @@ -161,6 +163,11 @@ def _stop_fluent_container(gallery_conf, fname):
"additional_breadcrumbs": [
("PyAnsys", "https://docs.pyansys.com/"),
],
"switcher": {
"json_url": f"{cname}/release/versions.json",
"version_match": get_version_match(__version__),
},
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
"navigation_depth": -1,
}

Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ sphinx-copybutton==0.5.1
sphinx-gallery==0.11.1
sphinx-notfound-page==0.8.3
sphinxcontrib-websupport==1.2.4
sphinxemoji==0.2.0
sphinxemoji==0.2.0

0 comments on commit ffef500

Please sign in to comment.