Skip to content

Commit

Permalink
Merge branch 'main' into release/0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 authored and maxcapodi78 committed Nov 17, 2022
2 parents 5fe82a9 + 57f3ca6 commit 39ca490
Show file tree
Hide file tree
Showing 29 changed files with 1,274 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ name: Documentation Build

on: [pull_request, workflow_dispatch]

env:
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_EXAMPLES_CACHE: 3
RESET_DOC_BUILD_CACHE: 3
RESET_AUTOSUMMARY_CACHE: 3


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -43,6 +54,27 @@ jobs:
- name: Verify pyaedt can be imported
run: python -c "import pyaedt"

- name: Retrieve PyAEDT version
id: version
run: |
echo "::set-output name=PYAEDT_VERSION::$(python -c "from pyaedt import __version__; print(__version__)")"
echo "PyAEDT version is: $(python -c "from pyaedt import __version__; print(__version__)")"
- name: Cache docs build directory
uses: actions/cache@v3
with:
path: doc/build
key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.PYAEDT_VERSION }}-${{ github.sha }}
restore-keys: |
doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.PYAEDT_VERSION }}
- name: Cache autosummary
uses: actions/cache@v3
with:
path: doc/source/**/_autosummary/*.rst
key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.PYAEDT_VERSION }}-${{ github.sha }}
restore-keys: |
autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.PYAEDT_VERSION }}
- name: Install doc build requirements
run: |
pip install -r requirements_docs.txt
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/cpython_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Linux_CPython_UnitTests

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Linux CPython daily'
schedule: # UTC at 0100
- cron: '0 1 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: [Linux, pyaedt]
steps:
- uses: actions/checkout@v3

- name: 'Install pyaedt'
run: |
python -m venv .pyaedt_test_env
source .pyaedt_test_env/bin/activate
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
pip install .
pip install -r requirements_test.txt
pip install pytest-azurepipelines
cp "C:\actions-runner\opengl32.dll" "testenv\Lib\site-packages\vtkmodules"
mkdir tmp
cd tmp
python -c "import pyaedt; print('Imported pyaedt')"
- name: 'Unit testing'
run: |
testenv\Scripts\Activate.ps1
pytest -n 4 --dist loadfile -v --cov=pyaedt --cov=_unittest --cov-config=.coveragerc --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest -p no:faulthandler
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results
path: junit/test-results.xml
if: ${{ always() }}
28 changes: 27 additions & 1 deletion .github/workflows/full_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
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
Expand Down Expand Up @@ -123,9 +123,35 @@ jobs:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v3

# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
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@v4
with:
python-version: ${{ matrix.python-version }}

- name: 'Install requirements'
run: |
python -m venv jsondoc
jsondoc\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
pip install -r requirements.txt
pip install -r requirements_docs.txt
- name: Build json documentation
run: |
# Export the documentation files to JSON files.
jsondoc\Scripts\Activate.ps1
sphinx-build -M json doc/source doc-json -j auto -D release=${{ steps.version.outputs.PYAEDT_VERSION }} -D version=${{ steps.version.outputs.PYAEDT_VERSION }}; -w build_errors.txt -N;
- name: Flatten the generated nested files into a single directory
Expand Down
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,36 @@ exclude: |
pyaedt/conftest.py|
_unittest/example_models/
)
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
args:
- --line-length=120

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
args: ['--force-single-line-imports', '--profile', 'black']
- repo: https://gitlab.com/PyCQA/flake8
rev: 3.9.2

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args:
- --max-line-length=120

- repo: https://github.com/codespell-project/codespell
rev: v2.2.1
rev: v2.2.2
hooks:
- id: codespell
args: ["--ignore-words=ignore_words.txt"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: requirements-txt-fixer
- id: requirements-txt-fixer
Binary file not shown.
94 changes: 85 additions & 9 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def setup_class(self):
example_project2 = os.path.join(local_path, "example_models", test_subfolder, "simple.aedb")
self.target_path2 = os.path.join(self.local_scratch.path, "simple_00.aedb")
self.local_scratch.copyfolder(example_project2, self.target_path2)
example_project3 = os.path.join(local_path, "example_models", test_subfolder, "Galileo_edb_plot.aedb")
self.target_path3 = os.path.join(self.local_scratch.path, "Galileo_edb_plot_00.aedb")
self.local_scratch.copyfolder(example_project3, self.target_path3)

def teardown_class(self):
self.edbapp.close_edb()
Expand Down Expand Up @@ -159,6 +162,9 @@ def test_07_vias_creation(self):
padstack_instance = self.edbapp.core_padstack.padstack_instances[padstack_id]
assert padstack_instance.is_pin
assert padstack_instance.position
if not is_ironpython:
assert padstack_instance.start_layer in padstack_instance.layer_range_names
assert padstack_instance.stop_layer in padstack_instance.layer_range_names
padstack_instance.position = [0.001, 0.002]
assert padstack_instance.position == [0.001, 0.002]
assert padstack_instance.parametrize_position()
Expand Down Expand Up @@ -377,6 +383,11 @@ def test_38_create_voltage_source(self):
)
pins = self.edbapp.core_components.get_pin_from_component("U2A5")
assert "VSource_" in self.edbapp.core_siwave.create_voltage_source_on_pin(pins[300], pins[10], 3.3, 0)
if not is_ironpython:
assert len(self.edbapp.sources) > 0
assert len(self.edbapp.probes) == 0
assert list(self.edbapp.sources.values())[0].magnitude == 3.3
assert list(self.edbapp.sources.values())[0].phase == 0

def test_39_create_current_source(self):
assert self.edbapp.core_siwave.create_current_source_on_net("U2A5", "DDR3_DM1", "U2A5", "GND", 0.1, 0) != ""
Expand Down Expand Up @@ -574,7 +585,13 @@ def test_55b_create_cutout(self):
self.local_scratch.copyfolder(source_path, target_path)
edbapp = Edb(target_path, edbversion=desktop_version)
output = os.path.join(self.local_scratch.path, "cutout.aedb")
assert edbapp.create_cutout(["A0_N", "A0_P"], ["GND"], output_aedb_path=output, open_cutout_at_end=False)
assert edbapp.create_cutout(
["A0_N", "A0_P"],
["GND"],
output_aedb_path=output,
open_cutout_at_end=False,
use_pyaedt_extent_computing=True,
)
assert edbapp.create_cutout(
["A0_N", "A0_P"],
["GND"],
Expand Down Expand Up @@ -646,11 +663,28 @@ def test_55d_create_custom_cutout(self):
signal_list=["V3P3_S0"],
reference_list=["GND"],
number_of_threads=4,
extent_type="Bounding",
extent_type="ConvexHull",
custom_extent=points,
)
edbapp.close_edb()

@pytest.mark.skipif(is_ironpython, reason="Method works in CPython only")
def test_55e_create_custom_cutout(self):
source_path = os.path.join(local_path, "example_models", test_subfolder, "Galileo.aedb")
target_path = os.path.join(self.local_scratch.path, "Galileo_cutout_4.aedb")
self.local_scratch.copyfolder(source_path, target_path)

edbapp = Edb(target_path, edbversion=desktop_version)

assert edbapp.create_cutout_multithread(
signal_list=["V3P3_S0"],
reference_list=["GND"],
number_of_threads=4,
extent_type="ConvexHull",
use_pyaedt_extent_computing=True,
)
edbapp.close_edb()

def test_56_rvalue(self):
assert resistor_value_parser("100meg")

Expand Down Expand Up @@ -772,14 +806,39 @@ def test_67_add_void(self):
def test_69_create_solder_balls_on_component(self):
assert self.edbapp.core_components.set_solder_ball("U2A5")

@pytest.mark.skipif(
is_ironpython,
reason="This test uses Matplotlib, which is not supported by IronPython.",
)
@pytest.mark.skipif(is_ironpython, reason="This test uses Matplotlib, which is not supported by IronPython.")
def test_70_plot_on_matplotlib(self):
local_png = os.path.join(self.local_scratch.path, "test.png")
self.edbapp.core_nets.plot(None, None, save_plot=local_png)
assert os.path.exists(local_png)
edb_plot = Edb(self.target_path3, edbversion=desktop_version)
local_png1 = os.path.join(self.local_scratch.path, "test1.png")
edb_plot.core_nets.plot(
nets=None,
layers=None,
save_plot=local_png1,
plot_components_on_top=True,
plot_components_on_bottom=True,
outline=[[-10e-3, -10e-3], [110e-3, -10e-3], [110e-3, 70e-3], [-10e-3, 70e-3]],
)
assert os.path.exists(local_png1)

local_png2 = os.path.join(self.local_scratch.path, "test2.png")
edb_plot.core_nets.plot(
nets="V3P3_S5",
layers=None,
save_plot=local_png2,
plot_components_on_top=True,
plot_components_on_bottom=True,
)
assert os.path.exists(local_png2)
local_png3 = os.path.join(self.local_scratch.path, "test3.png")
edb_plot.core_nets.plot(
nets=["LVL_I2C_SCL", "V3P3_S5", "GATE_V5_USB"],
layers="TOP",
color_by_net=True,
save_plot=local_png3,
plot_components_on_top=True,
plot_components_on_bottom=True,
)
assert os.path.exists(local_png3)

def test_71_fix_circle_voids(self):
assert self.edbapp.core_primitives.fix_circle_void_for_clipping()
Expand Down Expand Up @@ -2123,6 +2182,7 @@ def test_A118_edb_create_port(self):
["-40mm", "-10.2mm"],
horizontal_extent_factor=8,
)
assert not edb.are_port_reference_terminals_connected()
edb.close_edb()

def test_A119_insert_layer(self):
Expand Down Expand Up @@ -2478,6 +2538,19 @@ def test_128B_build_project(self):
sim_setup.step_freq = 10e6
sim_setup.use_default_cutout = False
assert edbapp.build_simulation_project(sim_setup)
assert edbapp.are_port_reference_terminals_connected()
port1 = list(edbapp.excitations.values())[0]
assert port1.magnitude == 0.0
assert port1.phase == 0
assert port1.reference_net_name == "GND"
assert not port1.deembed
assert port1.impedance == 50.0
assert port1.deembed_length == 0
assert not port1.is_circuit
assert not port1.renormalize
assert port1.renormalize_z0 == (50.0, 0.0)
assert not port1.get_pin_group_terminal_reference_pin()
assert not port1.get_pad_edge_terminal_reference_pin()

def test_129_get_component_bounding_box(self):
target_path = os.path.join(local_path, "example_models", test_subfolder, "Galileo.aedb")
Expand All @@ -2487,3 +2560,6 @@ def test_129_get_component_bounding_box(self):
component = edbapp.core_components.components["U2A5"]
assert component.bounding_box
assert isinstance(component.rotation, float)

def test_130_eligible_power_nets(self):
assert "GND" in [i.name for i in self.edbapp.core_nets.eligible_power_nets]
3 changes: 3 additions & 0 deletions _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ def test_30_object_oriented(self):
def test_31_make_hidden_variable(self):
self.aedtapp["my_hidden_variable"] = "15mm"
assert self.aedtapp.hidden_variable("my_hidden_variable")
self.aedtapp.hidden_variable("my_hidden_variable", False)
assert self.aedtapp.hidden_variable(["my_oo_variable", "$dim", "my_hidden_variable"])
self.aedtapp.hidden_variable(["my_oo_variable", "$dim"], False)

def test_32_make_read_only_variable(self):
self.aedtapp["my_read_only_variable"] = "15mm"
Expand Down
1 change: 1 addition & 0 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ def test_09l_add_note(self): # pragma: no cover

def test_10_delete_report(self):
assert self.aedtapp.post.delete_report("MyNewScattering")
assert self.aedtapp.post.delete_report()

def test_12_steal_on_focus(self):
assert self.aedtapp.post.steal_focus_oneditor()
Expand Down
4 changes: 4 additions & 0 deletions doc/source/API/CoreEdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ These classes are the containers of data read from the EDB file:
primitives_data.EDBPrimitives
simulation_configuration.SiwaveDCSetupTemplate
simulation_configuration.SimulationConfiguration
sources.ExcitationPorts
sources.ExcitationProbes
sources.ExcitationSources
sources.ExcitationDifferential


.. code:: python
Expand Down
Loading

0 comments on commit 39ca490

Please sign in to comment.