From 4eb515c958f63a633d33e3a28fcea43eb0b549c3 Mon Sep 17 00:00:00 2001 From: Harshal Pohekar <106588300+hpohekar@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:02:25 +0530 Subject: [PATCH 1/3] fix: file transfer refactor (#2705) * fix: file transfer refactor * merge fix * merge fix 1 --- src/ansys/fluent/core/utils/file_transfer_service.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ansys/fluent/core/utils/file_transfer_service.py b/src/ansys/fluent/core/utils/file_transfer_service.py index 30b7d056ee0..ed76b493db3 100644 --- a/src/ansys/fluent/core/utils/file_transfer_service.py +++ b/src/ansys/fluent/core/utils/file_transfer_service.py @@ -10,7 +10,6 @@ from alive_progress import alive_bar import ansys.fluent.core as pyfluent -from ansys.fluent.core.launcher.process_launch_string import get_fluent_exe_path import ansys.platform.instancemanagement as pypim import ansys.tools.filetransfer as ft @@ -51,11 +50,7 @@ def __init__(self, server_cwd: Optional[str] = None): """ self.pyfluent_cwd = pathlib.Path(str(os.getcwd())) self.fluent_cwd = ( - pathlib.Path(str(server_cwd)) - if server_cwd - else ( - pathlib.Path(str(get_fluent_exe_path()).split("fluent")[0]) / "fluent" - ) + pathlib.Path(str(server_cwd)) if server_cwd else self.pyfluent_cwd ) def file_exists_on_remote(self, file_name: str) -> bool: From 26a6977d235fa712ef633a5c3e30fdfb71b2251b Mon Sep 17 00:00:00 2001 From: Mainak Kundu <94432368+mkundu1@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:08:21 -0400 Subject: [PATCH 2/3] fix: settings api typehints (#2720) * fix: Settings API static typehints * fix: add test * fix: add test * fix: not a docstring. * fix: package pyi files --------- Co-authored-by: Prithwish Mukherjee <109645853+prmukherj@users.noreply.github.com> --- codegen/settingsgen.py | 128 ++++++++++++++++++---------------------- pyproject.toml | 1 + tests/test_type_stub.py | 34 +++++++++++ 3 files changed, 94 insertions(+), 69 deletions(-) create mode 100644 tests/test_type_stub.py diff --git a/codegen/settingsgen.py b/codegen/settingsgen.py index 7afe8727b05..72a042d70d9 100644 --- a/codegen/settingsgen.py +++ b/codegen/settingsgen.py @@ -24,7 +24,6 @@ python """ -import contextlib import hashlib import io import os @@ -263,15 +262,8 @@ def _populate_classes(parent_dir): file_name = files_dict.get(key) cls_name = cls.__name__ file_name = os.path.normpath(os.path.join(parent_dir, file_name + ".py")) - generate_stub = getattr(cls, "command_names", None) or getattr( - cls, "query_names", None - ) - stub_file_name = file_name + "i" if generate_stub else None - stub_cm = ( - open(stub_file_name, "w") - if generate_stub - else contextlib.nullcontext(stub_file_name) - ) + stub_file_name = file_name + "i" + stub_cm = open(stub_file_name, "w") with open(file_name, "w") as f, stub_cm as stubf: # disclaimer to py file f.write("#\n") @@ -285,58 +277,65 @@ def _populate_classes(parent_dir): stubf.write("\n\n") # write imports to py file - f.write("from ansys.fluent.core.solver.flobject import *\n\n") - if stubf: - stubf.write("from typing import Union, List, Tuple\n\n") - f.write("from ansys.fluent.core.solver.flobject import (\n") - f.write(f"{istr1}_ChildNamedObjectAccessorMixin,\n") - f.write(f"{istr1}_CreatableNamedObjectMixin,\n") - f.write(f"{istr1}_NonCreatableNamedObjectMixin,\n") - f.write(f"{istr1}_HasAllowedValuesMixin,\n") - f.write(f"{istr1}_InputFile,\n") - f.write(f"{istr1}_OutputFile,\n") - f.write(f"{istr1}_InOutFile,\n") - f.write(")\n\n") + import_str = ( + "from ansys.fluent.core.solver.flobject import *\n\n" + "from ansys.fluent.core.solver.flobject import (\n" + f"{istr1}_ChildNamedObjectAccessorMixin,\n" + f"{istr1}_CreatableNamedObjectMixin,\n" + f"{istr1}_NonCreatableNamedObjectMixin,\n" + f"{istr1}_HasAllowedValuesMixin,\n" + f"{istr1}_InputFile,\n" + f"{istr1}_OutputFile,\n" + f"{istr1}_InOutFile,\n" + ")\n\n" + ) + f.write(import_str) + stubf.write(import_str) + stubf.write("from typing import Union, List, Tuple\n\n") if children_hash: for child in children_hash: pchild_name = hash_dict.get(child)[0].__name__ - f.write( - f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" - ) + import_str = f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" + f.write(import_str) + stubf.write(import_str) if commands_hash: for child in commands_hash: pchild_name = hash_dict.get(child)[0].__name__ - f.write( - f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" - ) + import_str = f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" + f.write(import_str) + stubf.write(import_str) if queries_hash: for child in queries_hash: pchild_name = hash_dict.get(child)[0].__name__ - f.write( - f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" - ) + import_str = f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" + f.write(import_str) + stubf.write(import_str) if arguments_hash: for child in arguments_hash: pchild_name = hash_dict.get(child)[0].__name__ - f.write( - f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" - ) + import_str = f"from .{files_dict.get(child)} import {pchild_name} as {pchild_name}_cls\n" + f.write(import_str) + stubf.write(import_str) if object_hash: pchild_name = hash_dict.get(object_hash)[0].__name__ - f.write(f"from .{files_dict.get(object_hash)} import {pchild_name}\n\n") + import_str = ( + f"from .{files_dict.get(object_hash)} import {pchild_name}\n\n" + ) + f.write(import_str) + stubf.write(import_str) # class name - f.write( - f"{istr}class {cls_name}" + class_def_str = ( + f"\n{istr}class {cls_name}" f'({", ".join(f"{c.__name__}[{hash_dict.get(object_hash)[0].__name__}]" if object_hash else c.__name__ for c in cls.__bases__)}):\n' ) - if stubf: - stubf.write(f"{istr}class {cls_name}:\n") + f.write(class_def_str) + stubf.write(class_def_str) doc = fix_settings_doc(cls.__doc__) # Custom doc for child object type @@ -348,8 +347,7 @@ def _populate_classes(parent_dir): _write_doc_string(doc, istr1, f) f.write(f'{istr1}fluent_name = "{cls.fluent_name}"\n\n') - if stubf: - stubf.write(f"{istr1}fluent_name = ...\n") + stubf.write(f"{istr1}fluent_name = ...\n") child_class_strings = [] @@ -361,14 +359,12 @@ def _populate_classes(parent_dir): pprint.pprint(child_names, stream=strout, compact=True, width=70) mn = ("\n" + istr2).join(strout.getvalue().strip().split("\n")) f.write(f"{istr2}{mn}\n\n") - if stubf: - stubf.write(f"{istr1}child_names = ...\n") + stubf.write(f"{istr1}child_names = ...\n") for child in child_names: child_cls = cls._child_classes[child] child_class_strings.append(f"{child}={child_cls.__name__}_cls") - if stubf: - stubf.write(f"{istr1}{child} = ...\n") + stubf.write(f"{istr1}{child}: {child_cls.__name__}_cls = ...\n") # write command objects command_names = getattr(cls, "command_names", None) @@ -378,20 +374,18 @@ def _populate_classes(parent_dir): pprint.pprint(command_names, stream=strout, compact=True, width=70) mn = ("\n" + istr2).join(strout.getvalue().strip().split("\n")) f.write(f"{istr2}{mn}\n\n") - if stubf: - stubf.write(f"{istr1}command_names = ...\n\n") + stubf.write(f"{istr1}command_names = ...\n\n") commands_info = _get_commands_info(commands_hash) for command in command_names: command_cls = cls._child_classes[command] child_class_strings.append(f"{command}={command_cls.__name__}_cls") # function annotation for commands - if stubf: - command_info = commands_info[command] - stubf.write(f"{istr1}def {command}(self, ") - stubf.write(", ".join(command_info.args_info)) - stubf.write("):\n") - _write_doc_string(command_info.doc, istr2, stubf) + command_info = commands_info[command] + stubf.write(f"{istr1}def {command}(self, ") + stubf.write(", ".join(command_info.args_info)) + stubf.write("):\n") + _write_doc_string(command_info.doc, istr2, stubf) # write query objects query_names = getattr(cls, "query_names", None) @@ -401,20 +395,18 @@ def _populate_classes(parent_dir): pprint.pprint(query_names, stream=strout, compact=True, width=70) mn = ("\n" + istr2).join(strout.getvalue().strip().split("\n")) f.write(f"{istr2}{mn}\n\n") - if stubf: - stubf.write(f"{istr1}query_names = ...\n\n") + stubf.write(f"{istr1}query_names = ...\n\n") queries_info = _get_commands_info(queries_hash) for query in query_names: query_cls = cls._child_classes[query] child_class_strings.append(f"{query}={query_cls.__name__}_cls") # function annotation for queries - if stubf: - query_info = queries_info[query] - stubf.write(f"{istr1}def {query}(self, ") - stubf.write(", ".join(query_info.args_info)) - stubf.write("):\n") - _write_doc_string(query_info.doc, istr2, stubf) + query_info = queries_info[query] + stubf.write(f"{istr1}def {query}(self, ") + stubf.write(", ".join(query_info.args_info)) + stubf.write("):\n") + _write_doc_string(query_info.doc, istr2, stubf) # write arguments arguments = getattr(cls, "argument_names", None) @@ -424,16 +416,16 @@ def _populate_classes(parent_dir): pprint.pprint(arguments, stream=strout, compact=True, width=70) mn = ("\n" + istr2).join(strout.getvalue().strip().split("\n")) f.write(f"{istr2}{mn}\n\n") - if stubf: - stubf.write(f"{istr1}argument_names = ...\n") + stubf.write(f"{istr1}argument_names = ...\n") for argument in arguments: argument_cls = cls._child_classes[argument] child_class_strings.append( f"{argument}={argument_cls.__name__}_cls" ) - if stubf: - stubf.write(f"{istr1}{argument} = ...\n") + stubf.write( + f"{istr1}{argument}: {argument_cls.__name__}_cls = ...\n" + ) if child_class_strings: f.write(f"{istr1}_child_classes = dict(\n") @@ -455,14 +447,12 @@ def _populate_classes(parent_dir): f.write(f'{istr1}"""\n') f.write(f"{istr1}child_object_type of {cls_name}.") f.write(f'\n{istr1}"""\n') - if stubf: - stubf.write(f"{istr1}child_object_type = ...\n") + stubf.write(f"{istr1}child_object_type = ...\n") return_type = getattr(cls, "return_type", None) if return_type: f.write(f'{istr1}return_type = "{return_type}"\n') - if stubf: - stubf.write(f"{istr1}return_type = ...\n") + stubf.write(f"{istr1}return_type = ...\n") def _populate_init(parent_dir, sinfo): diff --git a/pyproject.toml b/pyproject.toml index 9f612739ecc..401e28aacc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ include = [ { path = "src/ansys/fluent/core/solver/tui_*.py", format = ["sdist", "wheel"] }, { path = "src/ansys/fluent/core/datamodel_*/*.py", format = ["sdist", "wheel"] }, { path = "src/ansys/fluent/core/solver/settings_*/*.py", format = ["sdist", "wheel"] }, + { path = "src/ansys/fluent/core/solver/settings_*/*.pyi", format = ["sdist", "wheel"] }, ] packages = [ diff --git a/tests/test_type_stub.py b/tests/test_type_stub.py new file mode 100644 index 00000000000..71cd2beb40a --- /dev/null +++ b/tests/test_type_stub.py @@ -0,0 +1,34 @@ +import ast +from pathlib import Path + +import pytest + +import ansys.fluent.core as pyfluent +from ansys.fluent.core._version import fluent_release_version +from ansys.fluent.core.utils.fluent_version import FluentVersion + +pytest.mark.codegen_required + + +def test_settings_stub(): + # The type-stub files, which are generated for settings API, are parsed by the + # intellisense engine while typing in editors like vscode. This test validates the + # information contained in a type-stub file. + version = FluentVersion(fluent_release_version).number + stub_file = ( + Path(pyfluent.__file__).parent / "solver" / f"settings_{version}" / "export.pyi" + ) + assert stub_file.exists() + with open(stub_file) as f: + module_def = ast.parse(f.read()) + assert isinstance(module_def, ast.Module) + assert any(isinstance(x, ast.ImportFrom) for x in module_def.body) + class_def = next(x for x in module_def.body if isinstance(x, ast.ClassDef)) + assert len(class_def.bases) > 0 + assigns = [x for x in class_def.body if isinstance(x, ast.Assign)] + for class_attr in ["fluent_name", "child_names", "command_names"]: + assert any(x.targets[0].id == class_attr for x in assigns) + assert any(isinstance(x, ast.AnnAssign) for x in class_def.body) + fn_def = next(x for x in class_def.body if isinstance(x, ast.FunctionDef)) + assert ast.get_docstring(fn_def) + assert all(x.annotation for x in fn_def.args.args[1:]) From 62a4ab9e4533583c950e3d2336f930cd56b0b58e Mon Sep 17 00:00:00 2001 From: Mainak Kundu <94432368+mkundu1@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:09:13 -0400 Subject: [PATCH 3/3] ci: Add CI to run tests on old Fluent versions weekly (#2708) * ci: Add CI to run tests on old Fluent versions weekly * ci: run weekly tests in matrix --- .github/workflows/compare-flobject.yml | 33 ----- ...oc-build.yml => doc-build-dev-nightly.yml} | 6 +- ...se-doc-build.yml => doc-build-release.yml} | 2 +- ...n-custom-tests.yml => test-run-custom.yml} | 2 +- ...h.yml => test-run-dev-version-nightly.yml} | 2 +- .github/workflows/test-run-nightly.yml | 93 ++++++++++++++ ...n.yml => test-run-old-versions-weekly.yml} | 110 +++++++++------- ...run.yml => test-run-solvermode-weekly.yml} | 6 +- .github/workflows/test-run-wo-codegen.yml | 119 ++++++++++-------- 9 files changed, 230 insertions(+), 143 deletions(-) delete mode 100644 .github/workflows/compare-flobject.yml rename .github/workflows/{nightly-dev-doc-build.yml => doc-build-dev-nightly.yml} (96%) rename .github/workflows/{release-doc-build.yml => doc-build-release.yml} (98%) rename .github/workflows/{run-custom-tests.yml => test-run-custom.yml} (99%) rename .github/workflows/{nightly-test-run-develop-branch.yml => test-run-dev-version-nightly.yml} (98%) create mode 100644 .github/workflows/test-run-nightly.yml rename .github/workflows/{nightly-test-run.yml => test-run-old-versions-weekly.yml} (63%) rename .github/workflows/{weekly-solvermode-test-run.yml => test-run-solvermode-weekly.yml} (95%) diff --git a/.github/workflows/compare-flobject.yml b/.github/workflows/compare-flobject.yml deleted file mode 100644 index 29656963604..00000000000 --- a/.github/workflows/compare-flobject.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Compare flobject between Fluent and PyFluent - -on: - schedule: # UTC at 0400 - - cron: '0 4 * * *' - workflow_dispatch: - -jobs: - compare_flobject: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ansys-bot - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Pull Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v24.1.0 - - - name: Compare flobject - run: make compare-flobject diff --git a/.github/workflows/nightly-dev-doc-build.yml b/.github/workflows/doc-build-dev-nightly.yml similarity index 96% rename from .github/workflows/nightly-dev-doc-build.yml rename to .github/workflows/doc-build-dev-nightly.yml index dc11c6c7705..30ea92d0029 100644 --- a/.github/workflows/nightly-dev-doc-build.yml +++ b/.github/workflows/doc-build-dev-nightly.yml @@ -1,8 +1,8 @@ -name: Nightly Development Documentation Build +name: Doc Build Dev Nightly on: - schedule: # UTC at 0400 - - cron: '0 4 * * *' + schedule: # UTC at 0500 + - cron: '0 5 * * *' workflow_dispatch: env: diff --git a/.github/workflows/release-doc-build.yml b/.github/workflows/doc-build-release.yml similarity index 98% rename from .github/workflows/release-doc-build.yml rename to .github/workflows/doc-build-release.yml index ab04e09f063..505186b5ef5 100644 --- a/.github/workflows/release-doc-build.yml +++ b/.github/workflows/doc-build-release.yml @@ -1,4 +1,4 @@ -name: Release Documentation Build +name: Doc Build Release on: workflow_dispatch: diff --git a/.github/workflows/run-custom-tests.yml b/.github/workflows/test-run-custom.yml similarity index 99% rename from .github/workflows/run-custom-tests.yml rename to .github/workflows/test-run-custom.yml index 4b03e041a11..caeada3c829 100644 --- a/.github/workflows/run-custom-tests.yml +++ b/.github/workflows/test-run-custom.yml @@ -1,5 +1,5 @@ -name: Run Custom Tests +name: Test Run Custom on: #pull_request: diff --git a/.github/workflows/nightly-test-run-develop-branch.yml b/.github/workflows/test-run-dev-version-nightly.yml similarity index 98% rename from .github/workflows/nightly-test-run-develop-branch.yml rename to .github/workflows/test-run-dev-version-nightly.yml index aee11978d94..c41f22c9cbc 100644 --- a/.github/workflows/nightly-test-run-develop-branch.yml +++ b/.github/workflows/test-run-dev-version-nightly.yml @@ -1,4 +1,4 @@ -name: Nightly Test Run (Develop) +name: Test Run Dev Version Nightly on: schedule: # UTC at 0300 diff --git a/.github/workflows/test-run-nightly.yml b/.github/workflows/test-run-nightly.yml new file mode 100644 index 00000000000..87123ecb25a --- /dev/null +++ b/.github/workflows/test-run-nightly.yml @@ -0,0 +1,93 @@ +name: Test Run Nightly + +on: + schedule: # UTC at 0400 + - cron: '0 4 * * *' + workflow_dispatch: + +env: + ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} + PYFLUENT_TIMEOUT_FORCE_EXIT: 30 + PYFLUENT_LAUNCH_CONTAINER: 1 + PYFLUENT_LOGGING: 'DEBUG' + PYFLUENT_WATCHDOG_DEBUG: 'OFF' + PYFLUENT_HIDE_LOG_SECRETS: 1 + +jobs: + test: + name: Unit Testing + runs-on: [self-hosted, pyfluent] + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 + + - 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: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ansys-bot + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull 24.1 Fluent docker image + run: make docker-pull + env: + FLUENT_IMAGE_TAG: v24.1.0 + + - name: Run 24.1 API codegen + 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: Install again after codegen + run: | + rm -rf dist + make install > /dev/null + + - name: 24.1 Unit Testing + run: | + make install-test + make unittest-all-241 + env: + FLUENT_IMAGE_TAG: v24.1.0 + + - name: Upload 24.1 Coverage Results to Codecov + uses: codecov/codecov-action@v4 + with: + root_dir: ${{ github.workspace }} + name: cov_xml.xml + + - name: Upload 24.1 Coverage Artifacts + uses: actions/upload-artifact@v4 + with: + name: coverage_report + path: ./htmlcov diff --git a/.github/workflows/nightly-test-run.yml b/.github/workflows/test-run-old-versions-weekly.yml similarity index 63% rename from .github/workflows/nightly-test-run.yml rename to .github/workflows/test-run-old-versions-weekly.yml index aa1ff277a04..4d8df266e8f 100644 --- a/.github/workflows/nightly-test-run.yml +++ b/.github/workflows/test-run-old-versions-weekly.yml @@ -1,8 +1,8 @@ -name: Nightly Test Run +name: Test Run Old Versions Weekly on: - schedule: # UTC at 0400 - - cron: '0 4 * * *' + schedule: # UTC at 0900 on Saturday + - cron: '0 9 * * SAT' workflow_dispatch: env: @@ -14,8 +14,8 @@ env: PYFLUENT_HIDE_LOG_SECRETS: 1 jobs: - test: - name: Unit Testing + build: + name: Build package runs-on: [self-hosted, pyfluent] steps: @@ -98,62 +98,80 @@ jobs: cat src/ansys/fluent/core/fluent_version_232.py python -c "from ansys.fluent.core.solver.settings_231 import SHASH; print(f'SETTINGS_HASH = {SHASH}')" - - name: Pull 24.1 Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v24.1.0 - - - name: Run 24.1 API codegen - 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: Install again after codegen run: | rm -rf dist make install > /dev/null - - name: 24.1 Unit Testing + - name: Check package run: | - make install-test - make unittest-all-241 - env: - FLUENT_IMAGE_TAG: v24.1.0 + pip install twine + twine check dist/* - - name: Upload 24.1 Coverage Results to Codecov - uses: codecov/codecov-action@v4 + - name: Upload package + uses: actions/upload-artifact@v4 with: - root_dir: ${{ github.workspace }} - name: cov_xml.xml + name: PyFluent-packages + path: | + dist/*.whl + dist/*.tar.gz + retention-days: 7 - - name: Upload 24.1 Coverage Artifacts - uses: actions/upload-artifact@v4 + test: + name: Unit Testing + needs: build + runs-on: [self-hosted, pyfluent] + 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 + + steps: + + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 with: - name: coverage_report - path: ./htmlcov + python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: 23.2 Unit Testing - run: | - make install-test - make unittest-all-232 - env: - FLUENT_IMAGE_TAG: v23.2.0 + - name: Download package + uses: actions/download-artifact@v4 + with: + name: PyFluent-packages + path: dist + + - name: Install pyfluent + run: pip install -q --force-reinstall dist/*.whl > /dev/null - - name: 23.1 Unit Testing + - name: Retrieve PyFluent version run: | - make install-test - make unittest-all-231 + 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 + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ansys-bot + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull Fluent docker image + run: make docker-pull env: - FLUENT_IMAGE_TAG: v23.1.0 + FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} - - name: 22.2 Unit Testing + - name: Unit Testing run: | make install-test - make unittest-all-222 + make unittest-all-${{ matrix.version }} env: - FLUENT_IMAGE_TAG: v22.2.0 + FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} + diff --git a/.github/workflows/weekly-solvermode-test-run.yml b/.github/workflows/test-run-solvermode-weekly.yml similarity index 95% rename from .github/workflows/weekly-solvermode-test-run.yml rename to .github/workflows/test-run-solvermode-weekly.yml index 88788af2a94..93b76cf8d95 100644 --- a/.github/workflows/weekly-solvermode-test-run.yml +++ b/.github/workflows/test-run-solvermode-weekly.yml @@ -1,8 +1,8 @@ -name: Weekly solvermode test run +name: Test Run Solvermode Weekly on: - schedule: # UTC at 0400 on Monday - - cron: '0 4 * * MON' + schedule: # UTC at 0800 on Sunday + - cron: '0 8 * * SUN' workflow_dispatch: env: diff --git a/.github/workflows/test-run-wo-codegen.yml b/.github/workflows/test-run-wo-codegen.yml index 9422e6af819..bf78ea3e0e4 100644 --- a/.github/workflows/test-run-wo-codegen.yml +++ b/.github/workflows/test-run-wo-codegen.yml @@ -1,8 +1,8 @@ -name: Nightly Test Run (No Codegen) +name: Test Run WO Codegen on: - schedule: # UTC at 0400 on Monday and Thursday - - cron: '0 4 * * MON,THU' + schedule: # UTC at 0900 on Sunday + - cron: '0 9 * * SUN' workflow_dispatch: env: @@ -14,8 +14,8 @@ env: PYFLUENT_HIDE_LOG_SECRETS: 1 jobs: - test: - name: Unit Testing + build: + name: Build package runs-on: [self-hosted, pyfluent] steps: @@ -46,69 +46,78 @@ jobs: 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 - uses: docker/login-action@v3 + - name: Check package + run: | + pip install twine + twine check dist/* + + - name: Upload package + uses: actions/upload-artifact@v4 with: - registry: ghcr.io - username: ansys-bot - password: ${{ secrets.GITHUB_TOKEN }} + name: PyFluent-packages + path: | + dist/*.whl + dist/*.tar.gz + retention-days: 7 - - name: Pull 22.2 Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v22.2.0 + test: + name: Unit Testing + needs: build + runs-on: [self-hosted, pyfluent] + 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 - - name: Pull 23.1 Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v23.1.0 + steps: - - name: Pull 23.2 Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v23.2.0 + - uses: actions/checkout@v4 - - name: Pull 24.1 Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v24.1.0 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Pull 24.2 Fluent docker image - run: make docker-pull - env: - FLUENT_IMAGE_TAG: v24.2.0 + - name: Download package + uses: actions/download-artifact@v4 + with: + name: PyFluent-packages + path: dist - - name: 24.2 Unit Testing - run: | - make install-test - make unittest-all-242-no-codegen - env: - FLUENT_IMAGE_TAG: v24.2.0 + - name: Install pyfluent + run: pip install -q --force-reinstall dist/*.whl > /dev/null - - name: 24.1 Unit Testing + - name: Retrieve PyFluent version run: | - make install-test - make unittest-all-241-no-codegen - env: - FLUENT_IMAGE_TAG: v24.1.0 + 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: 23.2 Unit Testing - run: | - make install-test - make unittest-all-232-no-codegen - env: - FLUENT_IMAGE_TAG: v23.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: 23.1 Unit Testing - run: | - make install-test - make unittest-all-231-no-codegen + - name: Pull Fluent docker image + run: make docker-pull env: - FLUENT_IMAGE_TAG: v23.1.0 + FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} - - name: 22.2 Unit Testing + - name: Unit Testing run: | make install-test - make unittest-all-222-no-codegen + make unittest-all-${{ matrix.version }}-no-codegen env: - FLUENT_IMAGE_TAG: v22.2.0 + FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}