Skip to content

TEST: EMIT randome failureFirst test #14294

TEST: EMIT randome failureFirst test

TEST: EMIT randome failureFirst test #14294

Workflow file for this run

name: GitHub CI CD
on:
pull_request:
branches:
- main
# 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:
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
MAIN_PYTHON_VERSION: '3.14'
TESTS_VERSION: '3.10'
PACKAGE_NAME: 'PyAEDT'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
PYAEDT_DOC_BUILD_CHEATSHEET: False
ON_CI: True
PYTEST_ARGUMENTS: -vvv --color=yes -rsa --durations=25 --maxfail=10 --junitxml=junit/test-results.xml --testmon
PYTEST_ARGUMENTS_NON_TESTMON: -vvv --color=yes -rsa --durations=25 --maxfail=10 --junitxml=junit/test-results.xml
PYAEDT_EDB_XFAIL: "1"
PYAEDT_LOCAL_SETTINGS_PATH: 'tests/pyaedt_settings.yaml'
TESTMON_DATAFILE: '.testmondata'
TESTMON_CACHE_KEY_SOLVERS_WIN: 'testmondata-solvers-win'
TESTMON_CACHE_KEY_SOLVERS_LINUX: 'testmondata-solvers-linux'
TESTMON_CACHE_KEY_GENERAL_WIN: 'testmondata-general-win'
TESTMON_CACHE_KEY_GENERAL_LINUX: 'testmondata-general-linux'
TESTMON_CACHE_KEY_VISUALIZATION_WIN: 'testmondata-visualization-win'
TESTMON_CACHE_KEY_VISUALIZATION_LINUX: 'testmondata-visualization-linux'
TESTMON_CACHE_KEY_ICEPAK_WIN: 'testmondata-icepak-win'
TESTMON_CACHE_KEY_ICEPAK_LINUX: 'testmondata-icepak-linux'
TESTMON_CACHE_KEY_LAYOUT_WIN: 'testmondata-layout-win'
TESTMON_CACHE_KEY_LAYOUT_LINUX: 'testmondata-layout-linux'
TESTMON_CACHE_KEY_FILTER_WIN: 'testmondata-filter-win'
TESTMON_CACHE_KEY_EMIT_WIN: 'testmondata-emit-win'
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:
system-tests-extensions-windows:
name: Test extensions (windows)
runs-on: [ self-hosted, Windows, pyaedt, pyaedt-ci-0 ]
steps:
- name: Install Git and checkout project
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.TESTS_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@ae62891fec2bb8e7d6c99fc78c9fec3a63790f8d # v10.0.0
with:
activate-environment: true
enable-cache: false
prune-cache: true
python-version: ${{ env.TESTS_VERSION }}
- name: Set up headless display
uses: pyvista/setup-headless-display-action@5bc8de3bc71fcda7a96439571287a554901541a0 # v4.3
- name: Install pyaedt and tests dependencies
env:
TESTS_VERSION: ${{ env.TESTS_VERSION }}
run: |
uv sync --frozen --group tests --extra all
- 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: Fix TCL_LIBRARY for tkinter on Windows
id: fix-tcl
shell: powershell
run: |
# NOTE: In a venv, sys.prefix points to the venv and since Tcl lives in sys.base_prefix (the real install).
# To ensure we locate the correct Tcl directory, we check both sys.prefix and sys.base_prefix.
# NOTE: We also try to leverage actions/setup-python's environment variable to locate the Python installation
# and find the Tcl directory. See https://github.com/actions/setup-python/blob/main/src/find-python.ts
$prefixes = @()
if ($env:pythonLocation) { $prefixes += $env:pythonLocation }
$prefixes += (python -c "import sys; print(sys.base_prefix)").Trim()
$prefixes += (python -c "import sys; print(sys.prefix)").Trim()
$prefixes = $prefixes | Where-Object { $_ } | Select-Object -Unique
function Test-TclLibrary {
param(
[string]$TclPath,
[string]$TkPath
)
$previousTcl = $env:TCL_LIBRARY
$previousTk = $env:TK_LIBRARY
try {
$env:TCL_LIBRARY = $TclPath
if ($TkPath) {
$env:TK_LIBRARY = $TkPath
} else {
Remove-Item Env:TK_LIBRARY -ErrorAction SilentlyContinue
}
python -c "import tkinter; tkinter.Tcl()" | Out-Null
return $LASTEXITCODE -eq 0
} catch {
return $false
} finally {
if ($null -ne $previousTcl) {
$env:TCL_LIBRARY = $previousTcl
} else {
Remove-Item Env:TCL_LIBRARY -ErrorAction SilentlyContinue
}
if ($null -ne $previousTk) {
$env:TK_LIBRARY = $previousTk
} else {
Remove-Item Env:TK_LIBRARY -ErrorAction SilentlyContinue
}
}
}
$tclDir = $null
$tkDir = $null
foreach ($prefix in $prefixes) {
foreach ($subdir in @("tcl", "lib", "lib\tcl")) {
$root = Join-Path $prefix $subdir
if (-not (Test-Path $root)) {
continue
}
$candidateTclDirs = Get-ChildItem -Path $root -Filter "tcl*" -Directory -ErrorAction SilentlyContinue |
Where-Object { Test-Path (Join-Path $_.FullName "init.tcl") } |
Sort-Object Name -Descending
foreach ($candidateTclDir in $candidateTclDirs) {
$candidateTkDir = Get-ChildItem -Path $root -Filter "tk*" -Directory -ErrorAction SilentlyContinue |
Where-Object { Test-Path (Join-Path $_.FullName "tk.tcl") } |
Sort-Object Name -Descending | Select-Object -First 1
if (Test-TclLibrary -TclPath $candidateTclDir.FullName -TkPath $candidateTkDir.FullName) {
$tclDir = $candidateTclDir
$tkDir = $candidateTkDir
break
}
}
if ($tclDir) {
break
}
}
if ($tclDir) {
break
}
}
if ($tclDir) {
"tcl_library=$($tclDir.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
if ($tkDir) {
"tk_library=$($tkDir.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
Write-Output "TCL_LIBRARY set to $($tclDir.FullName)"
if ($tkDir) {
Write-Output "TK_LIBRARY set to $($tkDir.FullName)"
}
} else {
Write-Warning "Could not locate a valid tcl directory in any of: $($prefixes -join ', ')"
}
- name: Run tests marked with 'extensions'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS_NON_TESTMON: ${{ env.PYTEST_ARGUMENTS_NON_TESTMON }}
TCL_LIBRARY: ${{ steps.fix-tcl.outputs.tcl_library }}
TK_LIBRARY: ${{ steps.fix-tcl.outputs.tk_library }}
run: |
$args = $env:PYTEST_ARGUMENTS_NON_TESTMON -split ' '
pytest @args --timeout=600 tests/system/extensions
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pytest-extensions-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, analyze-changes]
# if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true'
# runs-on: [ self-hosted, Windows, pyaedt ]
# steps:
# - name: Install Git and checkout project
# uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# with:
# persist-credentials: false
#
# - name: Setup Python
# uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
# with:
# python-version: ${{ env.TESTS_VERSION }}
#
# - name: Set up uv
# uses: astral-sh/setup-uv@ae62891fec2bb8e7d6c99fc78c9fec3a63790f8d # v10.0.0
# with:
# activate-environment: true
# enable-cache: false
# prune-cache: true
# python-version: ${{ env.TESTS_VERSION }}
#
# - name: Install pyaedt and tests dependencies
# env:
# TESTS_VERSION: ${{ env.TESTS_VERSION }}
# run: |
# uv sync --frozen --group tests --extra all
#
# - name: Wait for master cache update
# uses: ./.github/actions/check-cache
#
# - name: Restore testmondata cache
# uses: ./.github/actions/testmon-cache
# with:
# testmon-datafile: ${{ env.TESTMON_DATAFILE }}
# cache-key: ${{ env.TESTMON_CACHE_KEY_EMIT_WIN }}
#
# - 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'
# env:
# PYTHONMALLOC: malloc
# PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
# run: |
# $args = $env:PYTEST_ARGUMENTS -split ' '
# pytest @args --timeout=600 -v -rA --color=yes tests/system/emit
#
# - name: Upload pytest test results
# uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# with:
# name: pytest-emit-windows
# path: junit/test-results.xml