refactor: Exposure & User guide of using context manager #14951
This file contains hidden or 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: GitHub Actions | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - ".github/workflows/run-custom-tests.yml" | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "*" | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| packages: read | |
| pull-requests: read | |
| issues: read | |
| env: | |
| API_CODE_CACHE: 7 | |
| 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 | |
| PYTEST_XDIST_AUTO_NUM_WORKERS: 4 | |
| PYFLUENT_LAUNCH_CONTAINER: 1 | |
| PYFLUENT_LOGGING: "DEBUG" | |
| PYFLUENT_WATCHDOG_DEBUG: "OFF" | |
| PYFLUENT_HIDE_LOG_SECRETS: 1 | |
| PYFLUENT_LAUNCH_FLUENT_TIMEOUT: 180 | |
| jobs: | |
| add-license-headers: | |
| name: "Add license headers" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: "Install and run add-license-headers" | |
| shell: bash | |
| run: | | |
| python -m pip install -U pip | |
| pip install pre-commit | |
| pre-commit install | |
| pre-commit run add-license-headers --all-files --hook-stage manual | |
| update-changelog: | |
| name: "Update CHANGELOG (on release)" | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: ansys/actions/doc-deploy-changelog@v10.2 | |
| with: | |
| bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
| bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} | |
| token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} | |
| docs-style: | |
| name: Documentation Style Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Running Vale | |
| uses: ansys/actions/doc-style@v10.2 | |
| 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@v10.2 | |
| commit-style: | |
| name: "Run commit style checks" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: ansys/actions/check-pr-title@v10.2 | |
| 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@v10.2 | |
| with: | |
| library-name: ${{ env.PACKAGE_NAME }} | |
| operating-system: ${{ matrix.os }} | |
| python-version: ${{ matrix.python-version }} | |
| check-vulnerabilities: | |
| name: "Check library vulnerabilities" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: ansys/actions/check-vulnerabilities@main | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} | |
| python-package-name: ${{ env.PACKAGE_NAME }} | |
| dev-mode: ${{ github.ref != 'refs/heads/main' }} | |
| upload-reports: True | |
| hide-log: false | |
| bandit-configfile: "pyproject.toml" | |
| actions-security: | |
| name: "Actions Security" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: ansys/actions/check-actions-security@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5 | |
| with: | |
| generate-summary: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| auditing-level: "high" | |
| docs_build: | |
| name: Build Documentation | |
| needs: [docs-style] | |
| runs-on: [self-hosted, pyfluent] | |
| env: | |
| DOC_DEPLOYMENT_IMAGE_TAG: v26.1.latest | |
| PYFLUENT_CONTAINER_MOUNT_SOURCE: "/home/ansys/Downloads/ansys_fluent_core_examples" | |
| PYTHONDONTWRITEBYTECODE: 1 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| path: ~/.cache/pip | |
| key: Python-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| Python-${{ runner.os }}-${{ env.PYTHON_VERSION }} | |
| lookup-only: false # zizmor: ignore[cache-poisoning] | |
| - name: Install Quarto | |
| uses: quarto-dev/quarto-actions/setup@8a96df13519ee81fd526f2dfca5962811136661b # v2.2.0 | |
| - 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache-api-code | |
| with: | |
| path: | | |
| src/ansys/fluent/core/generated | |
| key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('src/ansys/fluent/core/codegen/**') }} | |
| lookup-only: false # zizmor: ignore[cache-poisoning] | |
| - name: Login to GitHub Container Registry | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| 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: Build Source Documentation | |
| run: | | |
| pip install -r requirements/requirements_build.txt | |
| pip install ansys-fluent-core[docs,reader,tests] | |
| make build-doc-source | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} | |
| - name: Zip HTML Documentation before upload | |
| env: | |
| DOC_DEPLOYMENT_IMG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} | |
| run: | | |
| sudo apt install zip -y | |
| pushd doc/_build/html | |
| zip -r ../../../HTML-Documentation-tag-${DOC_DEPLOYMENT_IMG}.zip . | |
| popd | |
| - name: Upload HTML Documentation | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} | |
| path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip | |
| retention-days: 7 | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| build: | |
| name: Build | |
| if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }} | |
| runs-on: [self-hosted, pyfluent] | |
| env: | |
| PYTHONDONTWRITEBYTECODE: 1 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Cache pip | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| path: ~/.cache/pip | |
| key: Python-${{ runner.os }}-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| Python-${{ runner.os }}-${{ env.MAIN_PYTHON_VERSION }} | |
| lookup-only: false # zizmor: ignore[cache-poisoning] | |
| - 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@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ansys-bot | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache API Code | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| id: cache-api-code | |
| with: | |
| path: src/ansys/fluent/core/generated | |
| # Combined cache key for all versions: | |
| # API-Code-<Cache version>-<PyFluent version>-<First Fluent release version>-<Last Fluent release version>-<Fluent dev version>-<Hash of codegen files> | |
| key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.2.0-v25.2.3-${{ vars.FLUENT_STABLE_IMAGE_DEV }}-${{ hashFiles('src/ansys/fluent/core/codegen/**') }} | |
| lookup-only: false # zizmor: ignore[cache-poisoning] | |
| - name: Pull 24.2 Fluent docker image | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make docker-pull | |
| env: | |
| FLUENT_IMAGE_TAG: v24.2.5 | |
| - name: Run 24.2 API codegen | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make api-codegen | |
| env: | |
| FLUENT_IMAGE_TAG: v24.2.5 | |
| 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 src.ansys.fluent.core.generated.solver.settings_242 import SHASH; print(f'SETTINGS_HASH = {SHASH}')" | |
| - name: Pull 25.1 Fluent docker image | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make docker-pull | |
| env: | |
| FLUENT_IMAGE_TAG: v25.1.4 | |
| - name: Run 25.1 API codegen | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make api-codegen | |
| env: | |
| FLUENT_IMAGE_TAG: v25.1.4 | |
| 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 src.ansys.fluent.core.generated.solver.settings_251 import SHASH; print(f'SETTINGS_HASH = {SHASH}')" | |
| - name: Pull 25.2 Fluent docker image | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make docker-pull | |
| env: | |
| FLUENT_IMAGE_TAG: v25.2.3 | |
| - name: Run 25.2 API codegen | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make api-codegen | |
| env: | |
| FLUENT_IMAGE_TAG: v25.2.3 | |
| PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1 | |
| - name: Print 25.2 Fluent version info | |
| run: | | |
| cat src/ansys/fluent/core/generated/fluent_version_252.py | |
| python -c "from src.ansys.fluent.core.generated.solver.settings_252 import SHASH; print(f'SETTINGS_HASH = {SHASH}')" | |
| - name: Pull 26.1 Fluent docker image | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make docker-pull | |
| env: | |
| FLUENT_IMAGE_TAG: v26.1.latest | |
| - name: Run 26.1 API codegen | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make api-codegen | |
| env: | |
| FLUENT_IMAGE_TAG: v26.1.latest | |
| - name: Print 26.1 Fluent version info | |
| run: | | |
| cat src/ansys/fluent/core/generated/fluent_version_261.py | |
| python -c "from src.ansys.fluent.core.generated.solver.settings_261 import SHASH; print(f'SETTINGS_HASH = {SHASH}')" | |
| - name: Pull 27.1 Fluent docker image | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make docker-pull | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Run 27.1 API codegen | |
| if: steps.cache-api-code.outputs.cache-hit != 'true' | |
| run: make api-codegen | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Print 27.1 Fluent version info | |
| run: | | |
| cat src/ansys/fluent/core/generated/fluent_version_271.py | |
| python -c "from src.ansys.fluent.core.generated.solver.settings_271 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: PyFluent-packages | |
| path: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| retention-days: 7 | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| test: | |
| name: Unit Testing | |
| if: ${{ always() }} | |
| needs: build | |
| runs-on: [public-ubuntu-latest-8-cores] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - image-tag: v24.2.5 | |
| version: 242 | |
| - image-tag: v25.1.4 | |
| version: 251 | |
| - image-tag: v25.2.3 | |
| version: 252 | |
| - image-tag: v26.1.latest | |
| version: 261 | |
| - image-tag: v27.1.latest | |
| version: 271 | |
| timeout-minutes: 60 | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ matrix.version == 271 && vars.FLUENT_STABLE_IMAGE_DEV || matrix.image-tag }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }} | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Download package | |
| if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }} | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| 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@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| 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]') }} | |
| env: | |
| MATRIX_VERSION: ${{ matrix.version }} | |
| run: | | |
| make install-test | |
| make unittest-dev-${MATRIX_VERSION} | |
| - name: Upload 26.1 Coverage Artifacts | |
| if: matrix.image-tag == 'v26.1.latest' | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: coverage_report | |
| path: ./htmlcov | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| nightly-dev-test: | |
| name: Release Testing | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev') | |
| runs-on: [self-hosted, pyfluent] | |
| env: | |
| PYTEST_XDIST_AUTO_NUM_WORKERS: 1 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Cache pip | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| path: ~/.cache/pip | |
| key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| Python-${{ runner.os }}-${{ matrix.python-version }} | |
| lookup-only: false # zizmor: ignore[cache-poisoning] | |
| - 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@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ansys-bot | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull Fluent docker image | |
| run: make docker-pull | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Run API codegen | |
| run: make api-codegen | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Print Fluent version info | |
| run: | | |
| cat src/ansys/fluent/core/generated/fluent_version_271.py | |
| python -c "from ansys.fluent.core.generated.solver.settings_271 import SHASH; print(f'SETTINGS_HASH = {SHASH}')" | |
| - name: Install again after codegen | |
| run: | | |
| rm -rf dist | |
| make install > /dev/null | |
| - name: Unit Testing | |
| run: | | |
| make install-test | |
| make unittest-all-271 | |
| env: | |
| FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| - name: Clean Docker Data | |
| run: make docker-clean-all-except-supported-images | |
| env: | |
| FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }} | |
| release: | |
| name: Release | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| needs: [test, update-changelog] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # required for trusted publishing | |
| contents: write # required for GitHub release upload | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: "Download the library artifacts from build-library step" | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: PyFluent-packages | |
| path: PyFluent-packages | |
| - name: Display package file list | |
| run: ls -R | |
| - name: Upload to Private PyPi | |
| run: | | |
| pip install 'twine<6.2.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 artifacts to PyPI using trusted publisher" | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| with: | |
| repository-url: "https://upload.pypi.org/legacy/" | |
| print-hash: true | |
| packages-dir: PyFluent-packages | |
| skip-existing: false | |
| - name: Release | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 | |
| with: | |
| files: | | |
| ./**/*.whl | |
| ./**/*.tar.gz | |
| ./**/*-wheelhouse-*.zip |