Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding v242 to CICD #2929

Merged
merged 14 commits into from
Mar 22, 2024
3 changes: 2 additions & 1 deletion .ci/collect_mapdl_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ echo "Collecting docker run log..."
cp log.txt ./"$LOG_NAMES"/log.txt || echo "MAPDL run docker log not found."

echo "Copying docker launch log..."
cp mapdl_launch.log ./"$LOG_NAMES"/mapdl_launch.log || echo "MAPDL launch docker log not found."
cp mapdl_launch_0.log ./"$LOG_NAMES"/mapdl_launch_0.log || echo "MAPDL launch docker log not found."
cp mapdl_launch_1.log ./"$LOG_NAMES"/mapdl_launch_1.log || echo "MAPDL launch docker log not found."

echo "Collecting file structure..."
ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file"
Expand Down
9 changes: 7 additions & 2 deletions .ci/start_mapdl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ export VERSION="$MAJOR$MINOR"
echo "MAPDL VERSION: $VERSION"


if [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then
if [[ $MAPDL_VERSION == *"latest-ubuntu"* ]]; then
echo "It is latest-ubuntu. Using 'ansys' script to launch"
export EXEC_PATH=ansys
# export P_SCHEMA=/ansys_inc/ansys/ac4/schema

elif [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then
echo "It is an ubuntu based image"
export EXEC_PATH=/ansys_inc/v$VERSION/ansys/bin/mapdl
export P_SCHEMA=/ansys_inc/v$VERSION/ansys/ac4/schema
Expand All @@ -40,7 +45,7 @@ docker run \
-e ANSYS_LOCK="OFF" \
-p "$PYMAPDL_PORT":50052 \
-p "$PYMAPDL_DB_PORT":50055 \
--shm-size=1gb \
--shm-size=2gb \
-e I_MPI_SHM_LMT=shm \
-e P_SCHEMA="$P_SCHEMA" \
-w /jobs \
Expand Down
60 changes: 55 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,49 @@ jobs:
strategy:
fail-fast: false
matrix:
mapdl-version: ['v22.2.1', 'v22.2-ubuntu', 'v23.1.0', 'v23.2.0', 'v24.1.0', 'v24.1-ubuntu-student']
mapdl-version: [
'v22.2.1',
'v22.2-ubuntu',
'v23.1.0',
'v23.1-ubuntu',
'v23.2.0',
'v23.2-ubuntu',
'v24.1.0',
'v24.1-ubuntu',
'v24.1-ubuntu-student',
'v24.2.0',
'latest-ubuntu',
'latest-ubuntu-student',
]
extended_testing:
- ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }}
exclude:
# In PRs skipping all MAPDL version except student ones (commented out).
- extended_testing: false
mapdl-version: 'v22.2.1'
- extended_testing: false
mapdl-version: 'v22.2-ubuntu'
- extended_testing: false
mapdl-version: 'v23.1.0'
- extended_testing: false
mapdl-version: 'v23.1-ubuntu'
- extended_testing: false
mapdl-version: 'v23.2.0'
- extended_testing: false
mapdl-version: 'v23.1.0'
mapdl-version: 'v23.2-ubuntu'
- extended_testing: false
mapdl-version: 'v24.1.0'
- extended_testing: false
mapdl-version: 'v24.1-ubuntu'
# - extended_testing: false
# mapdl-version: 'v24.1-ubuntu-student'
- extended_testing: false
mapdl-version: 'v24.2.0'
- extended_testing: false
mapdl-version: 'latest-ubuntu'
# - extended_testing: false
# mapdl-version: 'latest-ubuntu-student'

env:
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_PORT2: 21001 # for the pool testing and default won't work on GitHub runners
Expand Down Expand Up @@ -482,14 +509,22 @@ jobs:
strategy:
fail-fast: false
matrix:
mapdl-image: ['v23.2-ubuntu', 'v24.1-ubuntu', 'v24.1-ubuntu-student']
mapdl-image: [
'v23.2-ubuntu',
'v24.1-ubuntu',
'v24.1-ubuntu-student',
'latest-ubuntu',
'latest-ubuntu-student',
]
extended_testing:
- ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }}
exclude:
- extended_testing: false
mapdl-image: 'v23.2-ubuntu'
- extended_testing: false
mapdl-image: 'v24.1-ubuntu'
- extended_testing: false
mapdl-image: 'latest-ubuntu'
container:
image: ghcr.io/ansys/mapdl:${{ matrix.mapdl-image }}
options: -u=0:0 --oom-kill-disable --memory=6656MB --memory-swap=16896MB --shm-size=1gb --entrypoint /bin/bash
Expand Down Expand Up @@ -608,14 +643,22 @@ jobs:
strategy:
fail-fast: false
matrix:
mapdl-image: ['v23.2-ubuntu', 'v24.1-ubuntu', 'v24.1-ubuntu-student']
mapdl-image: [
'v23.2-ubuntu',
'v24.1-ubuntu',
'v24.1-ubuntu-student',
'latest-ubuntu',
'latest-ubuntu-student',
]
extended_testing:
- ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }}
exclude:
- extended_testing: false
mapdl-image: 'v23.2-ubuntu'
- extended_testing: false
mapdl-image: 'v24.1-ubuntu'
- extended_testing: false
mapdl-image: 'latest-ubuntu'
container:
image: ghcr.io/ansys/mapdl:${{ matrix.mapdl-image }}
options: -u=0:0 --oom-kill-disable --memory=6656MB --memory-swap=16896MB --shm-size=1gb --entrypoint /bin/bash
Expand Down Expand Up @@ -665,7 +708,13 @@ jobs:
run: |
# Because there is no 'ansys-tools-path' we need to input the
# executable path with the env var: PYMAPDL_MAPDL_EXEC.
version=$(echo "${{ matrix.mapdl-image }}" | head -c 5 | tail -c 4 | tr -d '.')

if [[ "${{ matrix.mapdl-image }}" == *"latest-ubuntu"* ]] ; then
version="242"
else
version=$(echo "${{ matrix.mapdl-image }}" | head -c 5 | tail -c 4 | tr -d '.')
fi;

echo "$version"

export PYMAPDL_MAPDL_EXEC=/ansys_inc/v"$version"/ansys/bin/ansys"$version"
Expand All @@ -692,6 +741,7 @@ jobs:


test-windows:
# Skipped
if: github.repository == ''
name: "Local: Build & test on Windows"
runs-on: [self-hosted, Windows, pymapdl]
Expand Down
1 change: 1 addition & 0 deletions src/ansys/mapdl/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

# In descending order
SUPPORTED_ANSYS_VERSIONS = {
242: "2024R2",
241: "2024R1",
232: "2023R2",
231: "2023R1",
Expand Down
8 changes: 5 additions & 3 deletions src/ansys/mapdl/core/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from ..mapdl_grpc import MapdlGrpc

MINIMUM_MAPDL_VERSION = "21.1"
FAILING_DATABASE_MAPDL = ["24.1", "24.2"]


class WithinBeginLevel:
Expand Down Expand Up @@ -236,9 +237,10 @@ def start(self, timeout=10):
)

## Checking MAPDL versions
mapdl_version = self._mapdl.version
if not server_meets_version(
str(mapdl_version), MINIMUM_MAPDL_VERSION
mapdl_version = str(self._mapdl.version)
if (
not server_meets_version(mapdl_version, MINIMUM_MAPDL_VERSION)
or mapdl_version in FAILING_DATABASE_MAPDL
): # pragma: no cover
from ansys.mapdl.core.errors import MapdlVersionError

Expand Down
18 changes: 16 additions & 2 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

## Checking MAPDL versions
from ansys.mapdl.core.database import MINIMUM_MAPDL_VERSION, DBDef, MapdlDb
from ansys.mapdl.core.errors import MapdlRuntimeError
from ansys.mapdl.core.database.database import FAILING_DATABASE_MAPDL
from ansys.mapdl.core.errors import MapdlRuntimeError, MapdlVersionError
from ansys.mapdl.core.misc import random_string
from conftest import ON_CI

Expand Down Expand Up @@ -56,7 +57,7 @@ def db(mapdl):
f"This MAPDL version ({mapdl_version}) docker image seems to not support DB, but local does."
)

if mapdl_version == "24.1":
if mapdl_version == "24.1" or mapdl_version == "24.2":
pytest.skip(
f"This MAPDL version ({mapdl_version}) does not support PyMAPDL Database."
)
Expand All @@ -72,6 +73,14 @@ def db(mapdl):
return mapdl.db


def test_failure_on_non_allowed_versions(mapdl):
if str(mapdl.version) in ["24.1", "24.2"]:
with pytest.raises(MapdlVersionError):
mapdl.db.start()
else:
pytest.skip(f"Should run only on MAPDL 24.1 and 24.2")


@pytest.fixture(scope="session")
def gen_block(mapdl):
"""Generate nodes and elements in a simple block."""
Expand Down Expand Up @@ -109,6 +118,11 @@ def test_database_start_stop(mapdl):
f"This MAPDL version ({mapdl_version}) docker image seems to not support DB, but local does."
)

if mapdl_version in FAILING_DATABASE_MAPDL:
pytest.skip(
f"This MAPDL version ({mapdl_version}) docker image does not support Database module."
)

# verify it can be created twice
mapdl.prep7()
for _ in range(2):
Expand Down
Loading