Skip to content

Fresnel extension #8635

Fresnel extension

Fresnel extension #8635

Workflow file for this run

name: GitHub CI CD
on:
pull_request:
# GitHub default types + ready_for_review to trigger the workflow on PRs no longer in draft mode.
# See https://github.com/ansys/pyaedt/issues/5223 for more information
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'PyAEDT'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
ON_CI: True
PYTEST_ARGUMENTS: '-vvv --color=yes -ra --durations=25 --maxfail=10 --cov=ansys.aedt.core --cov-report=html --cov-report=xml --junitxml=junit/test-results.xml'
PYAEDT_LOCAL_SETTINGS_PATH: 'tests/pyaedt_settings.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {} # Disable default permissions
jobs:
update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
use-upper-case: true
vulnerabilities:
name: "Vulnerabilities"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: ansys/actions/check-vulnerabilities@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
python-package-name: ${{ env.PACKAGE_NAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
dev-mode: ${{ github.ref != 'refs/heads/main' }}
extra-targets: 'all'
actions-security:
name: "Check actions security"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: ansys/actions/check-actions-security@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
generate-summary: true
token: ${{ secrets.GITHUB_TOKEN }}
auditing-level: 'high'
# NOTE: We do not allow dependabot to trigger the CI/CD pipeline automatically.
# This is to mitigate supply chain attacks, where a malicious dependency update
# could execute arbitrary code in our build environment.
# Dependabot PRs must be reviewed carefully and approved manually before
# running the CI.
block-dependabot:
name: "Block dependabot (on dependabot PR)"
runs-on: ubuntu-latest
steps:
- name: Exit if dependabot triggered the workflow
if: github.triggering_actor == 'dependabot[bot]'
run: |
echo "::warning::Dependabot is not allowed to trigger this workflow. Please review carefully the changes before running the workflow manually."
exit 1
# NOTE: We do not allow pyansys-ci-bot to trigger the CI/CD pipeline automatically
# on dependabot's PR. This is to mitigate supply chain attacks, where a malicious
# dependency update could execute arbitrary code in our build environment.
# Dependabot PRs must be reviewed carefully and approved manually before
# running the CI.
block-pyansys-ci-bot:
name: "Block PyAnsys-CI-bot (on dependabot PR)"
needs: block-dependabot
runs-on: ubuntu-latest
steps:
- name: Exit if pyansys-ci-bot triggered the workflow on dependabot's PR
if: github.triggering_actor == 'pyansys-ci-bot' && startsWith(github.head_ref, 'dependabot')
run: |
echo "::warning::PyAnsys CI bot is not allowed to trigger this workflow in dependabot's PR. Please review carefully the changes before running the workflow manually."
exit 1
pr-title:
name: Check the title of the PR (if needed)
runs-on: ubuntu-latest
needs: [block-pyansys-ci-bot]
permissions:
pull-requests: read
steps:
- name: Check the title of the pull request
if: github.event_name == 'pull_request'
uses: ansys/actions/check-pr-title@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
use-upper-case: true
- name: Check the title of the pull request
if: github.event_name != 'pull_request'
shell: bash
run: echo "::notice::Skipping PR title check for non-PR events"
doc-style:
name: Documentation style check
runs-on: ubuntu-latest
needs: [pr-title]
permissions:
contents: read
steps:
- name: Check documentation style
uses: ansys/actions/doc-style@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fail-level: 'warning'
doc-build:
name: Documentation build
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- name: Temporary handle broken package dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get --fix-broken install -y
sudo apt-get install -y graphviz texlive-latex-extra latexmk texlive-xetex texlive-fonts-extra
- name: Documentation build
uses: ansys/actions/doc-build@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
# dependencies: "graphviz texlive-latex-extra latexmk texlive-xetex texlive-fonts-extra"
python-version: ${{ env.MAIN_PYTHON_VERSION }}
sphinxopts: '-j auto --color -w build_errors.txt'
check-links: false
needs-quarto: true
smoke-tests:
name: Build wheelhouse and smoke tests
runs-on: ${{ matrix.os }}
permissions:
attestations: write
contents: read
id-token: write
needs: [pr-title]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Build wheelhouse and perform smoke test
id: build-wheelhouse
uses: ansys/actions/build-wheelhouse@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
target: 'all'
attest-provenance: true
use-python-cache: false
whitelist-license-check: 'fpdf2'
- name: Import python package
shell: bash
env:
ACTIVATE_VENV: ${{ steps.build-wheelhouse.outputs.activate-venv }}
run: |
${ACTIVATE_VENV}
python -c "import ansys.aedt.core; from ansys.aedt.core import __version__"
unit-tests:
name: Unit tests
needs: [smoke-tests]
runs-on: ubuntu-latest
steps:
- name: Run unit tests
uses: ansys/actions/tests-pytest@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
pytest-postargs: 'tests/unit'
pytest-extra-args: ${{ env.PYTEST_ARGUMENTS }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
optional-dependencies-name: unit-tests
requires-xvfb: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-unit-tests
files: ./coverage.xml
flags: linux_unit
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-unit
path: junit/test-results.xml
if: ${{ always() }}
integration-tests:
name: Integration tests
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- name: Run integration tests
uses: ansys/actions/tests-pytest@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
pytest-postargs: 'tests/integration'
pytest-extra-args: ${{ env.PYTEST_ARGUMENTS }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
optional-dependencies-name: integration-tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-integration-tests
files: ./coverage.xml
flags: linux_integration
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-integration
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-solvers-windows:
name: Test solvers (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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: 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 'solvers'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
.venv\Scripts\Activate.ps1
pytest ${PYTEST_ARGUMENTS} --timeout=600 -m solvers
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-system-solvers-tests-windows
files: ./coverage.xml
flags: windows_system_solvers
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-solvers-windows
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-solvers-linux:
name: Test solvers (linux)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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: |
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
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: |
export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
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 'solvers'
env:
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
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-system-solvers-tests-linux
files: ./coverage.xml
flags: linux_system_solvers
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-solvers-linux
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-general-windows:
name: Test general (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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 'general'
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 }} -n 4 --dist loadfile --timeout=600 -m general
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-system-general-tests-windows
files: ./coverage.xml
flags: windows_system_general
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-general-windows
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-general-linux:
name: Test general (linux)
if: github.event.pull_request.draft == false
needs: [integration-tests]
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: |
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
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: |
export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
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 'general'
env:
ANSYSEM: ${{ env.ANSYSEM_ROOT252 }}
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
max_attempts: 2
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
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-system-general-tests-linux
files: ./coverage.xml
flags: linux_system_general
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-general-linux
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-visualization-windows:
name: Test visualization (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-visualization-linux:
name: Test visualization (linux)
if: github.event.pull_request.draft == false
needs: [integration-tests]
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: |
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
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: |
export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
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
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'
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() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-extensions-windows:
name: Test extensions (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-extensions-linux:
name: Test extensions (linux)
if: github.event.pull_request.draft == false
needs: [integration-tests]
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: |
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
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: |
export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
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: |
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"
- 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() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-filter-windows:
name: Test filter solutions (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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: 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 'filter_solutions'
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 filter_solutions
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-system-filter-tests-windows
files: ./coverage.xml
flags: windows_system_filter
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-filter_solutions-windows
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
system-tests-emit-windows:
name: Test EMIT (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false
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: 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 'emit'
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
PYTHONMALLOC: malloc
with:
max_attempts: 2
retry_on: error
timeout_minutes: 30
command: |
.venv\Scripts\Activate.ps1
pytest ${{ env.PYTEST_ARGUMENTS }} --timeout=600 -v -rA --color=yes -m emit
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-system-emit-tests-windows
files: ./coverage.xml
flags: windows_system_emit
- name: Upload pytest test results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: pytest-emit-windows
path: junit/test-results.xml
if: ${{ always() }}
# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================
# system-tests-flaky-linux:
# name: Test flaky (linux)
# if: github.event.pull_request.draft == false
# needs: [integration-tests]
# 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: |
# 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
# 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: |
# export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# 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: |
# 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
# - 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() }}
package:
name: Package library
needs: [system-tests-general-windows,
system-tests-general-linux,
system-tests-solvers-windows,
system-tests-solvers-linux,
system-tests-visualization-windows,
system-tests-visualization-linux,
system-tests-extensions-windows,
system-tests-extensions-linux,
system-tests-filter-windows,
system-tests-emit-windows,
# system-tests-flaky-linux,
doc-build]
runs-on: ubuntu-latest
permissions:
attestations: write
contents: read
id-token: write
steps:
- name: Build library source and wheel artifacts
uses: ansys/actions/build-library@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
attest-provenance: true
# TODO: Si if we can fix the PDF issue and leverage classic ansys/release-github
release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [package, doc-build]
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Download the library artifacts from build-library step
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: ${{ env.PACKAGE_NAME }}-artifacts
path: ${{ env.PACKAGE_NAME }}-artifacts
- name: Release to PyPI using trusted publisher
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: "https://upload.pypi.org/legacy/"
print-hash: true
packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
skip-existing: false
- name: Release to GitHub
uses: ansys/actions/release-github@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
library-name: ${{ env.PACKAGE_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: false
add-artifact-attestation-notes: true
upload-release-doc:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release]
permissions:
contents: write
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@21c9de9bee9692173780696d4a39964f20b9cfa3 # v10.1.5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}