diff --git a/.github/workflows/test-podman-compose.yml b/.github/workflows/test-podman-compose.yml index 66e1bf9b0fb5..848ac1397395 100644 --- a/.github/workflows/test-podman-compose.yml +++ b/.github/workflows/test-podman-compose.yml @@ -19,7 +19,7 @@ env: ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} PYFLUENT_TIMEOUT_FORCE_EXIT: 30 PYFLUENT_LAUNCH_CONTAINER: 1 - PYFLUENT_USE_PODMAN_COMPOSE: 1 + # PYFLUENT_USE_PODMAN_COMPOSE: 1 PYFLUENT_LOGGING: "DEBUG" PYFLUENT_WATCHDOG_DEBUG: "OFF" PYFLUENT_HIDE_LOG_SECRETS: 1 @@ -40,8 +40,8 @@ jobs: fail-fast: false matrix: include: - - image-tag: v25.2.0 - version: 252 + - image-tag: v26.1.0 + version: 261 steps: - uses: actions/checkout@v4 @@ -85,26 +85,74 @@ jobs: docker pull ghcr.io/ansys/pyfluent:${{ matrix.image-tag }} docker images - - name: Transport docker image to podman + - name: Size of the original image run: | - sudo podman pull docker-daemon:ghcr.io/ansys/pyfluent:${{ matrix.image-tag }} - sudo podman images + docker images ghcr.io/ansys/pyfluent:${{ matrix.image-tag }} - - name: Run API codegen - run: make api-codegen + - name: Create reduced image + run: | + # Create and start a container from the original image + docker run -it -d --name ${{ matrix.version }}-container -e ANSYSLMD_LICENSE_FILE="$ANSYSLMD_LICENSE_FILE" ghcr.io/ansys/pyfluent:${{ matrix.image-tag }} 3ddp -gu + + # Delete unwanted files from the container + docker exec ${{ matrix.version }}-container rm -rf ansys_inc/v261/FluidsOne + + # Stop the container + docker stop ${{ matrix.version }}-container + + # Export the container's filesystem as a tarball + docker export ${{ matrix.version }}-container > new_${{ matrix.version }}.tar + + # Import the tarball as a new image + cat new_${{ matrix.version }}.tar | docker import - ${{ matrix.version }}_reduced:${{ matrix.image-tag }} + + - name: Clean up + run: | + docker rm ${{ matrix.version }}-container + docker rmi ghcr.io/ansys/pyfluent:${{ matrix.image-tag }} + rm new_${{ matrix.version }}.tar - - name: Print Fluent version info + - name: Verify reduced image run: | - cat src/ansys/fluent/core/generated/fluent_version_${{ matrix.version }}.py + docker images ${{ matrix.version }}_reduced:${{ matrix.image-tag }} - - name: Install again after codegen + - name: Run solver container from the new reduced image run: | - rm -rf dist - make install > /dev/null + docker run -it -d --name ${{ matrix.version }}-reduced-container-solver -e ANSYSLMD_LICENSE_FILE="$ANSYSLMD_LICENSE_FILE" ${{ matrix.version }}_reduced:${{ matrix.image-tag }} 3ddp -gu + docker exec ${{ matrix.version }}-reduced-container-solver ls -l /ansys_inc/v261/FluidsOne + docker stop ${{ matrix.version }}-reduced-container-solver + docker rm ${{ matrix.version }}-reduced-container-solver - - name: Run Fluent test script + - name: Run meshing container from the new reduced image run: | - python tests/podman_compose.py + docker run -it -d --name ${{ matrix.version }}-reduced-container-meshing -e ANSYSLMD_LICENSE_FILE="$ANSYSLMD_LICENSE_FILE" ${{ matrix.version }}_reduced:${{ matrix.image-tag }} 3ddp -gu -meshing + docker stop ${{ matrix.version }}-reduced-container-meshing + docker rm ${{ matrix.version }}-reduced-container-meshing + + - name: Run reduced image test script + run: | + python tests/verify_reduced_image.py + + # - name: Transport docker image to podman + # run: | + # sudo podman pull docker-daemon:ghcr.io/ansys/pyfluent:${{ matrix.image-tag }} + # sudo podman images + + # - name: Run API codegen + # run: make api-codegen + + # - name: Print Fluent version info + # run: | + # cat src/ansys/fluent/core/generated/fluent_version_${{ matrix.version }}.py + + # - name: Install again after codegen + # run: | + # rm -rf dist + # make install > /dev/null + + # - name: Run Fluent test script + # run: | + # python tests/podman_compose.py - name: Cleanup previous containers if: always() diff --git a/doc/changelog.d/4194.maintenance.md b/doc/changelog.d/4194.maintenance.md new file mode 100644 index 000000000000..3be818a3c5e1 --- /dev/null +++ b/doc/changelog.d/4194.maintenance.md @@ -0,0 +1 @@ +Reduce image size testing [skip tests] \ No newline at end of file diff --git a/tests/verify_reduced_image.py b/tests/verify_reduced_image.py new file mode 100644 index 000000000000..9033198cac86 --- /dev/null +++ b/tests/verify_reduced_image.py @@ -0,0 +1,41 @@ +# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +"""Verify reduced image.""" + + +import ansys.fluent.core as pyfluent +from ansys.fluent.core import examples +from ansys.fluent.core.utils.networking import get_free_port + +port_1 = get_free_port() +port_2 = get_free_port() +container_dict = { + "fluent_image": "261_reduced:v26.1.0", + "ports": {f"{port_1}": port_1, f"{port_2}": port_2}, +} + +solver = pyfluent.launch_fluent(container_dict=container_dict) +assert len(solver._container.ports) == 2 +case_file_name = examples.download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow") +solver.file.read(file_name=case_file_name, file_type="case") +solver.exit()