Skip to content

Autogenerated library CI #2578

Autogenerated library CI

Autogenerated library CI #2578

Workflow file for this run

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
MAIN_PYTHON_VERSION: '3.12'
permissions: {}
jobs:
generate-code:
name: "Building repository - autodoc"
runs-on: ubuntu-latest
steps:
- name: "Install Git and checkout project"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Setup Python"
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Cache pip"
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: ansys-internal/mapdl-cmd-doc
ref: feat/pyconverter-xml2py-predifined-format
token: ${{ secrets.MAPDL_CMD_DOC_TOKEN }}
path: mapdl-cmd-doc
persist-credentials: false
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
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@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: package
- name: Test download artifacts
run: ls -R -a
- name: PyAnsys code style checks
uses: ansys/actions/code-style@1096998b81f7ebdea116b683e11f3a8bda759ca6 # v10.0.14
with:
python-version: ${{ env.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@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: package
- name: "Cache pip"
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
with:
path: ~/.cache/pip
key: Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
Python-pyconverter-generatedcommands-v${{ env.RESET_PIP_CACHE_2 }}-${{ env.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@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
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@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning]
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@1096998b81f7ebdea116b683e11f3a8bda759ca6 # v10.0.14
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
checkout: false
sphinxopts: -j auto
check-links: false