diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 2f33dc64a..17bbd2f80 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -16,46 +16,45 @@ env: DPF_START_SERVER: False MAIN_PYTHON_VERSION: '3.12' MAPDL_PACKAGE: ghcr.io/ansys/mapdl - MAPDL_IMAGE_VERSION_DOCS_BUILD: v24.2-ubuntu + MAPDL_IMAGE_VERSION_DOCS_BUILD: v25.2-ubuntu-amd ON_CI: True PYANSYS_OFF_SCREEN: True - RESET_EXAMPLES_CACHE: 0 - RESET_DOC_BUILD_CACHE: 0 - USE_CACHE: False concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -permissions: - contents: write - pull-requests: write - packages: read +permissions: {} jobs: - code-style: - name: "Code style" + actions-security: + name: "Action security checks" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - uses: ansys/actions/check-actions-security@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4 with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip tox - - name: Test with tox - run: tox -e style + generate-summary: true + token: ${{ secrets.GITHUB_TOKEN }} + auditing-level: 'high' + trust-ansys-actions: true + + code-style: + name: "Code style checks" + runs-on: ubuntu-latest + steps: + - name: "Run PyAnsys code style checks" + uses: ansys/actions/code-style@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4 doc-style: - name: "Documentation Style Check" + name: "Documentation style check" runs-on: ubuntu-latest + permissions: + contents: read steps: - name: "PyAnsys documentation style checks" - uses: ansys/actions/doc-style@v10 + uses: ansys/actions/doc-style@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -63,9 +62,11 @@ jobs: name: "Documentation building" needs: [code-style, doc-style] timeout-minutes: 60 + permissions: + contents: read outputs: PYMAPDL_VERSION: ${{ steps.version.outputs.PYMAPDL_VERSION }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest env: PYMAPDL_PORT: 21000 # default won't work on GitHub runners PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners @@ -74,10 +75,17 @@ jobs: steps: - name: "Install Git and checkout project" - uses: actions/checkout@v4 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + with: + persist-credentials: false + + - name: "Setup Python without cache" + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} - name: "Login in Github Container registry" - uses: docker/login-action@v3.6.0 + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.actor }} @@ -97,20 +105,13 @@ jobs: - name: "DPF Server Activation" run: | - $(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") & + $(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${DPF_PORT}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${DPF_PORT}.") & - name: "Install OS packages" run: | sudo apt-get update sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk graphviz texlive-xetex libgomp1 - - name: "Set up Python using cache" - uses: actions/setup-python@v5 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - cache: 'pip' - cache-dependency-path: 'requirements/requirements_doc.txt' - - name: "Install Python requirements" run: | pip uninstall ansys-mapdl-core @@ -126,31 +127,13 @@ jobs: echo "PYMAPDL_VERSION=$(python -c 'from ansys.mapdl.core import __version__; print(__version__)')" >> $GITHUB_OUTPUT echo "PyMAPDL version is: $(python -c "from ansys.mapdl.core import __version__; print(__version__)")" - - name: "Cache Verification Manual examples" - uses: actions/cache@v4 - if: env.USE_CACHE == true - with: - path: doc/source/verif-manual - key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }} - restore-keys: | - Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }} - - - name: "Cache docs build directory" - uses: actions/cache@v4 - if: env.USE_CACHE == true - with: - path: doc/_build - key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.PYMAPDL_VERSION }}-${{ github.sha }} - restore-keys: | - doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.PYMAPDL_VERSION }} - - name: "Waiting for the services to be up" timeout-minutes: 15 run: | .ci/waiting_services.sh - name: "Run Ansys documentation building action" - uses: ansys/actions/doc-build@v10 + uses: ansys/actions/doc-build@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4 env: LIBGL_ALWAYS_SOFTWARE: 1 PYANSYS_VISUALIZER_HTML_BACKEND: true @@ -160,19 +143,8 @@ jobs: checkout: false skip-install: true sphinxopts: -j auto - use-python-cache: False check-links: False - - name: "Deploy" - if: contains(github.ref, 'refs/heads/main') - uses: JamesIves/github-pages-deploy-action@v4.7.3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - folder: doc/_build/html - clean: true - single-commit: true - - name: "Display Docker files structures" if: always() env: @@ -190,54 +162,29 @@ jobs: run: | .ci/collect_mapdl_logs.sh - - name: "Tar logs" - if: always() - run: | - cp -f doc/_build/latex/*.log ./logs-build-docs/ - cp log.txt ./logs-build-docs/ - tar cvzf ./logs-build-docs.tgz ./logs-build-docs - - - name: "Upload logs to GitHub" - if: always() - uses: actions/upload-artifact@v4 - with: - name: logs-build-docs.tgz - path: ./logs-build-docs.tgz - - name: "Display MAPDL Logs" if: always() - run: cat log.txt + run: cat logs-build-docs/* || echo "No logs collected." - - name: "List main files" + - name: "Stop MAPDL service" if: always() run: | - if compgen -G 'doc/_build/latex/*.log' > /dev/null ;then for f in doc/_build/latex/*.log; do echo "::group:: Output latex log file $f" && cat $f && echo "::endgroup::" ; done; fi - if compgen -G './logs-build-docs/*.err' > /dev/null ;then for f in ./logs-build-docs/*.err; do echo "::group:: Error file $f" && cat $f && echo "::endgroup::" ; done; fi - if compgen -G './logs-build-docs/*.log' > /dev/null ;then for f in ./logs-build-docs/*.log; do echo "::group:: Log file $f" && cat $f && echo "::endgroup::" ; done; fi - if compgen -G './logs-build-docs/*.out' > /dev/null ;then for f in ./logs-build-docs/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi + echo "Stopping MAPDL services" + pymapdl stop --all - release: - if: github.event_name == 'refs/heads/main' && !contains(github.ref, 'refs/tags') - needs: [doc-build] + + upload-docs: + name: "Upload documentation" + if: github.ref == 'refs/heads/main' && !contains(github.ref, 'refs/tags') runs-on: ubuntu-latest + permissions: + contents: write + needs: [doc-build] steps: - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v5 - - - name: Display structure of downloaded files - run: ls -R - - - name: Zip HTML documentation - uses: vimtor/action-zip@v1.2 - with: - files: documentation-html - dest: documentation-html.zip - - - name: Release - uses: softprops/action-gh-release@v2 + - name: "Deploy documentation to GitHub Pages" + uses: ansys/actions/doc-deploy-dev@c2fa7c93f6883114e0e643599431b33d29f0b13f #v10.1.4 with: - generate_release_notes: true - files: | - ./documentation-html.zip - ./documentation-pdf/*.pdf + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 7e533d8c2..93ae6d501 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -10,19 +10,28 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: label-syncer: - name: Syncer + name: "Syncer" runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - - uses: actions/checkout@v4 - - uses: micnncim/action-label-syncer@v1 + - name: "Install Git and checkout project" + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + with: + persist-credentials: false + - name : "Sync labels" + uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} labeler: - name: Set labels + name: "Set labels" needs: [label-syncer] permissions: contents: read @@ -31,21 +40,23 @@ jobs: steps: # Label based on modified files - - name: Label based on changed files - uses: actions/labeler@v5 + - name: "Label based on changed files" + uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} sync-labels: true # Label based on branch name - - uses: actions-ecosystem/action-add-labels@v1 + - name: "Label based on branch name - docs" + uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3 if: | startsWith(github.event.pull_request.head.ref, 'doc') || startsWith(github.event.pull_request.head.ref, 'docs') with: labels: documentation - - uses: actions-ecosystem/action-add-labels@v1 + - name: "Label based on branch name - maintenance" + uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3 if: | startsWith(github.event.pull_request.head.ref, 'maint') || startsWith(github.event.pull_request.head.ref, 'no-ci') || @@ -53,13 +64,15 @@ jobs: with: labels: maintenance - - uses: actions-ecosystem/action-add-labels@v1 + - name: "Label based on branch name - enhancement" + uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3 if: startsWith(github.event.pull_request.head.ref, 'feat') with: labels: | enhancement - - uses: actions-ecosystem/action-add-labels@v1 + - name: "Label based on branch name - bug" + uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3 if: | startsWith(github.event.pull_request.head.ref, 'fix') || startsWith(github.event.pull_request.head.ref, 'patch') @@ -67,10 +80,14 @@ jobs: labels: bug commenter: + name: "Commenter" runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - - name: Suggest to add labels - uses: peter-evans/create-or-update-comment@v4 + - name: "Suggest to add labels" + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 # Execute only when no labels have been applied to the pull request if: toJSON(github.event.pull_request.labels.*.name) == '{}' with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51cc30559..c61389da2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,20 @@ repos: - repo: https://github.com/ansys/pre-commit-hooks - rev: v0.2.8 + rev: v0.5.2 hooks: - id: add-license-headers args: - --start_year=2022 - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 25.9.0 hooks: - id: black args: ["doc/source/conf.py"] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 7.0.0 hooks: - id: isort args: [ @@ -24,23 +24,23 @@ repos: ] - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v6.0.0 hooks: - id: check-merge-conflict - id: debug-statements - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.21.0 + rev: 0.34.1 hooks: - id: check-github-workflows name: "Check GitHub workflows" diff --git a/doc/source/conf.py b/doc/source/conf.py index 5bcc5eaa6..adf36b288 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,5 @@ """Sphinx documentation configuration file.""" + from datetime import datetime import os diff --git a/examples/tech-demos/21-example-technology-showcase-buckling.py b/examples/tech-demos/21-example-technology-showcase-buckling.py index fdc6eefb4..5b7a74848 100644 --- a/examples/tech-demos/21-example-technology-showcase-buckling.py +++ b/examples/tech-demos/21-example-technology-showcase-buckling.py @@ -227,7 +227,7 @@ ) print("End static prestress analysis") -#%% +# %% ############################################################################### # Run linear buckling analysis # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -263,7 +263,7 @@ ) print("End linear buckling analysis") -#%% +# %% ############################################################################### # Generate imperfections # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -290,7 +290,7 @@ mapdl.finish() print("Finish adding imperfections") -#%% +# %% ############################################################################### # Run nonlinear static analysis on geometry with imperfections # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -320,7 +320,7 @@ print("End nonlinear static analysis on imperfect geometry") -#%% +# %% ############################################################################### # Post-buckling analysis # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -348,7 +348,7 @@ print("End of post-buckling analysis run") -#%% +# %% ############################################################################### # Postprocess buckling analysis in POST1 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -363,7 +363,7 @@ mapdl.post_processing.plot_nodal_eqv_stress(savefig="nodal_stress_post_buckling.png") mapdl.finish() print("End POST1 postprocessing of post-buckling analysis") -#%% +# %% ############################################################################### # Postprocess buckling analysis in POST26 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -426,7 +426,7 @@ print("End POST26 postprocessing of post-buckling analysis") -#%% +# %% ############################################################################### # Exit MAPDL # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/verif-manual/vm-006-pinched_cylinder.py b/examples/verif-manual/vm-006-pinched_cylinder.py index 3f6dfed93..2ee4be303 100644 --- a/examples/verif-manual/vm-006-pinched_cylinder.py +++ b/examples/verif-manual/vm-006-pinched_cylinder.py @@ -97,6 +97,7 @@ def start_prep7(): # ~~~~~~~~~~~~~~~~~~~ # Set up the element type (a shell-type). + # Define the element type number. def define_element(elem_type): # Type of analysis: Static. @@ -143,6 +144,7 @@ def define_element(elem_type): # Define material number. mat_num = 1 + # Define material properties. def define_material(): # Define material properties. @@ -164,6 +166,7 @@ def define_material(): sec_num = 1 t = 0.094 + # Define shell cross-section. def define_section(): # Define shell cross-section. @@ -181,6 +184,7 @@ def define_section(): # ~~~~~~~~~~~~~~~ # Set up the keypoints and create the area through the keypoints. + # Define geometry of the simplified mathematical model. def define_geometry(): # Change active coordinate system @@ -232,6 +236,7 @@ def keypoint_number(mapdl): # ~~~~~~~ # Define line division of the lines, then mesh the area with shell elements. + # Define mesh properties and create the mesh with shell elements. def meshing(): # Specify the default number of line divisions. @@ -275,6 +280,7 @@ def meshing(): # ~~~~~~~~~~~~~~~~~~~~~~~~~~ # Application of symmetric boundary conditions for simplified model. + # Select nodes by location and apply BC. def define_bc(): # Select nodes by location and apply BC. @@ -295,6 +301,7 @@ def define_bc(): # ~~~~~~~~~~~~~~~~~~~~~~~~ # Apply the force of :math:`F = (100/4) lb` in the y-direction. + # Define loads. def define_loads(): # Parametrization of the :math:`F` load for the quarter of the model. @@ -331,6 +338,7 @@ def solve_procedure(): # Plotting nodal displacement. # Get the the radial displacement at the node where force F is applied. + # Start post-processing mode. def post_processing(): mapdl.post1() diff --git a/examples/verif-manual/vm-007-plastic_compression_of_a_pipe_assembly.py b/examples/verif-manual/vm-007-plastic_compression_of_a_pipe_assembly.py index 6939283ef..890974f84 100644 --- a/examples/verif-manual/vm-007-plastic_compression_of_a_pipe_assembly.py +++ b/examples/verif-manual/vm-007-plastic_compression_of_a_pipe_assembly.py @@ -438,6 +438,7 @@ # Start solution procedure. mapdl.slashsolu() + # Define solution function. def solution(deflect): mapdl.nsel("R", "LOC", "Z", 10) @@ -583,7 +584,9 @@ def getload(): row_indexing = pd.MultiIndex.from_tuples(row_tuple) df = pd.DataFrame(main_columns, index=row_indexing) -df.style.set_caption("Results Comparison",).set_table_styles( +df.style.set_caption( + "Results Comparison", +).set_table_styles( [ { "selector": "th.col_heading", diff --git a/examples/verif-manual/vm-299.py b/examples/verif-manual/vm-299.py index fcdc95a04..63ab58e80 100644 --- a/examples/verif-manual/vm-299.py +++ b/examples/verif-manual/vm-299.py @@ -275,7 +275,7 @@ SPL_4 = 10 * (math.log10(x4)) SPL_5 = 10 * (math.log10(x5)) -# Fill the target tesult values in array +# Fill the target result values in array target_ref = np.array([80.0, 79.0, 77.5, 76.0, 74.5]) # Fill the simulated result values in array diff --git a/examples/verif-manual/vm-nr1677-01-1a.py b/examples/verif-manual/vm-nr1677-01-1a.py index df89b89dd..e5df04410 100644 --- a/examples/verif-manual/vm-nr1677-01-1a.py +++ b/examples/verif-manual/vm-nr1677-01-1a.py @@ -499,8 +499,8 @@ # Print table print( - f"""------------------- VM-NR1677-01-1-a.1 RESULTS COMPARISON --------------------- -{tabulate(data_freq, headers=headers, tablefmt="grid")} + f"""------------------- VM-NR1677-01-1-a.1 RESULTS COMPARISON --------------------- +{tabulate(data_freq, headers=headers, tablefmt="grid")} """ ) @@ -543,8 +543,8 @@ # Print table print( - f""" -{tabulate(data_freq, headers=headers, tablefmt="grid")} + f""" +{tabulate(data_freq, headers=headers, tablefmt="grid")} """ ) diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt index 782a52eb3..01cd01f6a 100644 --- a/requirements/requirements_doc.txt +++ b/requirements/requirements_doc.txt @@ -1,2 +1,2 @@ -#PyMAPDL dependencies and documentation requirements +# PyMAPDL dependencies and documentation requirements git+https://github.com/ansys/pymapdl.git#egg=ansys-mapdl-core[graphics,doc]