Skip to content

Commit

Permalink
Merge branch 'main' into fix/connection-commands-in-cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 authored Nov 6, 2023
2 parents 712ce73 + ff8ea46 commit d103b25
Show file tree
Hide file tree
Showing 104 changed files with 3,600 additions and 1,015 deletions.
14 changes: 14 additions & 0 deletions .ci/run_vms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Run some vm manuals"""
from ansys.mapdl.core import launch_mapdl
from ansys.mapdl.core.examples import vmfiles

mapdl = launch_mapdl()

vms = list(vmfiles.keys())

for i, vm in enumerate(vms[:2]):
mapdl.clear()
print(f"Running the vm {i}: {vm}")
output = mapdl.input(vmfiles[vm])
print(f"Running the vm {i}: Successfully completed")
mapdl.exit()
94 changes: 90 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


defaults:
run:
shell: bash

permissions:
contents: write
packages: read
pull-requests: write

jobs:

doc-style:
Expand All @@ -62,6 +66,7 @@ jobs:
uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: 2.29.6

smoke-tests:
name: "Build and smoke tests"
Expand Down Expand Up @@ -260,7 +265,7 @@ jobs:
run: cat log.txt

build-test:
name: "Remote: Build and unit testing"
name: "Remote: Build & test"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 35
Expand Down Expand Up @@ -455,7 +460,7 @@ jobs:
if compgen -G './logs-${{ matrix.mapdl-version }}/*.out' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi || echo "Failed to display the 'log' files."
build-test-ubuntu:
name: "Local: Build and unit testing on Ubuntu"
name: "Local: Build & test on Ubuntu"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 55
Expand All @@ -481,6 +486,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}


- name: "Setup Python"
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -576,10 +582,89 @@ jobs:
with:
name: ubuntu-v22.2.0-local.xml
path: ./ubuntu-v22.2.0-local.xml

- name: 'Upload minimal requirements file'
uses: actions/upload-artifact@v3
with:
name: minimum_requirements.txt
path: ./minimum_requirements.txt

build-test-ubuntu-minimal:
name: "Local: Build & test minimal package on Ubuntu"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 55
container:
image: ghcr.io/ansys/mapdl:v22.2-ubuntu
options: "-u=0:0 --entrypoint /bin/bash"
credentials:
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
ON_LOCAL: true
ON_UBUNTU: true
# Because there is no 'ansys-tools-path' we need to input the executable path.
PYMAPDL_MAPDL_EXEC: /ansys_inc/v222/ansys/bin/ansys222

steps:
- name: "Install Git and checkout project"
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: "Setup Python"
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Checking Python"
run: |
python --version
python -m pip install --upgrade pip
- name: "Install ansys-mapdl-core"
run: |
python -m pip install . --no-deps
python -m pip install -r minimum_requirements.txt
python -c "from ansys.mapdl import core as pymapdl; print('Import successfull')"
- name: "Running some verification manual examples"
run: |
unset PYMAPDL_START_INSTANCE
export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
python .ci/run_vms.py
- name: "Unit testing requirements installation"
run: |
python -m pip install pytest pytest-rerunfailures pytest-cov
- name: "Unit testing"
run: |
unset PYMAPDL_START_INSTANCE
export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
pytest -k "not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
--skip-regression-check \
--cov-report=xml:ubuntu-v22.2.0-local-minimal.xml
- uses: codecov/codecov-action@v3
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }}
root_dir: ${{ github.workspace }}
name: ubuntu-v22.2.0-local-minimal.xml
flags: ubuntu,local,v22.2.0,minimal

- name: 'Upload coverage artifacts'
uses: actions/upload-artifact@v3
with:
name: ubuntu-v22.2.0-local-minimal.xml
path: ./ubuntu-v22.2.0-local-minimal.xml

test-windows:
if: github.repository == ''
name: "Local: Build and unit testing on Windows"
name: "Local: Build & test on Windows"
runs-on: [self-hosted, Windows, pymapdl]
timeout-minutes: 30
env:
Expand Down Expand Up @@ -671,6 +756,7 @@ jobs:
./**/*.tar.gz
./**/*pymapdl-Documentation-*.pdf
./**/ansys-mapdl-core*.zip
./minimum_requirements.txt
- name: Upload to Public PyPi
env:
Expand Down
17 changes: 15 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,21 @@ repos:
hooks:
- id: isort

- repo: https://github.com/numpy/numpydoc
rev: v1.6.0
hooks:
- id: numpydoc-validation
exclude: |
(?x)(
tests/|
examples|
doc/source/|
src/ansys/mapdl/core/_commands|
src/ansys/mapdl/core/commands
)
- repo: https://github.com/psf/black
rev: 23.9.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
rev: 23.10.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
hooks:
- id: black
args:
Expand All @@ -18,7 +31,7 @@ repos:
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.9.1]
additional_dependencies: [black==23.10.1]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
Expand Down
14 changes: 13 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ you can create issues to report bugs and request new features. On the `PyMAPDL D
<https://github.com/ansys/pymapdl/discussions>`_ page or the `Discussions <https://discuss.ansys.com/>`_
page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.

To reach the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
To reach the project support team, email `PyAnsys Core team <pyansys.core@ansys.com>`_.
Unfortunately, this team cannot answer specific library questions or issues. You must
use the `PyMAPDL Issues <https://github.com/ansys/pymapdl/issues>`_
and `PyMAPDL Discussions <https://github.com/ansys/pymapdl/discussions>`_ pages
for raising issues, request new features, and asking questions.

Project transition - legacy support
-----------------------------------
Expand Down Expand Up @@ -110,6 +114,14 @@ Install the latest release from `PyPi
pip install ansys-mapdl-core
If you are planning to use PyMAPDL together with `Jupyter lab <https://jupyter.org/>`_,
you can install both in one step:

.. code:: console
pip install 'ansys-mapdl-core[jupyter]'
Alternatively, install the latest from `PyMAPDL GitHub
<https://github.com/ansys/pymapdl/issues>`_ via:

Expand Down
3 changes: 2 additions & 1 deletion doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Vocab = ANSYS
# Apply the following styles
BasedOnStyles = Vale, Google

TokenIgnores = (:(func|class|meth|attr|py):`(?:.|\n)*?`)|(<.*>)|(.. code::.*\n| .*)
TokenIgnores = (:(func|class|meth|attr|py):`(?:.|\n)*?`)|(<.*>)

# Removing Google-specific rule - Not applicable under some circumstances
Google.Colons = NO
Google.Headings = NO
8 changes: 6 additions & 2 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ help:

# customized clean due to examples gallery
clean:
@echo "Cleaning everything."
rm -rf $(BUILDDIR)/*
rm -rf images/auto-generated
rm -rf source/examples/gallery_examples
find . -type d -name "_autosummary" -exec rm -rf {} +

# customized clean due to examples gallery
clean-except-examples:
@echo "Cleaning everything except the examples."
rm -rf $(BUILDDIR)/*
find . -type d -name "_autosummary" -exec rm -rf {} +

# clean only examples
clean-examples:
@echo "Cleaning only the examples."
rm -rf source/examples/gallery_examples

# customized to build the pdf rather than using latexpdf due to various issues
Expand All @@ -51,6 +54,7 @@ linkcheck:
@echo "Check finished. Report is in $(LINKCHECKDIR)."

html-noexamples:
@$(SPHINXBUILD) -D plot_gallery=0 -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo "Building gallery without running examples."
@$(SPHINXBUILD) -D plot_gallery=0 -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
4 changes: 2 additions & 2 deletions doc/source/api/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Most PyMAPDL tests require a connection to a running instance of
MAPDL, which makes them integration tests. If your test
requires a running MAPDL instance, you can use the PyMAPDL
`mapdl <mapdl_fixture_>`_ method in your function signature.
It will be executed upstream of each test and not within all tests.
It is executed upstream of each test and not within all tests.

.. code:: python
Expand Down Expand Up @@ -160,7 +160,7 @@ Here are some examples of how you use ``pytest``:
def test_dunder_methods_keys(mapdl, basic_components):
assert ["MYCOMP1", "MYCOMP2"] == list(mapdl.components.list())
assert ["MYCOMP1", "MYCOMP2"] == list(mapdl.components.names())
def test_dunder_methods_types(mapdl, basic_components):
Expand Down
3 changes: 3 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"sphinx.ext.graphviz",
"sphinx_reredirects",
"ansys_sphinx_theme.extension.linkcode",
"sphinx_design",
]

# Intersphinx mapping
Expand Down Expand Up @@ -243,6 +244,7 @@
"thumbnail_size": (350, 350),
"remove_config_comments": True,
"default_thumb_file": pyansys_logo_white,
"show_signature": False,
}
# ---

Expand All @@ -258,6 +260,7 @@
"show_breadcrumbs": True,
"collapse_navigation": True,
"use_edit_page_button": True,
"navigation_with_keys": False,
"additional_breadcrumbs": [
("PyAnsys", "https://docs.pyansys.com/"),
],
Expand Down
42 changes: 42 additions & 0 deletions doc/source/examples/devportal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _ref_devportal_examples:


PyMAPDL Developer Portal articles
=================================

In this section, you'll find informative and insightful blog
articles crafted by the expert developers at Ansys and published
in the `Developer Portal <developer_portal_>`_.
Whether you're a seasoned pro or just getting started with PyMAPDL, the blog
articles cover a wide range of topics, from best practices and tips to in-depth
tutorials and real-world use cases. The aim is to provide you with a valuable
resource that can help you harness the full potential of PyMAPDL for your
engineering and simulation needs.

Because the Developer Portal is your hub for all things related to Ansys
products, if you have questions or suggestions, you can go there to
connect to Ansys experts and the growing Ansys developer community.

.. Limiting the amount of lines to 2 at 80 chars
.. grid:: 2
:gutter: 2

.. grid-item-card:: Biomedical catheter design analysis
:img-top: https://developer.ansys.com/sites/default/files/inline-images/BMCatheter_1_0.png
:link: https://developer.ansys.com/blog/biomedical-catheter-design-analysis
:text-align: center
:class-title: pyansys-card-title

Analyzing biomedical catheter flexibility using PyMAPDL scripting to
assess its flexural rigidity in various designs.


.. grid-item-card:: Postprocessing of simplified bolted connections with the help of PyAnsys
:img-top: https://developer.ansys.com/sites/default/files/inline-images/Postprocessing_of_simplified_bolted_connections_with_the_help_of_PyAnsys_image_04.jpg
:link: https://developer.ansys.com/blog/postprocessing-simplified-bolted-connections-help-pyansys
:text-align: center
:class-title: pyansys-card-title

Illustrating PyMAPDL's GUI possibilities for pre-tensioned bolted
connections, adhering to industry standards, and data extraction to Excel
for analysis.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ using this approach (non-tested):
run: |
python rotor.py 4 --density 7000
- name: "Postprocess images"
- name: "Postprocessing images"
run: |
COMPOSITE=/usr/bin/composite
mogrify -mattecolor #f1ce80 -frame 10x10 volume.jpg
Expand Down
Loading

0 comments on commit d103b25

Please sign in to comment.