Skip to content

Commit 8be236d

Browse files
ci: adding-profiling-to-unit-tests (#3676)
* ci: adding profiling to pytest * fix: plugin registering * ci: adding graphviz to dependencies for profiling plotting * ci: adding prof file to gitignore * chore: adding changelog file 3676.dependencies.md [dependabot-skip] * chore: adding changelog file 3676.dependencies.md [dependabot-skip] * ci: adding library to minimal testing requirements when using minimal or console. * fix: not attaching prof files --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 30e5c0d commit 8be236d

File tree

8 files changed

+18
-7
lines changed

8 files changed

+18
-7
lines changed

.ci/collect_mapdl_logs_locals.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11

22
mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES"
33

4+
echo "Copying the log files..."
45
cp *.log ./"$LOG_NAMES"/ || echo "No log files could be found"
56
cp *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
67
cp *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"
78

9+
echo "Copying the profiling files..."
10+
cp -r prof ./"$LOG_NAMES"/prof || echo "No profile files could be found"
11+
812

913
ls -la ./"$LOG_NAMES"
1014

.ci/collect_mapdl_logs_remote.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ echo "Copying docker launch log..."
3535
cp mapdl_launch_0.log ./"$LOG_NAMES"/mapdl_launch_0.log || echo "MAPDL launch docker log not found."
3636
cp mapdl_launch_1.log ./"$LOG_NAMES"/mapdl_launch_1.log || echo "MAPDL launch docker log not found."
3737

38+
echo "Copying the profiling files..."
39+
cp -r prof ./"$LOG_NAMES"/prof || echo "No profile files could be found"
40+
3841
echo "Collecting file structure..."
3942
ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file"
4043

.ci/requirements_minimal.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pyfakefs==5.7.2
22
pytest-cov==6.0.0
3+
pytest-profiling==1.8.1
34
pytest-random-order==1.1.1
45
pytest-rerunfailures==15.0
56
pytest-timeout==2.3.1

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ env:
3333
DPF_PORT: 21004
3434
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
3535
ON_CI: True
36-
PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=10 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180'
36+
PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile'
3737

3838
BUILD_CHEATSHEET: True
3939
PYMAPDL_DEBUG_TESTING: True
@@ -513,7 +513,7 @@ jobs:
513513
- name: "Install os packages"
514514
run: |
515515
sudo apt update
516-
sudo apt install libgl1-mesa-glx xvfb
516+
sudo apt install libgl1-mesa-glx xvfb graphviz
517517
518518
- name: "Test virtual framebuffer"
519519
run: |
@@ -685,7 +685,7 @@ jobs:
685685
- name: "Install OS packages"
686686
run: |
687687
apt update
688-
apt install -y libgl1-mesa-glx xvfb libgomp1
688+
apt install -y libgl1-mesa-glx xvfb libgomp1 graphviz
689689
690690
- name: "Test virtual framebuffer"
691691
run: |
@@ -827,7 +827,7 @@ jobs:
827827
- name: "Installing missing package"
828828
run: |
829829
sudo apt-get update
830-
sudo apt-get install -y libgomp1
830+
sudo apt-get install -y libgomp1 graphviz
831831
832832
- name: "Setup Python"
833833
uses: actions/setup-python@v5
@@ -957,7 +957,7 @@ jobs:
957957
- name: "Installing missing package"
958958
run: |
959959
sudo apt-get update
960-
sudo apt-get install -y libgomp1
960+
sudo apt-get install -y libgomp1 graphviz
961961
962962
- name: "Setup Python"
963963
uses: actions/setup-python@v5

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ docker/mapdl/v212
7979
docker/mapdl/_old
8080
docker/mapdl/*.sh
8181

82-
8382
# temp testing
8483
tmp.out
8584

@@ -101,3 +100,6 @@ doc/source/sg_execution_times.rst
101100
*prin-stresses.html
102101
doc/webserver.log
103102
doc/webserver.pid
103+
104+
# Profiling
105+
prof

doc/changelog.d/3676.dependencies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ci: adding-profiling-to-unit-tests

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ tests = [
6363
"pyfakefs==5.7.4",
6464
"pyiges[full]==0.3.1",
6565
"pytest-cov==6.0.0",
66+
"pytest-profiling==1.8.1",
6667
"pytest-pyvista==0.1.9",
6768
"pytest-random-order==1.1.1",
6869
"pytest-rerunfailures==15.0",

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
# Setting testing environment
5858
# ---------------------------
5959
#
60-
6160
DEBUG_TESTING = debug_testing()
6261
TESTING_MINIMAL = testing_minimal()
6362

0 commit comments

Comments
 (0)