Skip to content

refactor: Separate generation of .rst and .py files for Datamodel and TUI #8207

refactor: Separate generation of .rst and .py files for Datamodel and TUI

refactor: Separate generation of .rst and .py files for Datamodel and TUI #8207

Workflow file for this run

name: GitHub Actions
on:
pull_request:
paths-ignore:
- '.github/workflows/run-custom-tests.yml'
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
paths-ignore:
- 'doc/**'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_EXAMPLES_CACHE: 6
API_CODE_CACHE: 3
DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com'
PACKAGE_NAME: 'ansys-fluent-core'
PACKAGE_NAMESPACE: 'ansys.fluent.core'
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
MAIN_PYTHON_VERSION: '3.9'
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1
PYFLUENT_SKIP_API_UPGRADE_ADVICE: 1
jobs:
docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pre-commit
run: python -m pip install pre-commit
- name: Run pre-commit for docformatter
run: pre-commit run --hook-stage manual --all-files --show-diff-on-failure docformatter
- name: Running Vale
uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: doc
reporter: github-pr-check
level: error
filter_mode: nofilter
fail_on_error: true
commit-style:
name: "Run commit style checks"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch-name-style:
name: "Run branch name style checks"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
test-import:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
- should-release: false
os: macos-latest
steps:
- name: Build wheelhouse and perform smoke test
uses: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
docs_build:
name: Build Documentation
needs: [docs-style]
runs-on: [self-hosted, pyfluent]
env:
DOC_DEPLOYMENT_IMAGE_TAG: v24.1.0
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install OS packages
run: |
sudo apt-get update
sudo apt-get install pandoc libegl1 make xvfb libfontconfig1 libxrender1 libxkbcommon-x11-0 -y
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}
- name: Install pyfluent
run: make install
- name: Retrieve PyFluent version
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Cache API Code
uses: actions/cache@v4
id: cache-api-code
with:
path: |
src/ansys/fluent/core/datamodel_231
src/ansys/fluent/core/fluent_version_231.py
src/ansys/fluent/core/meshing/tui_231.py
src/ansys/fluent/core/solver/settings_231
src/ansys/fluent/core/solver/tui_231.py
doc/source/api/meshing/tui
doc/source/api/meshing/datamodel
doc/source/api/solver/tui
doc/source/api/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Login to GitHub Container Registry
if: steps.cache-api-code.outputs.cache-hit != 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Fluent docker image
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Run API codegen
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Install again after codegen
run: |
rm -rf dist
make install > /dev/null
- name: Cache examples
uses: actions/cache@v4
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**', 'doc/source/conf.py') }}
restore-keys: |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Build Source Documentation
run: |
pip install -r requirements/requirements_build.txt
poetry install --only docs
make build-doc-source
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Zip HTML Documentation before upload
run: |
sudo apt install zip -y
pushd doc/_build/html
zip -r ../../../HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip .
popd
- name: Upload HTML Documentation
uses: actions/upload-artifact@v4
with:
name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip
retention-days: 7
build:
name: Build
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
needs: test-import
runs-on: [self-hosted, pyfluent]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}
- name: Add version information
run: make version-info
- name: Install pyfluent
run: make install
- name: Retrieve PyFluent version
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Cache 22.2 API Code
uses: actions/cache@v4
id: cache-222-api-code
with:
path:
src/ansys/fluent/core/datamodel_222
src/ansys/fluent/core/fluent_version_222.py
src/ansys/fluent/core/meshing/tui_222.py
src/ansys/fluent/core/solver/settings_222
src/ansys/fluent/core/solver/tui_222.py
src/ansys/fluent/core/data/api_tree_222.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v22.2.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v22.2.0
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull 22.2 Fluent docker image
if: steps.cache-222-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v22.2.0
- name: Run 22.2 API codegen
if: steps.cache-222-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v22.2.0
- name: Print 22.2 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_222.py
python -c "from ansys.fluent.core.solver.settings_222 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 23.1 API Code
uses: actions/cache@v4
id: cache-231-api-code
with:
path:
src/ansys/fluent/core/datamodel_231
src/ansys/fluent/core/fluent_version_231.py
src/ansys/fluent/core/meshing/tui_231.py
src/ansys/fluent/core/solver/settings_231
src/ansys/fluent/core/solver/tui_231.py
src/ansys/fluent/core/data/api_tree_231.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.1.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.1.0
- name: Pull 23.1 Fluent docker image
if: steps.cache-231-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v23.1.0
- name: Run 23.1 API codegen
if: steps.cache-231-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v23.1.0
- name: Print 23.1 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_231.py
python -c "from ansys.fluent.core.solver.settings_231 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 23.2 API Code
uses: actions/cache@v4
id: cache-232-api-code
with:
path:
src/ansys/fluent/core/datamodel_232
src/ansys/fluent/core/fluent_version_232.py
src/ansys/fluent/core/meshing/tui_232.py
src/ansys/fluent/core/solver/settings_232
src/ansys/fluent/core/solver/tui_232.py
src/ansys/fluent/core/data/api_tree_232.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.2.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.2.0
- name: Pull 23.2 Fluent docker image
if: steps.cache-232-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v23.2.0
- name: Run 23.2 API codegen
if: steps.cache-232-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v23.2.0
- name: Print 23.2 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_232.py
python -c "from ansys.fluent.core.solver.settings_232 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 24.1 API Code
uses: actions/cache@v4
id: cache-241-api-code
with:
path:
src/ansys/fluent/core/datamodel_241
src/ansys/fluent/core/fluent_version_241.py
src/ansys/fluent/core/meshing/tui_241.py
src/ansys/fluent/core/solver/settings_241
src/ansys/fluent/core/solver/tui_241.py
src/ansys/fluent/core/data/api_tree_241.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.1.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.1.0
- name: Pull 24.1 Fluent docker image
if: steps.cache-241-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v24.1.0
- name: Run 24.1 API codegen
if: steps.cache-241-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v24.1.0
- name: Print 24.1 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_241.py
python -c "from ansys.fluent.core.solver.settings_241 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 24.2 API Code
uses: actions/cache@v4
id: cache-242-api-code
with:
path:
src/ansys/fluent/core/datamodel_242
src/ansys/fluent/core/fluent_version_242.py
src/ansys/fluent/core/meshing/tui_242.py
src/ansys/fluent/core/solver/settings_242
src/ansys/fluent/core/solver/tui_242.py
src/ansys/fluent/core/data/api_tree_242.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.2.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.2.0
- name: Pull 24.2 Fluent docker image
if: steps.cache-242-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v24.2.0
- name: Run 24.2 API codegen
if: steps.cache-242-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v24.2.0
- name: Print 24.2 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_242.py
python -c "from ansys.fluent.core.solver.settings_242 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Install again after codegen
run: |
rm -rf dist
make install > /dev/null
- name: Check package
run: |
pip install twine
twine check dist/*
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: PyFluent-packages
path: |
dist/*.whl
dist/*.tar.gz
retention-days: 7
test:
name: Unit Testing
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image-tag: v22.2.0
version: 222
- image-tag: v23.1.0
version: 231
- image-tag: v23.2.0
version: 232
- image-tag: v24.1.0
version: 241
- image-tag: v24.2.0
version: 242
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- name: Setup Python
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Download package
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
uses: actions/download-artifact@v4
with:
name: PyFluent-packages
path: dist
- name: Install pyfluent
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: pip install -q --force-reinstall dist/*.whl > /dev/null
- name: Retrieve PyFluent version
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Login to GitHub Container Registry
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Fluent docker image
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
- name: Unit Testing
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: |
make install-test
make unittest-dev-${{ matrix.version }}
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
- name: Upload 24.1 Coverage Artifacts
if: matrix.image-tag == 'v24.1.0'
uses: actions/upload-artifact@v4
with:
name: coverage_report
path: ./htmlcov
release:
name: Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- uses: actions/download-artifact@v4
- name: Display package file list
run: ls -R
- name: Upload to Private PyPi
run: |
pip install twine
python -m twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: PAT
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload
- name: Upload to Public PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.ANSYS_FLUENT_CORE_PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./**/*.whl
./**/*.tar.gz
./**/*-wheelhouse-*.zip