Skip to content

Commit 3d21ac6

Browse files
authored
DPF for testing in CICD (#1445)
* Implementation in unit tests * Missing run * Fixing TTY error * Removing it flag * Update .github/workflows/ci.yml * Update .github/workflows/ci.yml * Detaching. * Adding the requirements to tests * Asserting conneciton is live, and specifing port. * Adding comment * Adding DPF to nightly CICD
1 parent 2bf4882 commit 3d21ac6

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ on:
1010
- main
1111

1212
env:
13+
PACKAGE_NAME: PyMAPDL
1314
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
1415
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
1516
PYMAPDL_START_INSTANCE: FALSE
1617
PYANSYS_OFF_SCREEN: True
18+
DPF_START_SERVER: False
19+
DPF_PORT: 21002
1720
DOCKER_PACKAGE: ghcr.io/pyansys/pymapdl/mapdl
1821
DOCKER_IMAGE_VERSION_DOCS_BUILD: v22.2.0
1922
# Following env vars when changed will "reset" the mentioned cache,
2023
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
2124
# You should go up in number, if you go down (or repeat a previous value)
2225
# you might end up reusing a previous cache if it haven't been deleted already.
2326
# It applies 7 days retention policy by default.
24-
RESET_PIP_CACHE: 5
25-
RESET_EXAMPLES_CACHE: 5
26-
RESET_DOC_BUILD_CACHE: 5
27-
RESET_AUTOSUMMARY_CACHE: 5
28-
PACKAGE_NAME: PyMAPDL
27+
RESET_PIP_CACHE: 1
28+
RESET_EXAMPLES_CACHE: 1
29+
RESET_DOC_BUILD_CACHE: 1
30+
RESET_AUTOSUMMARY_CACHE: 1
2931

3032
concurrency:
3133
group: ${{ github.workflow }}-${{ github.ref }}
@@ -342,10 +344,17 @@ jobs:
342344
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
343345
MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}
344346

345-
- name: Unit Testing
347+
- name: Unit Testing Requirements Installation
346348
run: |
347349
pip install -r requirements/requirements_tests.txt
348-
xvfb-run pytest -v --maxfail=10 --durations=0 --cov=ansys.mapdl.core --cov-report=xml --cov-report=html
350+
351+
- name: DPF Server Activation
352+
run: |
353+
docker run -d -v `pwd`:/dpf -p ${{ env.DPF_PORT }}:50054 ghcr.io/pyansys/dpf-core/dpf:v2021.1
354+
355+
- name: Unit Testing
356+
run: |
357+
xvfb-run pytest -v --durations=10 --maxfail=10 --cov=ansys.mapdl.core --cov-report=xml --cov-report=html
349358
350359
- uses: codecov/codecov-action@v3
351360
if: matrix.mapdl-version == 'v21.2.1'

.github/workflows/nightly-mapdl-check.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ env:
1010
PYMAPDL_START_INSTANCE: FALSE
1111
PYANSYS_OFF_SCREEN: True
1212
MAPDL_IMAGE: 'ghcr.io/pyansys/mapdl:latest'
13+
DPF_START_SERVER: False
14+
DPF_PORT: 21002
1315

1416
jobs:
1517

@@ -58,10 +60,16 @@ jobs:
5860
env:
5961
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
6062

61-
- name: Unit Testing
63+
- name: Unit Testing Requirements Installation
6264
run: |
6365
pip install -r requirements/requirements_tests.txt
64-
cd tests
66+
67+
- name: DPF Server Activation
68+
run: |
69+
docker run -d -v `pwd`:/dpf -p ${{ env.DPF_PORT }}:50054 ghcr.io/pyansys/dpf-core/dpf:v2021.1
70+
71+
- name: Unit Testing
72+
run: |
6573
xvfb-run pytest -v --cov=ansys.mapdl.core --cov-report=xml --cov-report=html
6674
6775
- name: Display files structure

requirements/requirements_tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ pytest-cov==3.0.0
77
pyvista==0.36.1
88
pyansys-tools-report==0.3.2
99
vtk==9.0.3
10+
ansys-dpf-core==0.6.0

tests/test_dpf.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""Test the DPF implementation"""
2+
import os
3+
4+
from ansys.dpf import core as dpf_core
5+
6+
DPF_PORT = os.environ.get("DPF_PORT", 21002) # Set in ci.yaml
7+
8+
9+
def test_dpf_connection():
10+
# uses 127.0.0.1 and port 50054 by default
11+
try:
12+
grpc_con = dpf_core.connect_to_server(port=DPF_PORT)
13+
assert grpc_con.live
14+
assert True
15+
except OSError:
16+
assert False

0 commit comments

Comments
 (0)