Skip to content

Commit

Permalink
Merge branch 'main' into release/0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 committed Jan 19, 2022
2 parents a5fad1c + b44ed39 commit 0772182
Show file tree
Hide file tree
Showing 56 changed files with 2,270 additions and 1,531 deletions.
80 changes: 43 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
description: 'Test scenario tags'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Expand All @@ -32,6 +32,15 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2

# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -51,44 +60,41 @@ jobs:
pip install -r requirements.txt
pip install -r requirements_docs.txt
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
#if: startsWith(github.event.ref, 'refs/heads/main') != true
- name: 'Create Documentations'

- name: 'Create Documentations'
run: |
testenv\Scripts\Activate.ps1
sphinx-build -j auto -b html -a doc/source doc/_build/html
- name: ' Deploy on aedtdocs.pyansys.com'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
working-directory: doc/_build/html
run: |
git init
git checkout -b master
git config --local user.name "maxcapodi78"
git config --local user.email "[email protected]"
New-Item -ItemType file .nojekyll
New-Item -ItemType file CNAME
Add-Content CNAME "aedtdocs.pyansys.com"
git add .
git commit -m "Documentation generated by PyAedt Build"
git remote add origin https://${{ secrets.PYAEDT_DOCS }}@github.com/pyansys/PyAEDT-docs
git push -u origin master --force
- name: Upload Documentation
id: upload
uses: actions/[email protected]
with:
name: Documentation
path: doc/_build/html
retention-days: 7

#- name: Upload Documentation
# uses: actions/[email protected]
# with:
# name: Documentation
# path: doc/_build/html
# retention-days: 7
- name: Deploy
continue-on-error: true
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: JamesIves/[email protected]
with:
repository-name: pyansys/pyaedt-docs
branch: master
folder: doc/_build/html/
token: ${{ steps.get_workflow_token.outputs.token }}
clean: true

#- name: Deploy
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# uses: JamesIves/[email protected]
# with:
# repository-name: pyansys/pyaedt-docs
# branch: master
# folder: doc/_build/html/
# token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
# clean: true
# Retry the deployment in case some network issue prevented git to push
# the modifications properly. It happened in the past.
- name: Deploy Second try
if: steps.deploy.outcome!='success' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: JamesIves/[email protected]
with:
repository-name: pyansys/pyaedt-docs
branch: master
folder: doc/_build/html/
token: ${{ steps.get_workflow_token.outputs.token }}
clean: true
86 changes: 47 additions & 39 deletions .github/workflows/nightly-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ jobs:
steps:
- uses: actions/checkout@v2

# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}

- name: Setup Python
uses: actions/[email protected]
with:
Expand Down Expand Up @@ -42,45 +50,45 @@ jobs:
uses: JamesIves/[email protected]
with:
repository-name: pyansys/pyaedt-dev-docs
branch: gh-pages
branch: master
folder: doc/_build/html/
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
token: ${{ steps.get_workflow_token.outputs.token }}
clean: true

docstring_testing:
runs-on: Windows

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: 'Create virtual env'
run: |
python -m venv testenv
testenv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: 'Install pyaedt'
run: |
testenv\Scripts\Activate.ps1
pip install . --use-feature=in-tree-build
cd _unittest
python -c "import pyaedt; print('Imported pyaedt')"
- name: Install testing requirements
run: |
testenv\Scripts\Activate.ps1
pip install -r requirements_test.txt
pip install pytest-azurepipelines
- name: Docstring testing
run: |
testenv\Scripts\Activate.ps1
pytest -v pyaedt/desktop.py pyaedt/icepak.py
pytest -v pyaedt/desktop.py pyaedt/hfss.py
# docstring_testing:
# runs-on: Windows

# steps:
# - uses: actions/checkout@v2

# - name: Setup Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.8

# - name: 'Create virtual env'
# run: |
# python -m venv testenv
# testenv\Scripts\Activate.ps1
# python -m pip install pip -U
# python -m pip install wheel setuptools -U
# python -c "import sys; print(sys.executable)"

# - name: 'Install pyaedt'
# run: |
# testenv\Scripts\Activate.ps1
# pip install . --use-feature=in-tree-build
# cd _unittest
# python -c "import pyaedt; print('Imported pyaedt')"

# - name: Install testing requirements
# run: |
# testenv\Scripts\Activate.ps1
# pip install -r requirements_test.txt
# pip install pytest-azurepipelines

# - name: Docstring testing
# run: |
# testenv\Scripts\Activate.ps1
# pytest -v pyaedt/desktop.py pyaedt/icepak.py
# pytest -v pyaedt/desktop.py pyaedt/hfss.py
1 change: 1 addition & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
pip install . --use-feature=in-tree-build
pip install -r requirements_test.txt
pip install pytest-azurepipelines
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
mkdir tmp
cd tmp
python -c "import pyaedt; print('Imported pyaedt')"
Expand Down
20 changes: 17 additions & 3 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ def test_07_vias_creation(self):
assert self.edbapp.core_padstack.place_padstack(["via_x", "via_x+via_y"], "myVia")
assert self.edbapp.core_padstack.place_padstack(["via_x", "via_x+via_y*2"], "myVia_bullet")

padstack_id = self.edbapp.core_padstack.place_padstack(["via_x", "via_x+via_y*3"], "myVia", is_pin=True)
padstack_instance = self.edbapp.core_padstack.padstack_instances[padstack_id]
assert padstack_instance.is_pin
assert padstack_instance.position
assert isinstance(padstack_instance.rotation, float)

def test_08_nets_query(self):
signalnets = self.edbapp.core_nets.signal_nets
powernets = self.edbapp.core_nets.power_nets
Expand Down Expand Up @@ -564,12 +570,20 @@ def test_70_plot_on_matplotlib(self):
def test_71_fix_circle_voids(self):
assert self.edbapp.core_primitives.fix_circle_void_for_clipping()

def test_72_vias_creation(self):
via_list = self.edbapp.core_padstack.get_padstack_instance_by_net_name("GND")
assert len(via_list)
def test_72_padstack_instance(self):
padstack_instances = self.edbapp.core_padstack.get_padstack_instance_by_net_name("GND")
assert len(padstack_instances)
padstack_1 = list(padstack_instances.values())[0]
assert padstack_1.id

def test_73_duplicate_padstack(self):
self.edbapp.core_padstack.duplicate_padstack(
target_padstack_name="VIA_20-10-28_SMB", new_padstack_name="VIA_20-10-28_SMB_NEW"
)
assert self.edbapp.core_padstack.padstacks["VIA_20-10-28_SMB_NEW"]

def test74_set_padstack_property(self):
self.edbapp.core_padstack.set_pad_property(
padstack_name="VIA_18-10-28_SMB", layer_name="new", pad_shape="Circle", pad_params="800um"
)
assert self.edbapp.core_padstack.padstacks["VIA_18-10-28_SMB"].pad_by_layer["new"]
14 changes: 12 additions & 2 deletions _unittest/test_02_2D_modeler.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# standard imports
import math
import os

from pyaedt.generic.general_methods import isclose
from pyaedt.generic.general_methods import isclose, is_ironpython
from pyaedt.maxwell import Maxwell2d

# Setup paths for module imports
from _unittest.conftest import BasisTest, desktop_version
from _unittest.conftest import BasisTest, desktop_version, config

try:
import pytest # noqa: F401
Expand Down Expand Up @@ -120,3 +121,12 @@ def test_create_regular_polygon(self):
assert pg2.model
assert pg2.material_name == "copper"
assert isclose(pg2.faces[0].area, 5.196152422706631)

@pytest.mark.skipif(config["build_machine"] or is_ironpython, reason="Not running in ironpython")
def test_plot(self):
self.aedtapp.modeler.primitives.create_regular_polygon([0, 0, 0], [0, 2, 0])
self.aedtapp.modeler.primitives.create_regular_polygon(
position=[0, 0, 0], start_point=[0, 2, 0], num_sides=3, name="MyPolygon", matname="Copper"
)
obj = self.aedtapp.plot(show=False, export_path=os.path.join(self.local_scratch.path, "image.jpg"))
assert os.path.exists(obj.image_file)
20 changes: 13 additions & 7 deletions _unittest/test_03_Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,12 @@ def test_02_create_material(self):
assert mat1.diffusivity.value == MatProperties.get_defaultvalue(aedtname="diffusivity")

assert "Electromagnetic" in mat1.physics_type
mat1.core_loss_kc.value = MatProperties.get_defaultvalue(aedtname="core_loss_kc")
mat1.core_loss_kh.value = MatProperties.get_defaultvalue(aedtname="core_loss_kh")
mat1.core_loss_ke.value = MatProperties.get_defaultvalue(aedtname="core_loss_ke")
mat1.molecular_mass.value = MatProperties.get_defaultvalue(aedtname="molecular_mass")
mat1.specific_heat.value = MatProperties.get_defaultvalue(aedtname="specific_heat")
mat1.thermal_expansion_coefficient.value = MatProperties.get_defaultvalue(
aedtname="thermal_expansion_coefficient"
)

assert mat1.core_loss_kc.value == MatProperties.get_defaultvalue(aedtname="core_loss_kc")
assert mat1.core_loss_kh.value == MatProperties.get_defaultvalue(aedtname="core_loss_kh")
assert mat1.core_loss_ke.value == MatProperties.get_defaultvalue(aedtname="core_loss_ke")
assert mat1.coordinate_system == "Cartesian"
assert mat1.name == "new_copper2"
assert mat1.molecular_mass.value == MatProperties.get_defaultvalue(aedtname="molecular_mass")
Expand All @@ -78,7 +72,19 @@ def test_02_create_material(self):
assert self.aedtapp.change_validation_settings()
assert self.aedtapp.change_validation_settings(ignore_unclassified=True, skip_intersections=True)

assert mat1.material_appearance == [128, 128, 128]
assert mat1.set_magnetic_coercitivity(1, 2, 3, 4)
assert mat1.get_magnetic_coercitivity() == ("1A_per_meter", "2", "3", "4")
assert mat1.set_electrical_steel_coreloss(1, 2, 3, 4, 0.002)
assert mat1.get_curve_coreloss_type() == "Electrical Steel"
assert mat1.get_curve_coreloss_values()["core_loss_equiv_cut_depth"] == "0.002meter"
assert mat1.set_hysteresis_coreloss(1, 2, 3, 4, 0.002)
assert mat1.get_curve_coreloss_type() == "Hysteresis Model"
assert mat1.set_bp_curve_coreloss([[0, 0], [10, 10], [20, 20]])
assert mat1.get_curve_coreloss_type() == "B-P Curve"
assert mat1.set_power_ferrite_coreloss()
assert mat1.get_curve_coreloss_type() == "Power Ferrite"
assert isinstance(mat1.material_appearance, list)

mat1.material_appearance = [11, 22, 0]
assert mat1.material_appearance == [11, 22, 0]
mat1.material_appearance = ["11", "22", "10"]
Expand Down
Loading

0 comments on commit 0772182

Please sign in to comment.