Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4aa5ac7
feat: add Docker Compose files for testing PyMAPDL
germa89 Oct 22, 2025
019a55c
chore: adding changelog file 4274.added.md [dependabot-skip]
pyansys-ci-bot Oct 22, 2025
18b50cd
Apply suggestions from code review
germa89 Oct 22, 2025
0246f81
chore: merge remote-tracking branch 'origin/main' into feat/docker-te…
germa89 Jan 5, 2026
3c7e5bb
feat: remove obsolete Docker configuration files and documentation
germa89 Jan 5, 2026
064f760
feat: add Dockerfile and .dockerignore for MAPDL container setup
germa89 Jan 5, 2026
be7107b
feat: update Docker testing infrastructure with environment variables…
germa89 Feb 2, 2026
bce6d47
chore: merge remote-tracking branch 'origin/main' into feat/docker-te…
germa89 Feb 20, 2026
99d908e
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] Feb 20, 2026
d6fc480
fix: improve handling of IP and port assignments in MapdlPool class
germa89 Feb 23, 2026
d539c72
test: enhance environment variable handling in test cases
germa89 Feb 23, 2026
a8fe169
feat: enhance Docker testing infrastructure with updated Dockerfile a…
germa89 Feb 23, 2026
7216fc4
chore: ensure newline at end of example.env file
germa89 Feb 23, 2026
a811fa7
chore: Merge remote-tracking branch 'origin/main' into feat/docker-te…
germa89 Feb 24, 2026
745093d
Merge branch 'main' into feat/docker-testing-infrastructure
germa89 Feb 24, 2026
ce7a7ce
feat: update Docker testing infrastructure and improve start script f…
germa89 Feb 25, 2026
0333932
Merge branch 'feat/docker-testing-infrastructure' of https://github.c…
germa89 Feb 25, 2026
54c280f
Merge branch 'main' into feat/docker-testing-infrastructure
germa89 Feb 27, 2026
3fbe17b
feat: enhance Docker testing infrastructure with remote and local com…
germa89 Mar 2, 2026
d084595
Merge branch 'main' into feat/docker-testing-infrastructure
germa89 Mar 2, 2026
5df45d8
feat: add user configuration for Docker service and set safe director…
germa89 Mar 2, 2026
2ab76cb
feat: add environment variables for Docker cleanup job in CI workflow
germa89 Mar 2, 2026
59a6a0f
feat: update Docker testing configuration to optimize cache handling …
germa89 Mar 2, 2026
c384316
feat: update start script to configure safe directory for Git in Dock…
germa89 Mar 2, 2026
c51840d
feat: update Docker testing scripts to redirect uv cache and project …
germa89 Mar 2, 2026
761c195
Merge branch 'main' into feat/docker-testing-infrastructure
germa89 Mar 2, 2026
a0f96b3
feat: update Dockerfile to use --no-install-recommends for apt-get in…
germa89 Mar 2, 2026
2858e48
feat: remove unnecessary environment variables and optimize package i…
germa89 Mar 2, 2026
bb2a72e
feat: add logging for Docker services in CI workflow and ensure prope…
germa89 Mar 2, 2026
d89b4ff
Merge branch 'feat/docker-testing-infrastructure' of https://github.c…
germa89 Mar 2, 2026
65260b2
feat: add ca-certificates installation to Dockerfile for improved sec…
germa89 Mar 2, 2026
e136822
feat: add OpenMPI environment variables to allow running as root in D…
germa89 Mar 2, 2026
30cbd01
feat: update Docker Compose profile from 'remote-host' to 'remote' fo…
germa89 Mar 2, 2026
c89728d
feat: update Docker Compose command to use 'remote' for consistency i…
germa89 Mar 2, 2026
f0ce5d8
feat: update Docker Compose profile from 'remote' to 'mapdl-remote' f…
germa89 Mar 2, 2026
3ce1eed
feat: update Docker Compose command to simplify service reference
germa89 Mar 2, 2026
6db7022
feat: update Docker Compose command to use 'mapdl-remote' for consist…
germa89 Mar 2, 2026
63b0831
feat: enhance Docker Compose configuration for mapdl-remote service w…
germa89 Mar 2, 2026
cc27e2b
feat: simplify Docker Compose configuration for mapdl-remote service …
germa89 Mar 2, 2026
044f7e1
feat: update Docker Compose command to use 'remote-host' profile for …
germa89 Mar 2, 2026
9e32634
feat: update Docker Compose command to use 'up' for starting services
germa89 Mar 2, 2026
a466a76
feat: update Docker Compose commands for improved logging and cleanup
germa89 Mar 2, 2026
f50a84c
feat: add handling for PYMAPDL_IP environment variable in tests
germa89 Mar 2, 2026
7d14f73
fix: improve pytest performance by enabling package caching and adjus…
germa89 Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 102 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,108 @@ jobs:
test_dpf: false
upload-logs: true

docker-compose-test-remote:
name: "Docker Compose Remote: ${{ matrix.mapdl-version }}"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [smoke-tests]
permissions:
contents: read # Needed to read repository contents for tests
packages: read # Needed to pull Docker images from GitHub packages
strategy:
fail-fast: false
matrix:
mapdl-version: ['v25.2-ubuntu-cicd', 'v25.1-ubuntu-cicd']
steps:
- name: "Install Git and checkout project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false

- name: "Login to GitHub Container Registry"
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 #v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Run docker compose tests (remote-host profile)"
working-directory: docker/testing
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
DOCKER_IMAGE: ghcr.io/ansys/mapdl:${{ matrix.mapdl-version }}
run: |
docker compose --profile remote-host up --build --abort-on-container-exit --exit-code-from pymapdl-host --no-attach mapdl-remote

- name: "Cleanup docker compose"
if: always()
env:
# To avoid warnings
ANSYSLMD_LICENSE_FILE: ""
DOCKER_IMAGE: ghcr.io/ansys/mapdl:${{ matrix.mapdl-version }}
run: |
echo "::group:: MAPDL-remote logs"
docker compose -f docker/testing/docker-compose.yml logs mapdl-remote || true
echo "::endgroup::"

echo "::group:: Python host logs"
docker compose -f docker/testing/docker-compose.yml logs pymapdl-host || true
echo "::endgroup::"

echo "Stopping all services..."
docker compose -f docker/testing/docker-compose.yml --profile remote-host down -v || true

docker-compose-test-local:
name: "Docker Compose Local: ${{ matrix.mapdl-version }}"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [smoke-tests]
permissions:
contents: read # Needed to read repository contents for tests
packages: read # Needed to pull Docker images from GitHub packages
strategy:
fail-fast: false
matrix:
mapdl-version: ['v25.2-ubuntu-cicd', 'v25.1-ubuntu-cicd']
steps:
- name: "Install Git and checkout project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false

- name: "Login to GitHub Container Registry"
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 #v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Run docker compose tests (local-host profile)"
working-directory: docker/testing
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
DOCKER_IMAGE: ghcr.io/ansys/mapdl:${{ matrix.mapdl-version }}
run: |
docker compose --profile local-host up --build --abort-on-container-exit --exit-code-from mapdl-local-host

- name: "Cleanup docker compose"
if: always()
working-directory: docker/testing
env:
# To avoid warnings
ANSYSLMD_LICENSE_FILE: ""
DOCKER_IMAGE: ghcr.io/ansys/mapdl:${{ matrix.mapdl-version }}
run: |
echo "::group:: MAPDL-remote logs"
docker compose logs mapdl-local-host
echo "::endgroup::"

echo "Stopping all services..."
docker compose --profile local-host down -v

package:
name: "Package library"
needs: [build-test-remote, build-test-ubuntu-local, docs-build, build-test-ubuntu-minimal]
needs: [build-test-remote, build-test-ubuntu-local, docs-build, build-test-ubuntu-minimal, docker-compose-test-remote, docker-compose-test-local]
runs-on: ubuntu-latest
permissions:
contents: read # Needed to read repository contents for packaging
Expand Down Expand Up @@ -440,7 +539,7 @@ jobs:

notify:
name: "Notify failed build"
needs: [smoke-tests, docs-build, build-test-remote, build-test-ubuntu-local, build-test-ubuntu-minimal]
needs: [smoke-tests, docs-build, build-test-remote, build-test-ubuntu-local, build-test-ubuntu-minimal, docker-compose-test-remote, docker-compose-test-local]
if: failure() && github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -480,7 +579,7 @@ jobs:
pytest-summary:
name: Pytest summary for all the test jobs
needs: [
build-test-remote, build-test-ubuntu-local, build-test-ubuntu-console, build-test-ubuntu-minimal
build-test-remote, build-test-ubuntu-local, build-test-ubuntu-console, build-test-ubuntu-minimal, docker-compose-test-remote, docker-compose-test-local
]
if: always()
runs-on: ubuntu-latest
Expand Down
22 changes: 11 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ doc/source/images/auto-generated/*


# Testing
./Testing/
.benchmarks/
.coverage
.pytest_cache/
.tox/
*,cover
coverage.xml
factory/
Testing/
UnitTesting/
TODO
test-output.xml
test.sh
.pytest_cache/
tests/.coverage
tests/htmlcov
tests/cyclic/htmlcov
.coverage
*,cover
.benchmarks/
test-output.xml
coverage.xml
.tox/
tests/htmlcov
TODO
UnitTesting/

\#*
.\#*
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/4274.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Docker Compose files for testing PyMAPDL
File renamed without changes.
File renamed without changes.
File renamed without changes.
204 changes: 204 additions & 0 deletions docker/testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
# PyMAPDL docker image that runs the tests.

# Dummy default so there is no error if not set.
# It needs to be set here because we are using it
# later on the FROM.
ARG DOCKER_IMAGE="mapdl:latest"

#######################################################
FROM ubuntu:22.04 AS python-container
#######################################################


ARG USE_LOCAL_REPO
ARG PYTHON_VERSION=3.11

ENV USE_LOCAL_REPO=${USE_LOCAL_REPO}
ENV UV_PYTHON=${PYTHON_VERSION}

WORKDIR /home

# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libgl1-mesa-glx \
xvfb \
libgomp1 \
graphviz \
git \
openssh-client \
curl && \
# Installing uv
curl -LsSf https://astral.sh/uv/install.sh | sh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN ls -al

# Cloning repo if needed.
RUN if [ "$USE_LOCAL_REPO" = "false" ]; then \
echo "Cloning PyMAPDL repository..." && \
git clone https://github.com/ansys/pymapdl.git . && \
git config --global --add safe.directory $(pwd); \
fi

# Set PATH to include uv
ENV PATH="/root/.local/bin:$HOME/.local/bin:$PATH"
RUN uv --version

# Pre-install Python in container-local directory to avoid re-downloads
# This creates a Python installation that persists in the container layer
RUN uv python install ${PYTHON_VERSION}

# Configuration
# -------------
# Variable for running as if it were on CICD while testing
ENV ON_CI=True
# To simulate running on local machine
ENV ON_LOCAL=False
# For tests that check if running on ubuntu.
ENV ON_UBUNTU=False
# Some tests check if running on student machines
ENV ON_STUDENT=False

# PyMAPDL testing env vars
# ------------------------
# To work without a screen.
ENV PYANSYS_OFF_SCREEN=True
# Enable debugging for PyMAPDL
ENV PYMAPDL_DEBUG_TESTING=True
# To connect to an already alive or remote MAPDL instance
ENV PYMAPDL_START_INSTANCE=False
# Set MAPDL port to connect to
ENV PYMAPDL_PORT=50052
# Use insecure gRPC transport for testing. This is needed to connect to the remote MAPDL instance, which is what we want to do in this container.
ENV PYMAPDL_GRPC_TRANSPORT=insecure

# DPF testing
# -----------
# Not testing against DPF
#
# To connect to a remote DPF server
ENV DPF_START_SERVER=False
# Simulate not having DPF
ENV HAS_DPF=False
# Not testing DPF-Results backend
ENV TEST_DPF_BACKEND=False
# MAPDL and DPF are running on the same container
ENV ON_SAME_CONTAINER=False

# Pytest settings
# ---------------
ENV PYTEST_ARGUMENTS='--ignore_image_cache'

# Setting entrypoint
# ------------------
COPY start.sh /
RUN chmod +x /start.sh

ENTRYPOINT [ "/bin/bash", "/start.sh" ]

SHELL [ "/bin/bash", "-c" ]


#######################################################
FROM ${DOCKER_IMAGE} AS mapdl-container
#######################################################
#
# WARNING: This container is designed to work using an Ubuntu base image.
#
ARG USE_LOCAL_REPO
ARG PYTHON_VERSION=3.11

ENV UV_PYTHON=${PYTHON_VERSION}
ENV USE_LOCAL_REPO=${USE_LOCAL_REPO}

ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

# OS configuration
# ----------------
# Installing dependencies
USER root

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libgl1-mesa-glx \
xvfb \
libgomp1 \
graphviz \
git \
openssh-client \
curl \
# Installing uv
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Set PATH to include uv for root user
ENV PATH="/root/.local/bin:$PATH"

RUN USER=mapdl && chown -R $USER:$USER /home/mapdl
USER mapdl

ENV PATH="$HOME/.local/bin:$PATH"

# Cloning repo if needed.
RUN if [ "$USE_LOCAL_REPO" = "false" ]; then \
echo "Cloning PyMAPDL repository..." && \
git clone https://github.com/ansys/pymapdl.git . && \
git config --global --add safe.directory /workspace; \
fi && \
uv --version

# Configuration
# -------------
# Variable for running as if it were on CICD while testing
ENV ON_CI=True
# To simulate running on local machine
ENV ON_LOCAL=True
# For tests that check if running on ubuntu.
ENV ON_UBUNTU=False
# Some tests check if running on student machines
ENV ON_STUDENT=False

# PyMAPDL testing env vars
# ------------------------
# To work without a screen.
ENV PYANSYS_OFF_SCREEN=True
# Enable debugging for PyMAPDL
ENV PYMAPDL_DEBUG_TESTING=True
# Force launching an instance of MAPDL. This is needed to test the connection to a remote instance, which is what we want to do in this container.
ENV PYMAPDL_START_INSTANCE=True
# Set MAPDL port to connect to
ENV PYMAPDL_PORT=50052
# Set additional switches for MAPDL. In this case, we are enabling MPI with OpenMPI.
ENV PYMAPDL_ADDITIONAL_SWITCHES="-mpi openmpi"
# DPF testing
# -----------
# Not testing against DPF
#
# To connect to a remote DPF server
ENV DPF_START_SERVER=False
# Simulate not having DPF
ENV HAS_DPF=False
# Not testing DPF-Results backend
ENV TEST_DPF_BACKEND=False
# MAPDL and DPF are running on the same container
ENV ON_SAME_CONTAINER=False

# Pytest settings
# ---------------
ENV PYTEST_ARGUMENTS='--ignore_image_cache'

# Setting entrypoint
# ------------------
USER root
COPY start.sh /
RUN chmod +x /start.sh
USER mapdl

ENTRYPOINT [ "/bin/bash", "/start.sh" ]
SHELL [ "/bin/bash" ]
Loading
Loading