DOCS: Update template (#289) #1160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Github CI-CD | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
branches: | |
- "main" | |
schedule: # UTC at 0300 | |
- cron: "0 3 * * *" | |
env: | |
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} | |
DOCUMENTATION_CNAME: 'examples.aedt.docs.pyansys.com' | |
MAIN_PYTHON_VERSION: '3.10' | |
ON_CI: True | |
PYAEDT_NON_GRAPHICAL: '1' | |
# To keep as it impacts pyaedt behavior | |
PYAEDT_DOC_GENERATION: '1' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
doc-style: | |
name: Documentation style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: ansys/actions/doc-style@v8 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# ================================================================================================= | |
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
# ================================================================================================= | |
doc-build: | |
name: Build documentation | |
runs-on: [self-hosted, Windows, pyaedt-examples] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Create virtual environment | |
run: | | |
python -m venv .venv | |
.venv\Scripts\Activate.ps1 | |
python -m pip install pip -U | |
python -m pip install wheel setuptools -U | |
python -c "import sys; print(sys.executable)" | |
- name: Install project and documentation dependencies | |
run: | | |
.venv\Scripts\Activate.ps1 | |
pip install --no-cache-dir -r requirements/requirements_doc.txt | |
# Use environment variable speed up build for PDF pages | |
- name: Create HTML documentation | |
env: | |
SPHINXBUILD_HTML_AND_PDF_WORKFLOW: "1" | |
run: | | |
.venv\Scripts\Activate.ps1 | |
. .\doc\make.bat html --color | |
# NOTE: Ugly HTML checking but redirecting errors with our docs either leads | |
# to errors in powershell or workflows getting stuck in Github CICD. | |
- name: Check HTML doc creation | |
run : | | |
if (Test-Path "doc\_build\html\index.html" ) { | |
Write-Output "File index.html found, HTML build successful." | |
} else { | |
Write-Error "Sphinx build failed, check if there is no cell execution error." | |
exit 1 | |
} | |
- name: Upload HTML documentation artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation-html | |
path: doc/_build/html | |
retention-days: 7 | |
# Use environment variable to remove the doctree after the build of PDF pages | |
# Keeping doctree could cause an issue, see https://github.com/ansys/pyaedt/pull/3844/files | |
- name: Create PDF documentation | |
env: | |
SPHINXBUILD_HTML_AND_PDF_WORKFLOW: "1" | |
run: | | |
.venv\Scripts\Activate.ps1 | |
. .\doc\make.bat pdf | |
- name: Upload PDF documentation artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation-pdf | |
path: doc/_build/latex | |
retention-days: 7 | |
deploy-doc: | |
name: Upload documentation | |
if: contains(github.ref, 'refs/heads/main') | |
runs-on: ubuntu-latest | |
needs: [doc-build] | |
steps: | |
- name: Deploy the documentation | |
uses: ansys/actions/doc-deploy-dev@v8 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} | |
doc-artifact-name: 'documentation-html' |