Skip to content

feat: Python error via grpc #11090

feat: Python error via grpc

feat: Python error via grpc #11090

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: 7
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.10'
PYTHON_VERSION: '3.12'
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:
- name: Running Vale
uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
code-style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: "Run PyAnsys code style checks"
uses: ansys/actions/code-style@v8
commit-style:
name: "Run commit style checks"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/check-pr-title@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
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.10', '3.11', '3.12', '3.13']
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@v8
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: v25.1.0
PYFLUENT_CONTAINER_MOUNT_SOURCE: "/home/ansys/Downloads/ansys_fluent_core_examples"
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- 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 Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Check Quarto Version
shell: bash
run: |
quarto --version
- name: Verify tinytex is installed
run: |
quarto install tinytex --no-prompt --update-path
- name: "Install Poppler for PDF to PNG conversion"
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y poppler-utils
- 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/generated
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('src/ansys/fluent/core/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
if [ -f poetry.lock ] ; then
rm poetry.lock
fi
poetry install --with docs
poetry install --all-extras
make build-doc-source
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
PYFLUENT_DOC_SKIP_CHEATSHEET: 1
- 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/generated
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('src/ansys/fluent/core/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
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
- name: Print 22.2 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_222.py
python -c "from ansys.fluent.core.generated.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/generated
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('src/ansys/fluent/core/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
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
- name: Print 23.1 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_231.py
python -c "from ansys.fluent.core.generated.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/generated
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('src/ansys/fluent/core/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
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
- name: Print 23.2 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_232.py
python -c "from ansys.fluent.core.generated.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/generated
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('src/ansys/fluent/core/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
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
- name: Print 24.1 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_241.py
python -c "from ansys.fluent.core.generated.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/generated
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('src/ansys/fluent/core/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
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
- name: Print 24.2 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_242.py
python -c "from ansys.fluent.core.generated.solver.settings_242 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 25.1 API Code
uses: actions/cache@v4
id: cache-251-api-code
with:
path:
src/ansys/fluent/core/generated
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 }}-v25.1.0-${{ hashFiles('src/ansys/fluent/core/codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v25.1.0
- name: Pull 25.1 Fluent docker image
if: steps.cache-251-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v25.1.0
- name: Run 25.1 API codegen
if: steps.cache-251-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v25.1.0
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
- name: Print 25.1 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_251.py
python -c "from ansys.fluent.core.generated.solver.settings_251 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
# Replace v25.2.0 with ${{ vars.FLUENT_STABLE_IMAGE_DEV }} after the first successful nightly test run
- name: Cache 25.2 API Code
uses: actions/cache@v4
id: cache-252-api-code
with:
path:
src/ansys/fluent/core/generated
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 }}-v25.2.0-${{ hashFiles('src/ansys/fluent/core/codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v25.2.0
- name: Pull 25.2 Fluent docker image
if: steps.cache-251-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v25.2.0
- name: Run 25.2 API codegen
if: steps.cache-252-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v25.2.0
- name: Print 25.2 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_252.py
python -c "from ansys.fluent.core.generated.solver.settings_251 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==5.0.0
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: [public-ubuntu-latest-8-cores]
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
- image-tag: v25.1.0
version: 251
- image-tag: v25.2.0
version: 252
timeout-minutes: 120
env:
# Enable this after the first successful nightly test run
# FLUENT_IMAGE_TAG: ${{ matrix.version == 252 && vars.FLUENT_STABLE_IMAGE_DEV || matrix.image-tag }}
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
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
- name: Unit Testing
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: |
make install-test
make unittest-dev-${{ matrix.version }}
- name: Cleanup previous docker containers
if: always()
run: make cleanup-previous-docker-containers
- name: Upload 24.2 Coverage Artifacts
if: matrix.image-tag == 'v24.2.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==5.0.0
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==5.0.0
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