diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 8d101f3ce6c..a02304ff70a 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -332,7 +332,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -343,7 +342,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] @@ -360,7 +358,6 @@ jobs: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pytest ${PYTEST_ARGUMENTS} --timeout=600 -m solvers @@ -478,7 +475,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -489,7 +485,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] @@ -510,7 +505,6 @@ jobs: retry_on: error timeout_minutes: 40 command: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pytest ${{ env.PYTEST_ARGUMENTS }} -n 4 --dist loadfile --timeout=600 -m general @@ -632,7 +626,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -643,7 +636,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] @@ -667,7 +659,6 @@ jobs: timeout_minutes: 30 command: | source .venv/bin/activate - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" pytest ${{ env.PYTEST_ARGUMENTS }} -n 4 --dist loadfile --timeout=300 -m "visualization and not avoid_ansys_load" -x --cov-append - name: Run tests marked with 'visualization' and 'avoid_ansys_load' @@ -794,7 +785,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -805,7 +795,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] @@ -826,7 +815,6 @@ jobs: retry_on: error timeout_minutes: 120 command: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 -m "extensions and not flaky_linux" @@ -1006,7 +994,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -1017,7 +1004,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] @@ -1043,7 +1029,6 @@ jobs: retry_on: error timeout_minutes: 120 command: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate xvfb-run pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 -m flaky_linux diff --git a/.github/workflows/manual_draft.yml b/.github/workflows/manual_draft.yml index a6f47c29f58..127a2595380 100644 --- a/.github/workflows/manual_draft.yml +++ b/.github/workflows/manual_draft.yml @@ -4,28 +4,70 @@ on: workflow_dispatch: inputs: test-solvers-windows: - description: "Testing solvers and coverage (Windows)" + description: "Testing solvers (Windows)" default: 'no' type: choice options: - 'yes' - 'no' test-solvers-linux: - description: "Testing solvers and coverage (Linux)" + description: "Testing solvers (Linux)" default: 'no' type: choice options: - 'yes' - 'no' test-general-windows: - description: "Testing general and coverage (Windows)" + description: "Testing general (Windows)" default: 'no' type: choice options: - 'yes' - 'no' test-general-linux: - description: "Testing general and coverage (Linux)" + description: "Testing general (Linux)" + type: choice + default: 'no' + options: + - 'yes' + - 'no' + test-visualization-windows: + description: "Testing visualization (Windows)" + default: 'no' + type: choice + options: + - 'yes' + - 'no' + test-visualization-linux: + description: "Testing visualization (Linux)" + default: 'no' + type: choice + options: + - 'yes' + - 'no' + test-extensions-windows: + description: "Testing extensions (Windows)" + default: 'no' + type: choice + options: + - 'yes' + - 'no' + test-extensions-linux: + description: "Testing extensions (Linux)" + type: choice + default: 'no' + options: + - 'yes' + - 'no' + test-dummy-linux: + description: "Dummy test" + type: choice + default: 'no' + options: + - 'yes' + - 'no' + test-flaky-linux: + description: "Testing Flaky (Linux)" type: choice default: 'no' options: @@ -69,13 +111,6 @@ jobs: pip install .[tests] pip install pytest-azurepipelines - - name: Install CI dependencies (e.g. vtk-osmesa) - run: | - .venv\Scripts\Activate.ps1 - # Uninstall conflicting dependencies - pip uninstall --yes vtk - pip install --index-url https://wheels.vtk.org vtk-osmesa==9.3.1 - - name: Remove Ansys processes (if any) shell: powershell run: | @@ -129,7 +164,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -140,7 +174,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] pip install pytest-azurepipelines @@ -158,7 +191,6 @@ jobs: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pytest ${PYTEST_ARGUMENTS} -m solvers @@ -204,13 +236,6 @@ jobs: pip install .[tests] pip install pytest-azurepipelines - - name: Install CI dependencies (e.g. vtk-osmesa) - run: | - .venv\Scripts\Activate.ps1 - # Uninstall conflicting dependencies - pip uninstall --yes vtk - pip install --index-url https://wheels.vtk.org vtk-osmesa==9.3.1 - - name: Remove Ansys processes (if any) shell: powershell run: | @@ -268,7 +293,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" python -m venv .venv source .venv/bin/activate python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U @@ -279,7 +303,6 @@ jobs: env: ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} run: | - export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" source .venv/bin/activate pip install .[tests] pip install pytest-azurepipelines @@ -306,7 +329,6 @@ jobs: retry_on: error timeout_minutes: 50 command: | - export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64:$LD_LIBRARY_PATH source .venv/bin/activate pytest ${{ env.PYTEST_ARGUMENTS }} -n 4 --dist loadfile -m general @@ -322,3 +344,433 @@ jobs: name: pytest-general-linux path: junit/test-results.xml if: ${{ always() }} + + system-tests-visualization-windows: + name: Test visualization (windows) + if: github.event.inputs.test-visualization-windows == 'yes' + runs-on: [ self-hosted, Windows, pyaedt ] + env: + MPLBACKEND: 'Agg' + steps: + - name: Install Git and checkout project + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Set up headless display + uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2 + + - name: Setup Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Create virtual environment + run: | + python -m venv .venv + .venv\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 and tests dependencies + run: | + .venv\Scripts\Activate.ps1 + pip install .[tests] + + - name: Remove Ansys processes (if any) + shell: powershell + run: | + Get-Process | Where-Object { + $_.Path -like "*ansys inc*" -or $_.Path -like "*ansysem*" + } | ForEach-Object { + Write-Output "Killing $($_.Name) (PID: $($_.Id))" + Stop-Process -Id $_.Id -Force + } + + - name: Run tests marked with 'visualization' + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + env: + PYTHONMALLOC: malloc + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 40 + command: | + .venv\Scripts\Activate.ps1 + pytest ${{ env.PYTEST_ARGUMENTS }} -n 4 --dist loadfile --timeout=600 -m visualization -x + + - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + with: + name: codecov-system-visualization-tests-windows + files: ./coverage.xml + flags: windows_system_visualization + + - name: Upload pytest test results + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: pytest-visualization-windows + path: junit/test-results.xml + if: ${{ always() }} + + system-tests-visualization-linux: + name: Test visualization (linux) + if: github.event.inputs.test-visualization-linux == 'yes' + + runs-on: [ self-hosted, Linux, pyaedt ] + env: + ANSYSEM_ROOT252: '/usr/ansys_inc/v252/AnsysEM' + ANS_NODEPCHECK: '1' + MPLBACKEND: 'Agg' + steps: + - name: Install Git and checkout project + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Set up headless display + uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2 + + - name: Setup Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Create virtual environment + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U + python -c "import sys; print(sys.executable)" + + - name: Install pyaedt and tests dependencies + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + source .venv/bin/activate + pip install .[tests] + + - name: Remove Ansys processes (if any) + shell: bash + run: | + for pid in $(ps -eo pid,comm,args | grep -iE "ansys.inc|ansysem" | grep -v grep | awk '{print $1}'); do + echo "Killing PID $pid" + kill -9 "$pid" + done + + # NOTE: Run visualization tests in two separate steps to avoid conflicts when + # loading Ansys EM libraries and vtk osmesa backend. + - name: Run tests marked with 'visualization' and not 'avoid_ansys_load' + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 30 + command: | + source .venv/bin/activate + pytest ${{ env.PYTEST_ARGUMENTS }} -n 4 --dist loadfile --timeout=300 -m "visualization and not avoid_ansys_load" -x --cov-append + + - name: Run tests marked with 'visualization' and 'avoid_ansys_load' + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 40 + command: | + source .venv/bin/activate + pytest ${{ env.PYTEST_ARGUMENTS }} -n 4 --dist loadfile --timeout=300 -m "visualization and avoid_ansys_load" -x --cov-append + + - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + with: + name: codecov-system-visualization-tests-linux + files: ./coverage.xml + flags: linux_system_visualization + + - name: Upload pytest test results + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: pytest-visualization-linux + path: junit/test-results.xml + if: ${{ always() }} + + system-tests-extensions-windows: + name: Test extensions (windows) + if: github.event.inputs.test-extensions-windows == 'yes' + runs-on: [ self-hosted, Windows, pyaedt ] + steps: + - name: Install Git and checkout project + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Set up headless display + uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2 + + - name: Setup Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Create virtual environment + run: | + python -m venv .venv + .venv\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 and tests dependencies + run: | + .venv\Scripts\Activate.ps1 + pip install .[tests] + + - name: Remove Ansys processes (if any) + shell: powershell + run: | + Get-Process | Where-Object { + $_.Path -like "*ansys inc*" -or $_.Path -like "*ansysem*" + } | ForEach-Object { + Write-Output "Killing $($_.Name) (PID: $($_.Id))" + Stop-Process -Id $_.Id -Force + } + + - name: Run tests marked with 'extensions' + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + env: + PYTHONMALLOC: malloc + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 120 + command: | + .venv\Scripts\Activate.ps1 + pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 -m extensions + + - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + with: + name: codecov-system-extensions-tests-windows + files: ./coverage.xml + flags: windows_system_extensions + + - name: Upload pytest test results + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: pytest-extensions-windows + path: junit/test-results.xml + if: ${{ always() }} + + system-tests-extensions-linux: + name: Test extensions (linux) + if: github.event.inputs.test-extensions-linux == 'yes' + runs-on: [ self-hosted, Linux, pyaedt ] + env: + ANSYSEM_ROOT252: '/usr/ansys_inc/v252/AnsysEM' + ANS_NODEPCHECK: '1' + steps: + - name: Install Git and checkout project + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Set up headless display + uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2 + + - name: Setup Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Create virtual environment + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U + python -c "import sys; print(sys.executable)" + + - name: Install pyaedt and tests dependencies + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + source .venv/bin/activate + pip install .[tests] + + - name: Remove Ansys processes (if any) + shell: bash + run: | + for pid in $(ps -eo pid,comm,args | grep -iE "ansys.inc|ansysem" | grep -v grep | awk '{print $1}'); do + echo "Killing PID $pid" + kill -9 "$pid" + done + + - name: Run tests marked with 'extensions' + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 120 + command: | + source .venv/bin/activate + pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 -m "extensions and not flaky_linux" + + - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + with: + name: codecov-system-extensions-tests-linux + files: ./coverage.xml + flags: linux_system_extensions + + - name: Upload pytest test results + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: pytest-extensions-linux + path: junit/test-results.xml + if: ${{ always() }} + + system-tests-dummy: + name: Test dummy (linux) + if: github.event.inputs.test-dummy-linux == 'yes' + runs-on: [ self-hosted, Linux, pyaedt ] + env: + ANSYSEM_ROOT252: '/usr/ansys_inc/v252/AnsysEM' + ANS_NODEPCHECK: '1' + steps: + - name: Install Git and checkout project + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Set up headless display + uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2 + + - name: Setup Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Create virtual environment + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U + python -c "import sys; print(sys.executable)" + + - name: Install pyaedt and tests dependencies + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + source .venv/bin/activate + pip install .[tests] + + - name: Remove Ansys processes (if any) + shell: bash + run: | + for pid in $(ps -eo pid,comm,args | grep -iE "ansys.inc|ansysem" | grep -v grep | awk '{print $1}'); do + echo "Killing PID $pid" + kill -9 "$pid" + done + + - name: Run test + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 120 + command: | + source .venv/bin/activate + pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 tests/system/extensions/test_export_layout.py + + - name: Upload pytest test results + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: pytest-dummy-linux + path: junit/test-results.xml + if: ${{ always() }} + + + system-tests-flaky-linux: + name: Test flaky (linux) + if: github.event.inputs.test-flaky-linux == 'yes' + + runs-on: [ self-hosted, Linux, pyaedt ] + env: + ANSYSEM_ROOT252: '/usr/ansys_inc/v252/AnsysEM' + ANS_NODEPCHECK: '1' + steps: + - name: Install Git and checkout project + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Setup Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Create virtual environment + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U + python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U + python -c "import sys; print(sys.executable)" + + - name: Install pyaedt and tests dependencies + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + run: | + source .venv/bin/activate + pip install .[tests] + + - name: "Install X Virtual Frame Buffer" + run: | + sudo apt-get update + sudo apt-get install -y xvfb + + - name: Remove Ansys processes (if any) + shell: bash + run: | + for pid in $(ps -eo pid,comm,args | grep -iE "ansys.inc|ansysem" | grep -v grep | awk '{print $1}'); do + echo "Killing PID $pid" + kill -9 "$pid" + done + + - name: Run tests marked with 'flaky' + env: + ANSYSEM: ${{ env.ANSYSEM_ROOT252 }} + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + max_attempts: 2 + retry_on: error + timeout_minutes: 120 + command: | + source .venv/bin/activate + xvfb-run pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 -m flaky_linux + + - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + with: + name: codecov-system-flaky-tests-linux + files: ./coverage.xml + flags: linux_system_flaky + + - name: Upload pytest test results + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: pytest-flaky-linux + path: junit/test-results.xml + if: ${{ always() }} \ No newline at end of file diff --git a/doc/changelog.d/6883.miscellaneous.md b/doc/changelog.d/6883.miscellaneous.md new file mode 100644 index 00000000000..8abe102fc9c --- /dev/null +++ b/doc/changelog.d/6883.miscellaneous.md @@ -0,0 +1 @@ +Delete LD_LIBRARY_PATH definition diff --git a/doc/source/Getting_started/Installation.rst b/doc/source/Getting_started/Installation.rst index 19e6b49e60a..3f009f64c04 100644 --- a/doc/source/Getting_started/Installation.rst +++ b/doc/source/Getting_started/Installation.rst @@ -195,8 +195,10 @@ However, you must set up the following environment variables: .. code:: - export ANSYSEM_ROOT222=/path/to/AedtRoot/AnsysEM/v222/Linux64 - export LD_LIBRARY_PATH=$ANSYSEM_ROOT222/common/mono/Linux64/lib64:$ANSYSEM_ROOT222/Delcross:$LD_LIBRARY_PATH + export ANSYSEM_ROOT252=/path/to/AedtRoot/AnsysEM/v252/Linux64 + export LD_LIBRARY_PATH=$ANSYSEM_ROOT252/common/mono/Linux64/lib64:$ANSYSEM_ROOT252/Delcross:$LD_LIBRARY_PATH + +Starting with **AEDT 2025 R1**, Linux support no longer requires manually setting the ``LD_LIBRARY_PATH`` variable. Install offline from a wheelhouse diff --git a/src/ansys/aedt/core/circuit.py b/src/ansys/aedt/core/circuit.py index e27d327ca71..204249888b3 100644 --- a/src/ansys/aedt/core/circuit.py +++ b/src/ansys/aedt/core/circuit.py @@ -26,6 +26,7 @@ import io import math +import os from pathlib import Path import re import shutil @@ -34,6 +35,7 @@ from ansys.aedt.core.application.analysis_hf import ScatteringMethods from ansys.aedt.core.application.analysis_nexxim import FieldAnalysisCircuit from ansys.aedt.core.base import PyAedtBase +from ansys.aedt.core.edb import load_edb_wrapper from ansys.aedt.core.generic import ibis_reader from ansys.aedt.core.generic.constants import Setups from ansys.aedt.core.generic.constants import unit_converter @@ -171,6 +173,9 @@ def __init__( aedt_process_id=None, remove_lock=False, ): + if os.name != "nt": + load_edb_wrapper(version) + FieldAnalysisCircuit.__init__( self, "Circuit Design", diff --git a/src/ansys/aedt/core/edb.py b/src/ansys/aedt/core/edb.py index c327be783c4..78622ff723e 100644 --- a/src/ansys/aedt/core/edb.py +++ b/src/ansys/aedt/core/edb.py @@ -22,12 +22,49 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import os +from pathlib import Path from ansys.aedt.core.generic.settings import settings log = settings.logger +def load_edb_wrapper(version=None): + import ctypes + + from ansys.aedt.core.internal.aedt_versions import aedt_versions + + if version is None: # pragma: no cover + version = settings.aedt_version + if version in aedt_versions.installed_versions: + aedt_path = Path(aedt_versions.installed_versions[version]) + # mono_path = aedt_path / "common" / "mono" / "Linux64" / "lib64" / "libmonosgen-2.0.so.1" + # try: + # ctypes.CDLL(str(mono_path), mode=ctypes.RTLD_GLOBAL) + # except OSError as e: + # raise f"Failed to load {mono_path}: {e}" + + # mono_dir = aedt_path / "common" / "mono" / "Linux64" / "lib64" + # for file in mono_dir.iterdir(): + # if not file.suffix != ".so": + # continue + # try: + # ctypes.CDLL(str(file), mode=ctypes.RTLD_GLOBAL) + # except OSError as e: + # print(f"WARNING: Failed to load {file}: {e}") + + fullpath = aedt_path / "libEDBCWrapper.so" + try: + ctypes.CDLL(str(fullpath), mode=ctypes.RTLD_GLOBAL) + except Exception: # pragma: no cover + raise Exception("Failed to load EDBC wrapper library from %s" % fullpath) + else: # pragma: no cover + raise Exception( + f"Could not find version {version}, please define the associated ANSYSEM_ROOT environment variable." + ) + + # lazy imports def Edb( edbpath=None, @@ -107,14 +144,16 @@ def Edb( >>> app = Edb("/path/to/file/myfile.gds") """ - # Use EDB legacy (default choice) + if os.name != "nt": + load_edb_wrapper(edbversion) + from pyedb import Edb return Edb( edbpath=edbpath, cellname=cellname, isreadonly=isreadonly, - edbversion=edbversion, + version=edbversion, isaedtowned=isaedtowned, oproject=oproject, student_version=student_version, @@ -127,6 +166,9 @@ def Siwave( specified_version=None, ): """Siwave Class.""" + if os.name != "nt": + load_edb_wrapper(specified_version) + from pyedb.siwave import Siwave as app return app( diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/cutout.py b/src/ansys/aedt/core/extensions/hfss3dlayout/cutout.py index 81b5d321ae8..958937c851c 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/cutout.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/cutout.py @@ -30,11 +30,10 @@ from tkinter import ttk from typing import List -from pyedb import Edb - import ansys.aedt.core +from ansys.aedt.core import Edb from ansys.aedt.core import Hfss3dLayout -import ansys.aedt.core.extensions.hfss3dlayout +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import DEFAULT_PADDING from ansys.aedt.core.extensions.misc import SUN from ansys.aedt.core.extensions.misc import ExtensionCommonData diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/export_layout.py b/src/ansys/aedt/core/extensions/hfss3dlayout/export_layout.py index 00c38b05429..4adea223173 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/export_layout.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/export_layout.py @@ -28,9 +28,9 @@ import tkinter from tkinter import ttk -from pyedb import Edb - import ansys.aedt.core +from ansys.aedt.core import Edb +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon from ansys.aedt.core.extensions.misc import get_aedt_version diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/export_to_3d.py b/src/ansys/aedt/core/extensions/hfss3dlayout/export_to_3d.py index 4e3e872a5f6..ad8957dba44 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/export_to_3d.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/export_to_3d.py @@ -28,6 +28,7 @@ from tkinter import ttk import ansys.aedt.core +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon from ansys.aedt.core.extensions.misc import get_aedt_version diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/generate_arbitrary_wave_ports.py b/src/ansys/aedt/core/extensions/hfss3dlayout/generate_arbitrary_wave_ports.py index 0ca4a6ddeb1..61ec14ab70e 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/generate_arbitrary_wave_ports.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/generate_arbitrary_wave_ports.py @@ -33,6 +33,7 @@ import ansys.aedt.core from ansys.aedt.core.edb import Edb +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon from ansys.aedt.core.extensions.misc import get_aedt_version diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/parametrize_edb.py b/src/ansys/aedt/core/extensions/hfss3dlayout/parametrize_edb.py index f6e6bed97bb..3e6ea8a8ed3 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/parametrize_edb.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/parametrize_edb.py @@ -28,10 +28,10 @@ import tkinter from tkinter import ttk -from pyedb import Edb - import ansys.aedt.core +from ansys.aedt.core import Edb from ansys.aedt.core import Hfss3dLayout +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon from ansys.aedt.core.extensions.misc import get_aedt_version diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/post_layout_design.py b/src/ansys/aedt/core/extensions/hfss3dlayout/post_layout_design.py index 473d7dd51a1..a5b759bcdfa 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/post_layout_design.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/post_layout_design.py @@ -30,6 +30,7 @@ import ansys.aedt.core from ansys.aedt.core import get_pyaedt_app +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import ExtensionCommon from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/push_excitation_from_file_3dl.py b/src/ansys/aedt/core/extensions/hfss3dlayout/push_excitation_from_file_3dl.py index 97ae64f479f..b593f41165a 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/push_excitation_from_file_3dl.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/push_excitation_from_file_3dl.py @@ -31,6 +31,7 @@ import ansys.aedt.core from ansys.aedt.core import get_pyaedt_app +import ansys.aedt.core.extensions from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon from ansys.aedt.core.extensions.misc import get_aedt_version diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/via_clustering.py b/src/ansys/aedt/core/extensions/hfss3dlayout/via_clustering.py index fa13f27a8d1..5ff29f842ef 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/via_clustering.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/via_clustering.py @@ -30,10 +30,9 @@ from tkinter import messagebox from tkinter import ttk -from pyedb import Edb - from ansys.aedt.core import Hfss3dLayout from ansys.aedt.core import generate_unique_name +from ansys.aedt.core.edb import Edb from ansys.aedt.core.extensions.misc import ExtensionCommon from ansys.aedt.core.extensions.misc import ExtensionCommonData from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon diff --git a/src/ansys/aedt/core/extensions/hfss3dlayout/via_design.py b/src/ansys/aedt/core/extensions/hfss3dlayout/via_design.py index 560736226c7..22f2adf83b7 100644 --- a/src/ansys/aedt/core/extensions/hfss3dlayout/via_design.py +++ b/src/ansys/aedt/core/extensions/hfss3dlayout/via_design.py @@ -38,6 +38,7 @@ from pyedb.extensions.via_design_backend import ViaDesignBackend import toml +from ansys.aedt.core import Hfss3dLayout from ansys.aedt.core.extensions.misc import DEFAULT_PADDING from ansys.aedt.core.extensions.misc import SUN from ansys.aedt.core.extensions.misc import ExtensionHFSS3DLayoutCommon @@ -46,7 +47,6 @@ from ansys.aedt.core.extensions.misc import get_port from ansys.aedt.core.extensions.misc import get_process_id from ansys.aedt.core.extensions.misc import is_student -from ansys.aedt.core.hfss3dlayout import Hfss3dLayout from ansys.aedt.core.internal.errors import AEDTRuntimeError PORT = get_port() diff --git a/src/ansys/aedt/core/hfss3dlayout.py b/src/ansys/aedt/core/hfss3dlayout.py index 48b44264b6b..eb248c5ac99 100644 --- a/src/ansys/aedt/core/hfss3dlayout.py +++ b/src/ansys/aedt/core/hfss3dlayout.py @@ -33,6 +33,7 @@ from ansys.aedt.core.application.analysis_3d_layout import FieldAnalysis3DLayout from ansys.aedt.core.application.analysis_hf import ScatteringMethods from ansys.aedt.core.base import PyAedtBase +from ansys.aedt.core.edb import load_edb_wrapper from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.file_utils import parse_excitation_file @@ -167,6 +168,9 @@ def __init__( ic_mode=None, remove_lock=False, ): + if os.name != "nt": + load_edb_wrapper(version) + FieldAnalysis3DLayout.__init__( self, "HFSS 3D Layout Design", diff --git a/src/ansys/aedt/core/modeler/modeler_pcb.py b/src/ansys/aedt/core/modeler/modeler_pcb.py index eb5767c0868..8d1a3f4c9d5 100644 --- a/src/ansys/aedt/core/modeler/modeler_pcb.py +++ b/src/ansys/aedt/core/modeler/modeler_pcb.py @@ -64,7 +64,6 @@ def __init__(self, app): self._model_units = None Modeler.__init__(self, app) self.logger.info("Modeler loaded.") - self.logger.info("EDB loaded.") self.layers = Layers(self, roughnessunits="um") self.logger.info("Layers loaded.") Primitives3DLayout.__init__(self, app) @@ -155,7 +154,7 @@ def edb(self): if settings.remote_api or settings.remote_rpc_session: return self._edb if not self._edb: - from pyedb import Edb + from ansys.aedt.core import Edb self._edb = None if Path(self._edb_file).exists() or inside_desktop_ironpython_console: diff --git a/tests/system/extensions/test_cutout.py b/tests/system/extensions/test_cutout.py index 75681b6ebd9..69622b6b927 100644 --- a/tests/system/extensions/test_cutout.py +++ b/tests/system/extensions/test_cutout.py @@ -181,7 +181,7 @@ def test_cutout_success(add_app, local_scratch): edb_app = Edb(edbpath=str(file_path), edbversion=config["desktopVersion"]) edb_app_nets = edb_app.nets assert all(net in edb_app_nets for net in SIGNAL_NETS + REFERENCE_NETS + OTHER_NETS) - edb_app.close_edb() + edb_app.close() # Perform the cutout operation. app = add_app(str(file_path), application=Hfss3dLayout, just_open=True) @@ -197,4 +197,4 @@ def test_cutout_success(add_app, local_scratch): cutout_app_nets = cutout_app.nets assert all(net in cutout_app_nets for net in SIGNAL_NETS + REFERENCE_NETS) assert not any(net in cutout_app_nets for net in OTHER_NETS) - cutout_app.close_edb() + cutout_app.close()