fix> Sphinx req #252
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: Fluent - Mechanical Exhaust Manifold Workflow | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| doc-build: | |
| required: false | |
| default: false | |
| type: boolean | |
| description: 'Whether to build the documentation' | |
| workflow_call: | |
| inputs: | |
| doc-build: | |
| required: false | |
| default: false | |
| type: boolean | |
| description: 'Whether to build the documentation' | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| paths: | |
| - 'fluent-mechanical/**' | |
| env: | |
| MAIN_PYTHON_VERSION: '3.12' | |
| FLUENT_DOCKER_IMAGE: 'ghcr.io/ansys/fluent' | |
| FLUENT_DOCKER_EXEC_COMMAND: ${{ secrets.FLUENT_DOCKER_EXEC_COMMAND }} | |
| MECHANICAL_DOCKER_IMAGE: 'ghcr.io/ansys/mechanical' | |
| DOCKER_MECH_CONTAINER_NAME: mechanical | |
| PYMECHANICAL_PORT: 10000 | |
| ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER )}} | |
| PYANSYS_WORKFLOWS_CI: true | |
| ANSYS_RELEASE_FOR_DOCS: 25.1 | |
| PYMECHANICAL_START_INSTANCE: false | |
| jobs: | |
| is-only-docs-required: | |
| uses: ./.github/workflows/check-docs-required.yml | |
| with: | |
| doc-build: ${{ inputs.doc-build || false }} | |
| fluent: | |
| name: Fluent | |
| runs-on: public-ubuntu-latest-8-cores | |
| needs: is-only-docs-required | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ansys-release: ${{ needs.is-only-docs-required.outputs.only-docs == 'true' && fromJSON('[25.1]') || fromJSON('[24.1, 24.2, 25.1]') }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| sparse-checkout: | | |
| fluent-mechanical | |
| doc | |
| - name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r fluent-mechanical/requirements_${{ matrix.ansys-release }}.txt | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Full Fluent image (name+tag) | |
| run: | | |
| if [[ "${{ matrix.ansys-release }}" == "24.1" || "${{ matrix.ansys-release }}" == "24.2" ]]; then | |
| IMAGE_TAG=v24.2.5 | |
| elif [[ "${{ matrix.ansys-release }}" == "25.1" ]]; then | |
| IMAGE_TAG=v25.1.4 | |
| else | |
| echo "Unsupported release: ${{ matrix.ansys-release }}" | |
| exit 1 | |
| fi | |
| echo "FLUENT_DOCKER_IMAGE=${{ env.FLUENT_DOCKER_IMAGE }}:${IMAGE_TAG}" >> $GITHUB_ENV | |
| - name: Download Fluent service container | |
| run: | | |
| echo "Pulling Fluent image: ${{ env.FLUENT_DOCKER_IMAGE }}" | |
| docker pull ${{ env.FLUENT_DOCKER_IMAGE }} | |
| - name: Update graphics dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libegl1-mesa-dev libosmesa6-dev xvfb | |
| - name: Run the Fluent script | |
| env: | |
| FLUENT_IMAGE_TAG: v${{ matrix.ansys-release }}.0 | |
| run: | | |
| xvfb-run python fluent-mechanical/wf_fm_01_fluent.py | |
| - name: Store the outputs | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: fluent-mechanical-workflow-fluent-outputs-${{ matrix.ansys-release }} | |
| path: | | |
| fluent-mechanical/outputs/htc_temp_mapping_LOW_TEMP.csv | |
| fluent-mechanical/outputs/htc_temp_mapping_MEDIUM_TEMP.csv | |
| fluent-mechanical/outputs/htc_temp_mapping_HIGH_TEMP.csv | |
| - name: Stop all containers (if any) | |
| run: | | |
| if [ -n "$(docker ps -a -q)" ]; then | |
| docker rm -f $(docker ps -a -q) | |
| fi | |
| - name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS}}) | |
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | |
| env: | |
| FLUENT_IMAGE_TAG: v${{ matrix.ansys-release }}.0 | |
| BUILD_DOCS_SCRIPT: 'fluent-mechanical/wf_fm_01_fluent.py' | |
| run: | | |
| cd doc | |
| pip install -r requirements.txt | |
| xvfb-run make html | |
| - name: (DOCS) Upload docs artifacts | |
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: fluent-mechanical-docs-stage-fluent | |
| path: | | |
| doc/_build/ | |
| doc/source/examples/fluent-mechanical/ | |
| overwrite: true | |
| mechanical: | |
| name: Mechanical | |
| runs-on: [public-ubuntu-latest-8-cores] | |
| needs: [fluent, is-only-docs-required] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ansys-release: ${{ needs.is-only-docs-required.outputs.only-docs == 'true' && fromJSON('[25.1]') || fromJSON('[24.1, 24.2, 25.1]') }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| sparse-checkout: | | |
| fluent-mechanical | |
| doc | |
| - name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y nodejs npm graphviz xvfb | |
| npm install -g @mermaid-js/mermaid-cli | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m venv .venv | |
| . .venv/bin/activate | |
| pip install -r fluent-mechanical/requirements_${{ matrix.ansys-release }}.txt | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download (if needed) launch, and validate Mechanical service | |
| env: | |
| LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
| MECHANICAL_IMAGE: ${{ env.MECHANICAL_DOCKER_IMAGE }}:${{ matrix.ansys-release }}.0 | |
| run: | | |
| docker pull ${{ env.MECHANICAL_IMAGE }} | |
| docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ env.MECHANICAL_IMAGE }} > log.txt & | |
| # Wait for Mechanical to initialize with intelligent polling | |
| max_wait=300 # Maximum wait time in seconds | |
| check_interval=10 # Check every 10 seconds | |
| elapsed=0 | |
| echo "Waiting for Mechanical to initialize..." | |
| while [ $elapsed -lt $max_wait ]; do | |
| if grep -q 'WB Initialize Done' log.txt 2>/dev/null; then | |
| echo "Mechanical initialized successfully after ${elapsed} seconds" | |
| break | |
| fi | |
| echo "Waiting for initialization... (${elapsed}/${max_wait}s)" | |
| sleep $check_interval | |
| elapsed=$((elapsed + check_interval)) | |
| done | |
| # Final check | |
| if ! grep -q 'WB Initialize Done' log.txt 2>/dev/null; then | |
| echo "ERROR: Mechanical failed to initialize within ${max_wait} seconds" | |
| echo "=== Last 50 lines of log.txt ===" | |
| tail -n 50 log.txt || echo "No log file found" | |
| exit 1 | |
| fi | |
| - name: Check out the fluent outputs | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: fluent-mechanical-workflow-fluent-outputs-${{ matrix.ansys-release }} | |
| path: fluent-mechanical/outputs | |
| - name: Run the PyMechanical script | |
| run: | | |
| . .venv/bin/activate | |
| xvfb-run python fluent-mechanical/wf_fm_02_mechanical.py | |
| - name: Store the outputs | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: fluent-mechanical-workflow-mechanical-outputs-${{ matrix.ansys-release }} | |
| path: fluent-mechanical/outputs | |
| - name: (DOCS) Download the docs artifacts | |
| uses: actions/download-artifact@v7 | |
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | |
| with: | |
| name: fluent-mechanical-docs-stage-fluent | |
| path: doc | |
| - name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS }}) | |
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | |
| env: | |
| BUILD_DOCS_SCRIPT: 'fluent-mechanical/wf_fm_02_mechanical.py' | |
| run: | | |
| . .venv/bin/activate | |
| cd doc | |
| pip install -r requirements.txt | |
| xvfb-run make html | |
| - name: (DOCS) Upload docs artifacts | |
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: fluent-mechanical-docs | |
| path: | | |
| doc/_build/ | |
| doc/source/examples/fluent-mechanical/ | |
| overwrite: true |