Skip to content

Commit

Permalink
Merge branch 'master' into doc/new-tutorials-section
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi authored Nov 25, 2024
2 parents 97f32dc + 22f0d8d commit 1dd2cdb
Show file tree
Hide file tree
Showing 795 changed files with 4,637 additions and 4,468 deletions.
77 changes: 2 additions & 75 deletions .ci/code_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,9 @@
import os
import glob
from pathlib import Path
import time
import shutil


core.set_default_server_context(core.AvailableServerContexts.premium)

if os.name == "posix":
LIB_TO_GENERATE = [
"libAns.Dpf.Native.so",
"libAns.Dpf.FEMutils.so",
"libmapdlOperatorsCore.so",
"libmeshOperatorsCore.so",
"libAns.Dpf.Math.so",
"libAns.Dpf.Hdf5.so",
"libAns.Dpf.LSDYNAHGP.so",
"libAns.Dpf.LivePost.so",
"libans.dpf.pointcloudsearch.so",
"libAns.Dpf.Vtk.so",
"libAns.Dpf.MechanicalResults.so",
]
LIB_OPTIONAL_TO_GENERATE = [
"libAns.Dpf.SystemCouplingMapping.so",
]
else:
LIB_TO_GENERATE = [
"Ans.Dpf.Native.dll",
"Ans.Dpf.FEMutils.dll",
"meshOperatorsCore.dll",
"mapdlOperatorsCore.dll",
"Ans.Dpf.Math.dll",
"Ans.Dpf.PythonPluginWrapper.dll",
"Ans.Dpf.Hdf5.dll",
"Ans.Dpf.FlowDiagram.dll",
"Ans.Dpf.LSDYNAHGP.dll",
"Ans.Dpf.LivePost.dll",
"Ans.Dpf.PointCloudSearch.dll",
"Ans.Dpf.Vtk.dll",
"Ans.Dpf.MechanicalResults.dll",
]
LIB_OPTIONAL_TO_GENERATE = [
"Ans.Dpf.SystemCouplingMapping.dll",
]

local_dir = os.path.dirname(os.path.abspath(__file__))
TARGET_PATH = os.path.join(local_dir, os.pardir, "src", "ansys", "dpf", "core", "operators")
files = glob.glob(os.path.join(TARGET_PATH, "*"))
Expand All @@ -65,41 +25,8 @@
os.remove(f)
except:
pass
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
code_gen = core.Operator("python_generator")
code_gen.connect(1, TARGET_PATH)
for lib in LIB_TO_GENERATE:
try:
code_gen.connect(0, lib)
if lib != LIB_TO_GENERATE[0]:
code_gen.connect(2, False)
else:
code_gen.connect(2, True)
print(f"Generating {lib} operators for server {core.SERVER.version}...")
code_gen.run()
time.sleep(0.1)
except Exception as e:
print(f"Could not generate operators for library {lib}:\n{str(e)}")
raise e

for lib in LIB_OPTIONAL_TO_GENERATE:
try:
code_gen.connect(0, lib)
if lib != LIB_OPTIONAL_TO_GENERATE[0]:
code_gen.connect(2, False)
else:
code_gen.connect(2, True)
print(f"Generating optional {lib} operators for server {core.SERVER.version}...")
code_gen.run()
time.sleep(0.1)
except Exception as e:
print(f"Could not generate operators for optional library {lib}:\n{str(e)}")

# Reorder imports alphabetically in __init__.py files to reduce changes raised
for init_file_path in glob.glob(os.path.join(TARGET_PATH, "**/__init__.py"), recursive=True):
with open(init_file_path, "r") as init_file:
lines = init_file.readlines()
with open(init_file_path, "w") as init_file:
init_file.writelines(sorted(lines))
core.set_default_server_context(core.AvailableServerContexts.premium)
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)

build.build_operators()
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ body:
label: Which DPF/Ansys version are you using?
multiple: true
options:
- 'DPF Server 2025.2.pre0'
- 'Ansys 2025 R1'
- 'DPF Server 2025.1.pre0'
- 'Ansys 2024 R2'
- 'DPF Server 2024.2.pre1'
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/examples.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🎓 Adding an example
description: Proposing a new example for the library
title: "Example proposal: ..."
labels: ["example"]
labels: ["examples"]
assignees: [""]

body:
Expand Down
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/tutorial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 🎓 Adding a tutorial
description: Proposing a new tutorial for the library
title: "Tutorial proposal: ..."
labels: ["tutorials"]
assignees: [""]

body:

- type: textarea
id: tutorial-description
attributes:
label: '📝 Description of the tutorial'
placeholder: Describe what tutorial you devised and why it is useful for the project.

validations:
required: true
46 changes: 21 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
description: "ANSYS version"
required: false
type: string
default: "251"
default: "252"
standalone_branch_suffix:
description: 'Suffix of the branch on standalone'
required: false
Expand All @@ -28,8 +28,6 @@ concurrency:
env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.9'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}

jobs:
debug:
Expand Down Expand Up @@ -107,7 +105,7 @@ jobs:
uses: ./.github/workflows/tests.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
Expand All @@ -118,7 +116,7 @@ jobs:
uses: ./.github/workflows/tests.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
Expand All @@ -131,7 +129,7 @@ jobs:
uses: ./.github/workflows/test_docker.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

Expand All @@ -140,7 +138,7 @@ jobs:
uses: ./.github/workflows/examples_docker.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
python_versions: '["3.9"]'
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit
Expand All @@ -150,7 +148,7 @@ jobs:
uses: ./.github/workflows/docs.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
event_name: ${{ github.event_name }}
secrets: inherit
Expand All @@ -167,32 +165,30 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true

doc-index-dev:
name: "Deploy dev index docs"
runs-on: ubuntu-latest
needs: upload-development-docs
steps:
- name: "Deploy the latest documentation index"
uses: ansys/actions/doc-deploy-index@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev
index-name: pydpf-core-vdev
host-url: ${{ vars.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

examples:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/examples.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
python_versions: '["3.9"]'
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

retro_251:
name: "retro 251"
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/tests.yml
with:
ANSYS_VERSION: "251"
python_versions: '["3.9"]'
DOCSTRING: false
standalone_suffix: ''
secrets: inherit

retro_242:
name: "retro 242"
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
Expand Down Expand Up @@ -252,7 +248,7 @@ jobs:
uses: ./.github/workflows/pydpf-post.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '252' }}
post_branch: "master"
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
test_docstrings: "true"
Expand Down
33 changes: 27 additions & 6 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,43 @@ jobs:
name: ${{ steps.wheel.outputs.wheel_name }}
path: dist/${{ steps.wheel.outputs.wheel_name }}

tests_3_9:
uses: ./.github/workflows/tests.yml
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
python_versions: '["3.9"]'
wheel: true
wheelhouse: true
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
secrets: inherit

tests:
uses: ./.github/workflows/tests.yml
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
python_versions: '["3.9", "3.10", "3.11"]'
wheel: ${{ matrix.python-version == '3.9' }}
python_versions: '["3.10", "3.11"]'
wheel: false
wheelhouse: true
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
secrets: inherit

tests_any_3_9:
uses: ./.github/workflows/tests.yml
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
test_any: true
secrets: inherit

tests_any:
uses: ./.github/workflows/tests.yml
with:
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
python_versions: '["3.9", "3.10", "3.11"]'
wheel: ${{ matrix.python-version == '3.9' }}
python_versions: '["3.10", "3.11"]'
wheel: false
wheelhouse: false
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
test_any: true
Expand Down Expand Up @@ -211,11 +232,11 @@ jobs:
draft_release:
name: "Draft Release"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [style, tests, docs, examples, retro_232, retro_231, retro_222, docker_tests]
needs: [style, tests, tests_3_9, tests_any, tests_any_3_9, docs, examples, retro_232, retro_231, retro_222, docker_tests]
runs-on: ubuntu-latest
steps:
- name: "Download artifacts"
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: "Display downloaded files"
run: ls -R
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
python_version:
required: false
type: string
default: "3.9"
default: "3.10"
ANSYS_VERSION:
required: false
type: string
Expand All @@ -29,7 +29,7 @@ on:
description: "Python interpreter"
required: true
type: string
default: "3.9"
default: "3.10"
ANSYS_VERSION:
description: "ANSYS version"
required: true
Expand Down
42 changes: 2 additions & 40 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ on:
description: 'Release tag'
default: 'latest'
type: string
checkout_ref:
description: 'Ref to checkout for doc index (default to current branch)'
default: ''
type: string

env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}

jobs:

Expand Down Expand Up @@ -95,40 +89,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true

doc-index-stable:
name: "Deploy stable docs index"
runs-on: ubuntu-latest
needs: upload_docs_release
steps:
- name: "Install Git and clone project"
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.checkout_ref || '' }}

- name: "Install the package requirements"
run: |
python3 -m venv .venv
.venv/bin/python -m pip install -e .
- name: "Get the version to PyMeilisearch"
run: |
VERSION=$(.venv/bin/python -c "from ansys.dpf.core import __version__; print('.'.join(__version__.split('.')[:2]))")
VERSION_MEILI=$(.venv/bin/python -c "from ansys.dpf.core import __version__; print('-'.join(__version__.split('.')[:2]))")
echo "Calculated VERSION: $VERSION"
echo "Calculated VERSION_MEILI: $VERSION_MEILI"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV
- name: "Deploy the latest documentation index"
uses: ansys/actions/doc-deploy-index@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }}
index-name: pydpf-core-v${{ env.VERSION_MEILI }}
host-url: ${{ vars.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

update_ansys_lab_examples:
uses: ./.github/workflows/ansys_lab.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
echo "wheel_name=${name[0]}" >> $GITHUB_OUTPUT
- name: "Upload wheel to artifacts"
if: (inputs.wheel == 'true') && !(inputs.test_any && (matrix.os == 'ubuntu-latest') )
if: (inputs.wheel == 'true') && !( (inputs.test_any == 'true') && (matrix.os == 'ubuntu-latest') )
uses: actions/upload-artifact@v4
with:
name: ${{ steps.wheel.outputs.wheel_name }}
Expand Down
Loading

0 comments on commit 1dd2cdb

Please sign in to comment.