Skip to content

CHORE: Delete flaky tests #9603

CHORE: Delete flaky tests

CHORE: Delete flaky tests #9603

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.13'
TESTS_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
# Disable all default permissions at workflow level for security (least privilege principle)
# Individual jobs will explicitly request only the permissions they need
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 # Required to commit and push changelog updates to the repository
pull-requests: write # Required to create pull requests with changelog updates
steps:
- uses: ansys/actions/doc-deploy-changelog@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
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
# 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 # zizmor: ignore[bot-conditions] safe ignore because we exit if dependabot is triggering the action
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
vulnerabilities:
name: "Vulnerabilities"
runs-on: ubuntu-latest
needs: [block-pyansys-ci-bot]
permissions:
contents: read # Required to read repository content for vulnerability scanning
steps:
- uses: ansys/actions/check-vulnerabilities@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
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
needs: [block-pyansys-ci-bot]
permissions:
contents: read # Required to read workflow files and check for security issues
steps:
- uses: ansys/actions/check-actions-security@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
with:
generate-summary: true
token: ${{ secrets.GITHUB_TOKEN }}
auditing-level: 'high'
pr-title:
name: Check the title of the PR (if needed)
runs-on: ubuntu-latest
needs: [block-pyansys-ci-bot]
permissions:
pull-requests: read # Required to read PR metadata
steps:
- name: Check the title of the pull request
if: github.event_name == 'pull_request'
uses: ansys/actions/check-pr-title@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
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 # Required to read documentation files for style checking
steps:
- name: Check documentation style
uses: ansys/actions/doc-style@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
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@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
with:
# dependencies: "graphviz texlive-latex-extra latexmk texlive-xetex texlive-fonts-extra"
skip-install: true
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
sphinxopts: '-j auto --color -w build_errors.txt'
dependencies: "pandoc"
check-links: false
needs-quarto: true
smoke-tests:
name: Build wheelhouse and smoke tests
runs-on: ${{ matrix.os }}
permissions:
attestations: write # Required to create and publish build attestations (SLSA provenance)
contents: read # Required to read repository content for building
id-token: write # Required for OIDC token generation (for provenance signing)
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@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
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
env:
ACTIVATE_VENV: ${{ steps.build-wheelhouse.outputs.activate-venv }}
shell: bash
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@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
with:
pytest-postargs: 'tests/unit'
pytest-extra-args: ${{ env.PYTEST_ARGUMENTS }}
python-version: ${{ env.TESTS_VERSION }}
optional-dependencies-name: unit-tests
requires-xvfb: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-unit-tests
files: ./coverage.xml
flags: linux_unit
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
with:
pytest-postargs: 'tests/integration'
pytest-extra-args: ${{ env.PYTEST_ARGUMENTS }}
python-version: ${{ env.TESTS_VERSION }}
optional-dependencies-name: integration-tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-integration-tests
files: ./coverage.xml
flags: linux_integration
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
uv 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
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 -m solvers
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-solvers-tests-windows
files: ./coverage.xml
flags: windows_system_solvers
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
source .venv/bin/activate
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
source .venv/bin/activate
uv 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: |
source .venv/bin/activate
pytest ${PYTEST_ARGUMENTS} --timeout=600 -m solvers
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-solvers-tests-linux
files: ./coverage.xml
flags: linux_system_solvers
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
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@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
uv 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
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 120
command: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args -n 4 --dist loadfile --timeout=600 -m general
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-general-tests-windows
files: ./coverage.xml
flags: windows_system_general
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
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@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
source .venv/bin/activate
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
source .venv/bin/activate
uv 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: 120
command: |
source .venv/bin/activate
pytest ${PYTEST_ARGUMENTS} -n 4 --dist loadfile --timeout=600 -m general
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-general-tests-linux
files: ./coverage.xml
flags: linux_system_general
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
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@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
uv 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
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 120
command: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args -n 4 --dist loadfile --timeout=600 -m visualization -x
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-visualization-tests-windows
files: ./coverage.xml
flags: windows_system_visualization
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
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@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
source .venv/bin/activate
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
source .venv/bin/activate
uv 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 'visualization'
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 ${PYTEST_ARGUMENTS} -n 4 --dist loadfile --timeout=300 -m visualization -x
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-visualization-tests-linux
files: ./coverage.xml
flags: linux_system_visualization
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-visualization-linux
path: junit/test-results.xml
if: ${{ always() }}
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-icepak-windows:
name: Test icepak (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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
uv 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 'icepak'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args -n 4 --dist loadfile --timeout=600 -m icepak -x
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-icepak-tests-windows
files: ./coverage.xml
flags: windows_system_icepak
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-icepak-windows
path: junit/test-results.xml
if: ${{ always() }}
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-icepak-linux:
name: Test icepak (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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
source .venv/bin/activate
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
source .venv/bin/activate
uv 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 'icepak'
env:
ANSYSEM: ${{ env.ANSYSEM_ROOT252 }}
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
source .venv/bin/activate
pytest ${PYTEST_ARGUMENTS} -n 4 --dist loadfile --timeout=600 -m icepak -x
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-icepak-tests-linux
files: ./coverage.xml
flags: linux_system_icepak
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-icepak-linux
path: junit/test-results.xml
if: ${{ always() }}
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-layout-windows:
name: Test layout (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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
uv 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 'layout'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 -m layout
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-layout-tests-windows
files: ./coverage.xml
flags: windows_system_layout
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-layout-windows
path: junit/test-results.xml
if: ${{ always() }}
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-layout-linux:
name: Test layout (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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
run: uv venv .venv
- name: Upgrade wheel and setuptools
run: |
source .venv/bin/activate
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
run: |
source .venv/bin/activate
uv 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 'layout'
env:
ANSYSEM: ${{ env.ANSYSEM_ROOT252 }}
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
source .venv/bin/activate
pytest ${PYTEST_ARGUMENTS} --timeout=600 -m layout
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-system-layout-tests-linux
files: ./coverage.xml
flags: linux_system_layout
- name: Upload pytest test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-layout-linux
path: junit/test-results.xml
if: ${{ always() }}
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-extensions-windows:
name: Test extensions - windows (if needed)
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Check for changes in extensions folder
id: changes
env:
GITHUB_REF: ${{ github.ref }}
shell: powershell
run: |
$GITHUB_REF = "${env:GITHUB_REF}"
$is_main_branch = $GITHUB_REF -eq "refs/heads/main"
$changed_files = git diff --name-only origin/main...HEAD
$run_tests = $false
foreach ($file in $changed_files) {
if ($file -like "src/ansys/aedt/core/extensions/*" -or $file -eq "tests/system/extensions/*") {
$run_tests = $true
break
}
}
# Always run tests on main branch for code coverage
if ($is_main_branch) {
$run_tests = $true
echo "Running on main branch - all tests will be executed"
} elseif ($run_tests) {
echo "Changes detected in extensions folder"
} else {
echo "No changes in extensions folder"
}
$run_tests_str = if ($run_tests) { "true" } else { "false" }
Add-Content -Path $env:GITHUB_OUTPUT -Value "run_tests=$run_tests_str"
- name: Skip extensions tests
if: steps.changes.outputs.run_tests == 'false'
shell: bash
run: echo "Skipped - No changes in src/ansys/aedt/core/extensions"
- name: Set up headless display
if: steps.changes.outputs.run_tests == 'true'
uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
- name: Setup Python
if: steps.changes.outputs.run_tests == 'true'
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
if: steps.changes.outputs.run_tests == 'true'
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
if: steps.changes.outputs.run_tests == 'true'
run: uv venv .venv
- name: Upgrade wheel and setuptools
if: steps.changes.outputs.run_tests == 'true'
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
if: steps.changes.outputs.run_tests == 'true'
run: |
.venv\Scripts\Activate.ps1
uv pip install .[tests]
- name: Remove Ansys processes (if any)
if: steps.changes.outputs.run_tests == 'true'
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'
if: steps.changes.outputs.run_tests == 'true'
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 120
command: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 -m extensions
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: steps.changes.outputs.run_tests == 'true'
with:
name: codecov-system-extensions-tests-windows
files: ./coverage.xml
flags: windows_system_extensions
- name: Upload pytest test results
if: steps.changes.outputs.run_tests == 'true'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-extensions-windows
path: junit/test-results.xml
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-extensions-linux:
name: Test extensions - linux (if needed)
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Check for changes in extensions folder
id: changes
env:
GITHUB_REF: ${{ github.ref }}
shell: bash
run: |
is_main_branch=false
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
is_main_branch=true
fi
changed_files=$(git diff --name-only origin/main...HEAD)
run_tests=false
for file in $changed_files; do
if [[ $file == src/ansys/aedt/core/extensions/* ]] || [[ $file == tests/system/extensions/* ]]; then
run_tests=true
break
fi
done
# Always run tests on main branch for code coverage
if [ "$is_main_branch" = "true" ]; then
run_tests=true
echo "Running on main branch - all tests will be executed"
elif [ "$run_tests" = "true" ]; then
echo "Changes detected in extensions folder"
else
echo "No changes in extensions folder"
fi
echo "run_tests=$run_tests" >> $GITHUB_OUTPUT
- name: Skip extensions tests
if: steps.changes.outputs.run_tests == 'false'
run: echo "Skipped - No changes in src/ansys/aedt/core/extensions"
- name: Set up headless display
if: steps.changes.outputs.run_tests == 'true'
uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
- name: Setup Python
if: steps.changes.outputs.run_tests == 'true'
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
if: steps.changes.outputs.run_tests == 'true'
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
if: steps.changes.outputs.run_tests == 'true'
run: uv venv .venv
- name: Upgrade wheel and setuptools
if: steps.changes.outputs.run_tests == 'true'
run: |
source .venv/bin/activate
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
if: steps.changes.outputs.run_tests == 'true'
run: |
source .venv/bin/activate
uv pip install .[tests]
- name: Remove Ansys processes (if any)
if: steps.changes.outputs.run_tests == 'true'
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'
if: steps.changes.outputs.run_tests == 'true'
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 ${PYTEST_ARGUMENTS} --timeout=600 -m extensions
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: steps.changes.outputs.run_tests == 'true'
with:
name: codecov-system-extensions-tests-linux
files: ./coverage.xml
flags: linux_system_extensions
- name: Upload pytest test results
if: steps.changes.outputs.run_tests == 'true'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-extensions-linux
path: junit/test-results.xml
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-filter-windows:
name: Test filter solutions - windows (if needed)
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Check for changes in filter solutions
id: changes
env:
GITHUB_REF: ${{ github.ref }}
shell: powershell
run: |
$github_ref = "${env:GITHUB_REF}"
$is_main_branch = $github_ref -eq "refs/heads/main"
$changed_files = git diff --name-only origin/main...HEAD
$run_tests = $false
foreach ($file in $changed_files) {
if ($file -like "src/ansys/aedt/core/filtersolutions_core/*" -or $file -eq "src/ansys/aedt/core/filtersolutions.py" -or $file -eq "tests/system/filter_solutions/*") {
$run_tests = $true
break
}
}
# Always run tests on main branch for code coverage
if ($is_main_branch) {
$run_tests = $true
echo "Running on main branch - all tests will be executed"
} elseif ($run_tests) {
echo "Changes detected in filter solutions folder"
} else {
echo "No changes in filter solutions folder"
}
$run_tests_str = if ($run_tests) { "true" } else { "false" }
Add-Content -Path $env:GITHUB_OUTPUT -Value "run_tests=$run_tests_str"
- name: Skip filter solutions tests
if: steps.changes.outputs.run_tests == 'false'
shell: bash
run: echo "Skipped - No changes in src/ansys/aedt/core/filtersolutions_core"
- name: Setup Python
if: steps.changes.outputs.run_tests == 'true'
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
if: steps.changes.outputs.run_tests == 'true'
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
if: steps.changes.outputs.run_tests == 'true'
run: uv venv .venv
- name: Upgrade wheel and setuptools
if: steps.changes.outputs.run_tests == 'true'
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
if: steps.changes.outputs.run_tests == 'true'
run: |
.venv\Scripts\Activate.ps1
uv pip install .[tests]
- name: Remove Ansys processes (if any)
if: steps.changes.outputs.run_tests == 'true'
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'
if: steps.changes.outputs.run_tests == 'true'
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 120
command: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 -m filter_solutions
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: steps.changes.outputs.run_tests == 'true'
with:
name: codecov-system-filter-tests-windows
files: ./coverage.xml
flags: windows_system_filter
- name: Upload pytest test results
if: steps.changes.outputs.run_tests == 'true'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-filter_solutions-windows
path: junit/test-results.xml
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-emit-windows:
name: Test EMIT - windows (if needed)
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Check for changes in EMIT
id: changes
env:
GITHUB_REF: ${{ github.ref }}
shell: powershell
run: |
$github_ref = "${env:GITHUB_REF}"
$is_main_branch = $github_ref -eq "refs/heads/main"
$changed_files = git diff --name-only origin/main...HEAD
$run_tests = $false
foreach ($file in $changed_files) {
if ($file -like "src/ansys/aedt/core/emit_core/*" -or $file -eq "src/ansys/aedt/core/emit.py" -or $file -eq "tests/system/emit/*") {
$run_tests = $true
break
}
}
# Always run tests on main branch for code coverage
if ($is_main_branch) {
$run_tests = $true
echo "Running on main branch - all tests will be executed"
} elseif ($run_tests) {
echo "Changes detected in EMIT folder"
} else {
echo "No changes in EMIT folder"
}
$run_tests_str = if ($run_tests) { "true" } else { "false" }
Add-Content -Path $env:GITHUB_OUTPUT -Value "run_tests=$run_tests_str"
- name: Skip EMIT tests
if: steps.changes.outputs.run_tests == 'false'
shell: bash
run: echo "Skipped - No changes in src/ansys/aedt/core/emit_core"
- name: Setup Python
if: steps.changes.outputs.run_tests == 'true'
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
if: steps.changes.outputs.run_tests == 'true'
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: false
prune-cache: true
- name: Create virtual environment
if: steps.changes.outputs.run_tests == 'true'
run: uv venv .venv
- name: Upgrade wheel and setuptools
if: steps.changes.outputs.run_tests == 'true'
run: |
.venv\Scripts\Activate.ps1
uv pip install -U wheel setuptools
- name: Install pyaedt and tests dependencies
if: steps.changes.outputs.run_tests == 'true'
run: |
.venv\Scripts\Activate.ps1
uv pip install .[tests]
- name: Remove Ansys processes (if any)
if: steps.changes.outputs.run_tests == 'true'
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'
if: steps.changes.outputs.run_tests == 'true'
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
with:
max_attempts: 2
retry_on: error
timeout_minutes: 40
command: |
.venv\Scripts\Activate.ps1
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 -v -rA --color=yes -m emit
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: steps.changes.outputs.run_tests == 'true'
with:
name: codecov-system-emit-tests-windows
files: ./coverage.xml
flags: windows_system_emit
- name: Upload pytest test results
if: steps.changes.outputs.run_tests == 'true'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pytest-emit-windows
path: junit/test-results.xml
package:
name: Package library
needs: [system-tests-solvers-windows,
system-tests-solvers-linux,
system-tests-general-windows,
system-tests-general-linux,
system-tests-visualization-windows,
system-tests-visualization-linux,
system-tests-icepak-windows,
system-tests-icepak-linux,
system-tests-layout-windows,
system-tests-layout-linux,
system-tests-extensions-windows,
system-tests-extensions-linux,
system-tests-filter-windows,
system-tests-emit-windows,
doc-build]
runs-on: ubuntu-latest
permissions:
attestations: write # Required to create and publish package attestations (SLSA provenance)
contents: read # Required to read repository content for packaging
id-token: write # Required for OIDC token generation (for provenance signing)
steps:
- name: Build library source and wheel artifacts
uses: ansys/actions/build-library@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
attest-provenance: true
# TODO: 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 # Required for OIDC authentication to PyPI (trusted publisher)
contents: write # Required to create GitHub releases and upload release assets
steps:
- name: Download the library artifacts from build-library step
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.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@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
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 # Required to commit and push documentation to gh-pages branch
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@41f86da4c9ead510db9135e428e33df9cc6f92e1 # v10.2.3
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}