Autogenerated library CI #1915
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: Autogenerated library CI | |
on: | |
workflow_dispatch: | |
schedule: # UTC at 0300 | |
- cron: "0 3 * * *" | |
pull_request: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
env: | |
RESET_PIP_CACHE_2: 1 | |
RESET_AUTOSUMMARY_CACHE_2: 1 | |
RESET_DOC_BUILD_CACHE_2: 1 | |
jobs: | |
generate-code: | |
name: "Building repository - autodoc" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Install Git and checkout project" | |
uses: actions/checkout@v4 | |
- name: "Setup Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ inputs.MAIN_PYTHON_VERSION }} | |
- name: "Cache pip" | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }} | |
# The token will expire in 2024. | |
- name: "Checkout mapdl-cmd-doc repository" | |
uses: actions/checkout@v4 | |
with: | |
repository: ansys-internal/mapdl-cmd-doc | |
ref: feat/pyconverter-xml2py-predifined-format | |
token: ${{ secrets.MAPDL_CMD_DOC_TOKEN }} | |
path: mapdl-cmd-doc | |
- name: "Install pyconverter-xml2py" | |
run: | | |
pip install --upgrade pip | |
pip install .[tests] | |
- name: "Create pyconverter-autogenerated package" | |
run: | | |
pyconverter-xml2py package -x ${{ github.workspace }}/mapdl-cmd-doc -f ${{ github.workspace }}/tests/customized_functions -l 100 | |
- name: Upload autogenerated doc artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package | |
path: ./package | |
auto-doc-code-style: | |
name: "Code style - autodoc" | |
runs-on: ubuntu-latest | |
needs: [generate-code] | |
steps: | |
- name: Download autogenerated documentation | |
uses: actions/download-artifact@v4 | |
with: | |
name: package | |
- name: Test download artifacts | |
run: ls -R -a | |
- name: PyAnsys code style checks | |
uses: ansys/actions/code-style@v8 | |
with: | |
python-version: ${{ inputs.MAIN_PYTHON_VERSION }} | |
use-python-cache: false | |
auto-doc-build: | |
name: "Building documentation - autodoc" | |
runs-on: ubuntu-latest | |
needs: [auto-doc-code-style] | |
steps: | |
- name: Download autogenerated documentation | |
uses: actions/download-artifact@v4 | |
with: | |
name: package | |
- name: "Cache pip" | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ inputs.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ inputs.MAIN_PYTHON_VERSION }} | |
- name: "Install pyconverter-generatedcommands" | |
run: | | |
pip install . | |
- name: "Retrieve PyConverter-GeneratedCommands version" | |
run: | | |
echo "PYCONVERTER_GENERATED_VERSION=$(python -c 'from pyconverter.generatedcommands import __version__; print(__version__)')" >> $GITHUB_ENV | |
echo "PyConverter-GeneratedCommands version is: $(python -c 'from pyconverter.generatedcommands import __version__; print(__version__)')" | |
- name: "Cache docs build directory" | |
uses: actions/cache@v4 | |
with: | |
path: doc/_build | |
key: doc-build-pyconverter-generatedcommands-v${{ env.RESET_DOC_BUILD_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
doc-build-pyconverter-generatedcommands-v${{ env.RESET_DOC_BUILD_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }} | |
- name: "Cache autosummary" | |
uses: actions/cache@v4 | |
with: | |
path: doc/source/_autosummary/*.rst | |
key: autosummary-pyconverter-generatedcommands-v${{ env.RESET_AUTOSUMMARY_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
autosummary-pyconverter-generatedcommands-v${{ env.RESET_AUTOSUMMARY_CACHE_2 }}-${{ inputs.PYCONVERTER_GENERATED_VERSION }} | |
- name: "Run Ansys documentation building action" | |
uses: ansys/actions/doc-build@v8 | |
with: | |
python-version: ${{ inputs.MAIN_PYTHON_VERSION }} | |
checkout: false | |
sphinxopts: -j auto | |
check-links: false |