Skip to content

FIX: Centralize open project #14305

FIX: Centralize open project

FIX: Centralize open project #14305

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:
# 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 the pre-commit-ci bot to trigger the CI/CD pipeline
# automatically on PR it creates.
# This is to mitigate supply chain attacks, where a malicious dependency update
# could execute arbitrary code in our build environment.
# PRs opened by the pre-commit-ci bot must be reviewed carefully and approved
# manually before running the CI.
block-pre-commit-ci-bot-PR:
name: "Block pre-commit-ci bot (on pre-commit-ci bot PR only)"
runs-on: ubuntu-latest
steps:
- name: Exit if pre-commit-ci bot triggered the workflow # zizmor: ignore[bot-conditions] safe ignore because we exit if pre-commit-ci bot is triggering the action
if: github.triggering_actor == 'pre-commit-ci[bot]' && github.event.pull_request.head.ref == 'pre-commit-ci-update-config'
run: |
echo "::warning::pre-commit-ci bot 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 and pre-commit-ci bot's PR. This is to mitigate supply chain attacks,
# where a malicious dependency update could execute arbitrary code in our build environment.
# Dependabot and pre-commit-ci bot PRs must be reviewed carefully and approved manually before
# running the CI.
block-pyansys-ci-bot:
name: "Block PyAnsys-CI-bot (on dependabot and pre-commit-ci bot PR)"
needs: [block-dependabot, block-pre-commit-ci-bot-PR]
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
- name: Exit if pyansys-ci-bot triggered the workflow on pre-commit-ci bot's PR
if: github.triggering_actor == 'pyansys-ci-bot' && github.event.pull_request.head.ref == 'pre-commit-ci-update-config'
run: |
echo "::warning::PyAnsys CI bot is not allowed to trigger this workflow in pre-commit-ci bot'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@244028c6311885d559e18453642a5fa820d6360d # zizmor: ignore[stale-action-refs]
with:
dev-mode: ${{ github.ref != 'refs/heads/main' }}
extra-targets: 'all'
python-version: ${{ env.MAIN_PYTHON_VERSION }}
python-package-name: ${{ env.PACKAGE_NAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
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@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
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@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.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"
analyze-changes:
name: Analyze code changes
runs-on: ubuntu-latest
needs: [pr-title]
outputs:
skip_tests: ${{ steps.analyze.outputs.skip_tests }}
extensions_changed: ${{ steps.analyze.outputs.extensions_changed }}
permissions:
contents: read # Required to read repository content and git history
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0 # Need full history for git diff
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.MAIN_PYTHON_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: Analyze changes
id: analyze
shell: bash
run: |
# Run the analyze-changes script in CI mode
python .ci/scripts/analyze_changes.py --base origin/main
# If no outputs were set, default to skip_tests=false
if [ ! -f "$GITHUB_OUTPUT" ] || ! grep -q "skip_tests" "$GITHUB_OUTPUT" 2>/dev/null; then
echo "skip_tests=false" >> $GITHUB_OUTPUT
fi
doc-style:
name: Documentation style check
runs-on: ubuntu-latest
needs: [analyze-changes]
permissions:
contents: read # Required to read documentation files for style checking
steps:
- name: Check documentation style
uses: ansys/actions/doc-style@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: '["doc/source", ".github/plugin", ".github/skills"]'
fail-level: 'warning'
doc-build:
name: Documentation build
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- name: Documentation build
uses: ansys/actions/doc-build@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
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'
check-links: false
needs-quarto: false
optional-dependencies-name: 'all'
group-dependencies-name: 'doc'
doc-deploy-pr:
name: Deploy PR documentation
if: contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc')
needs: doc-build
runs-on: ubuntu-latest
permissions:
contents: write # Needed to update files on the gh-pages branch
pull-requests: write # Needed to create deployment comments on PRs
steps:
- uses: ansys/actions/doc-deploy-pr@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
with:
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
cname: ${{ env.DOCUMENTATION_CNAME }}
doc-artifact-name: documentation-html
maximum-pr-doc-deployments: 3
token: ${{ secrets.GITHUB_TOKEN }}
type-check:
name: Type check with Ty
needs: [pr-title]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.MAIN_PYTHON_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 quality dependencies
run: |
uv sync --frozen --only-group quality --no-install-project
# NOTE: At the moment this will only run on a subset of files. See the pyproject.toml
# configuration for more information on excluded files / folders.
- name: Run Ty on selected files
run: |
ty check
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: [analyze-changes]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
target: ['', 'all']
steps:
- name: Build wheelhouse and perform smoke test
id: build-wheelhouse
uses: ansys/actions/build-wheelhouse@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
with:
attest-provenance: true
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
target: ${{ matrix.target }}
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__"
smoke-tests-rocky:
name: Build wheelhouse and smoke tests (Rocky Linux)
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: [analyze-changes]
uses: ./.github/workflows/reusable-smoke-tests-rocky.yml
with:
python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
unit-tests:
name: Unit tests
needs: [smoke-tests, smoke-tests-rocky, analyze-changes]
if: needs.analyze-changes.outputs.skip_tests != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install Xvfb
shell: bash
run: sudo apt-get install -y xvfb
- 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: Run unit tests
env:
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS_NON_TESTMON }}
run: |
xvfb-run pytest ${PYTEST_ARGUMENTS_NON_TESTMON} tests/unit
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pytest-unit
path: junit/test-results.xml
if: ${{ always() }}
integration-tests:
name: Integration tests
needs: [unit-tests, analyze-changes]
if: needs.analyze-changes.outputs.skip_tests != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
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: Run integration tests
env:
PYTEST_ARGUMENTS_NON_TESTMON: ${{ env.PYTEST_ARGUMENTS_NON_TESTMON }}
run: |
pytest ${PYTEST_ARGUMENTS_NON_TESTMON} tests/integration
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, 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_SOLVERS_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 'solvers'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 tests/system/solvers
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, analyze-changes]
if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true'
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT261: '/usr/ansys_inc/v261/AnsysEM'
ANS_NODEPCHECK: '1'
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_SOLVERS_LINUX }}
- 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:
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
pytest ${PYTEST_ARGUMENTS} --timeout=600 tests/system/solvers
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, 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: 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: 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_GENERAL_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 'general'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args -n 4 --dist loadfile --timeout=600 tests/system/general
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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.analyze-changes.outputs.skip_tests != 'true'
needs: [integration-tests, analyze-changes]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT261: '/usr/ansys_inc/v261/AnsysEM'
ANS_NODEPCHECK: '1'
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: 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_GENERAL_LINUX }}
- 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'
run: |
pytest ${PYTEST_ARGUMENTS} -n 4 --dist loadfile --timeout=600 tests/system/general
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, analyze-changes]
if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true'
runs-on: [ self-hosted, Windows, pyaedt ]
env:
MPLBACKEND: 'Agg'
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: 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_VISUALIZATION_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 'visualization'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args -n 4 --dist loadfile --timeout=600 tests/system/visualization -x
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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.analyze-changes.outputs.skip_tests != 'true'
needs: [integration-tests, analyze-changes]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT261: '/usr/ansys_inc/v261/AnsysEM'
ANS_NODEPCHECK: '1'
MPLBACKEND: 'Agg'
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: 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_VISUALIZATION_LINUX }}
- 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'
run: |
pytest ${PYTEST_ARGUMENTS} -n 4 --dist loadfile --timeout=300 tests/system/visualization -x
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, 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_ICEPAK_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 'icepak'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 tests/system/icepak
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, analyze-changes]
if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true'
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT261: '/usr/ansys_inc/v261/AnsysEM'
ANS_NODEPCHECK: '1'
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_ICEPAK_LINUX }}
- 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:
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
pytest ${PYTEST_ARGUMENTS} --timeout=600 tests/system/icepak
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, 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_LAYOUT_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 'layout'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 tests/system/layout
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, analyze-changes]
if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true'
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT261: '/usr/ansys_inc/v261/AnsysEM'
ANS_NODEPCHECK: '1'
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
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_LAYOUT_LINUX }}
- 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:
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
pytest ${PYTEST_ARGUMENTS} --timeout=600 tests/system/layout
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pytest-layout-linux
path: junit/test-results.xml
if: ${{ always() }}
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================
system-tests-extensions-windows:
name: Test extensions (windows)
needs: [integration-tests]
if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true' && needs.analyze-changes.outputs.extensions_changed == '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: 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-extensions-linux:
name: Test extensions (linux)
if: github.event.pull_request.draft == false && needs.analyze-changes.outputs.skip_tests != 'true' && needs.analyze-changes.outputs.extensions_changed == 'true'
needs: [integration-tests, analyze-changes]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT261: '/usr/ansys_inc/v261/AnsysEM'
ANS_NODEPCHECK: '1'
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: 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'
run: |
pytest ${PYTEST_ARGUMENTS_NON_TESTMON} --timeout=600 tests/system/extensions
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, 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_FILTER_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 'filter_solutions'
env:
PYTHONMALLOC: malloc
PYTEST_ARGUMENTS: ${{ env.PYTEST_ARGUMENTS }}
run: |
$args = $env:PYTEST_ARGUMENTS -split ' '
pytest @args --timeout=600 tests/system/filter_solutions
- name: Upload pytest test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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, 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
package:
name: Package library
needs: [analyze-changes,
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
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
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@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
with:
attest-provenance: true
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false