Skip to content

docs

docs #53

Workflow file for this run

name: docs
on:
# Can be called by the CI
workflow_call:
inputs:
python_version:
required: false
type: string
default: "3.11"
ANSYS_VERSION:
required: false
type: string
standalone_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
event_name:
description: "Name of event calling"
required: true
type: string
default: ''
# Can be called manually
workflow_dispatch:
inputs:
python_version:
description: "Python interpreter"
required: true
type: string
default: "3.11"
ANSYS_VERSION:
description: "ANSYS version"
required: false
type: string
standalone_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
env:
PACKAGE_NAME: ansys-dpf-core
MODULE: core
jobs:
doc-style:
name: "Check doc style"
runs-on: ubuntu-latest
steps:
- name: "Running documentation style checks"
uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
docs:
name: "Documentation"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: "Set licensing if necessary"
if: ${{ (inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT) > '231' }}
shell: bash
run: |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV
- name: "Setup Python"
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
- name: "Update pip to the latest version and install tox"
shell: pwsh
run: |
python -m pip install -U pip
python -m pip install tox tox-uv
- name: "Build the wheel"
shell: pwsh
run: |
tox -e build-wheel
- name: "Expose the wheel"
shell: bash
id: wheel
working-directory: dist
run: |
export name=`ls ansys_dpf_core*.whl`
echo ${name}
echo "wheel_name=${name[0]}" >> $GITHUB_OUTPUT
- name: "Install DPF"
id: set-server-path
uses: ansys/pydpf-actions/[email protected]
with:
dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}}
standalone_suffix: ${{ inputs.standalone_suffix }}
ANSYS_VERSION : ${{inputs.ANSYS_VERSION}}
- name: "Check licences of packages"
uses: ansys/pydpf-actions/[email protected]
- name: "Test import"
shell: bash
run: |
python -m pip install dist/${{ steps.wheel.outputs.wheel_name }}
python -c "from ansys.dpf import core"
- name: "Setup headless display"
uses: pyvista/setup-headless-display-action@48066dd0b79cf46babc16223a1dce3aa4803ec43 # v4.0
- name: "Setup Graphviz"
uses: ts-graphviz/setup-graphviz@v2
- name: "Install OS packages"
run: |
choco install pandoc
- name: "Restore doc build cache"
id: cache-doc-build-restore
uses: actions/cache/restore@v4
with:
path: |
doc/source/examples
# Cache key is composed of branch name, ansys version, hash of requirements_doc,
# and run_id to work around immutability
# We should also track version of pandoc, of graphviz, of packages installed by headless-display, and even of pydpf-core?
key: doc-build-${{ github.ref_name }}-DPF_${{inputs.ANSYS_VERSION}}${{inputs.standalone_suffix}}-${{hashfiles('requirements/requirements_docs.txt')}}-${{ github.run_id }}
restore-keys: |
doc-build-${{ github.ref_name }}-DPF_${{inputs.ANSYS_VERSION}}${{inputs.standalone_suffix}}-${{hashfiles('requirements/requirements_docs.txt')}}-
doc-build-master-DPF_${{inputs.ANSYS_VERSION}}${{inputs.standalone_suffix}}-${{hashfiles('requirements/requirements_docs.txt')}}-
- name: "Build HTML Documentation"
shell: bash
run: |
tox -e doc-html --installpkg dist/${{ steps.wheel.outputs.wheel_name }} -x testenv:doc-html.setenv+='VIRTUALENV_SYSTEM_SITE_PACKAGES=true'
- name: "Upload Documentation Build log"
uses: actions/upload-artifact@v4
with:
name: doc-${{env.PACKAGE_NAME}}-log
path: doc/*.txt
if: always()
- name: "Save doc-build cache"
id: cache-doc-build-save
uses: actions/cache/save@v4
with:
path: |
doc/build
doc/source/examples
key: ${{ steps.cache-doc-build-restore.outputs.cache-primary-key }}
- name: "Zip HTML Documentation"
shell: pwsh
run: |
Compress-Archive -Path doc/build/html/* -Destination HTML-doc-${{env.PACKAGE_NAME}}.zip
if: always()
- name: "Upload HTML Documentation"
uses: actions/upload-artifact@v4
with:
name: HTML-doc-${{env.PACKAGE_NAME}}.zip
path: HTML-doc-${{env.PACKAGE_NAME}}.zip
if: always()