Skip to content

Commit

Permalink
ci: adding-profiling-to-unit-tests (#3676)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
germa89 and pyansys-ci-bot authored Jan 21, 2025
1 parent 30e5c0d commit 8be236d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .ci/collect_mapdl_logs_locals.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

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

echo "Copying the log files..."
cp *.log ./"$LOG_NAMES"/ || echo "No log files could be found"
cp *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
cp *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"

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


ls -la ./"$LOG_NAMES"

Expand Down
3 changes: 3 additions & 0 deletions .ci/collect_mapdl_logs_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ echo "Copying docker launch log..."
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 "Copying the profiling files..."
cp -r prof ./"$LOG_NAMES"/prof || echo "No profile files could be found"

echo "Collecting file structure..."
ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file"

Expand Down
1 change: 1 addition & 0 deletions .ci/requirements_minimal.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pyfakefs==5.7.2
pytest-cov==6.0.0
pytest-profiling==1.8.1
pytest-random-order==1.1.1
pytest-rerunfailures==15.0
pytest-timeout==2.3.1
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ env:
DPF_PORT: 21004
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
ON_CI: True
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'
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'

BUILD_CHEATSHEET: True
PYMAPDL_DEBUG_TESTING: True
Expand Down Expand Up @@ -513,7 +513,7 @@ jobs:
- name: "Install os packages"
run: |
sudo apt update
sudo apt install libgl1-mesa-glx xvfb
sudo apt install libgl1-mesa-glx xvfb graphviz
- name: "Test virtual framebuffer"
run: |
Expand Down Expand Up @@ -685,7 +685,7 @@ jobs:
- name: "Install OS packages"
run: |
apt update
apt install -y libgl1-mesa-glx xvfb libgomp1
apt install -y libgl1-mesa-glx xvfb libgomp1 graphviz
- name: "Test virtual framebuffer"
run: |
Expand Down Expand Up @@ -827,7 +827,7 @@ jobs:
- name: "Installing missing package"
run: |
sudo apt-get update
sudo apt-get install -y libgomp1
sudo apt-get install -y libgomp1 graphviz
- name: "Setup Python"
uses: actions/setup-python@v5
Expand Down Expand Up @@ -957,7 +957,7 @@ jobs:
- name: "Installing missing package"
run: |
sudo apt-get update
sudo apt-get install -y libgomp1
sudo apt-get install -y libgomp1 graphviz
- name: "Setup Python"
uses: actions/setup-python@v5
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ docker/mapdl/v212
docker/mapdl/_old
docker/mapdl/*.sh


# temp testing
tmp.out

Expand All @@ -101,3 +100,6 @@ doc/source/sg_execution_times.rst
*prin-stresses.html
doc/webserver.log
doc/webserver.pid

# Profiling
prof
1 change: 1 addition & 0 deletions doc/changelog.d/3676.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ci: adding-profiling-to-unit-tests
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ tests = [
"pyfakefs==5.7.4",
"pyiges[full]==0.3.1",
"pytest-cov==6.0.0",
"pytest-profiling==1.8.1",
"pytest-pyvista==0.1.9",
"pytest-random-order==1.1.1",
"pytest-rerunfailures==15.0",
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
# Setting testing environment
# ---------------------------
#

DEBUG_TESTING = debug_testing()
TESTING_MINIMAL = testing_minimal()

Expand Down

0 comments on commit 8be236d

Please sign in to comment.