Skip to content

CI: add pyaedt integration examples #3

CI: add pyaedt integration examples

CI: add pyaedt integration examples #3

Workflow file for this run

# name: GitHub CI
# on:
# pull_request:
# workflow_dispatch:
# push:
# tags:
# - "*"
# branches:
# - main
name: Examples
on:
pull_request:
branches: [ main ]
workflow_dispatch:
push:
branches:
- main
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYEDB_USE_LEGACY: '1'
PYEDB_CI_NO_DISPLAY: '1'
MAIN_PYTHON_VERSION_WINDOWS_SELFHOSTED: '3.9'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
legacy-examples:
name: "Check legacy examples"
runs-on: [ windows, pyedb, self-hosted ]
env:
PYEDB_CI_NO_DISPLAY: '1'
steps:
- name: "Install Git and clone project"
uses: actions/checkout@v4
- name: "Set up Python"
uses: ansys/actions/_setup-python@main
with:
python-version: ${{ env.MAIN_PYTHON_VERSION_WINDOWS_SELFHOSTED }}
use-cache: false
- name: Create Python venv
run: |
python -m venv .venv
. .venv\Scripts\Activate.ps1
- name: "Update pip"
run: |
. .venv\Scripts\Activate.ps1
python -m pip install -U pip
- name: Install pyedb
run: |
. .venv\Scripts\Activate.ps1
pip install .[full]
- name: "Clone pyaedt on specific branch"
uses: actions/checkout@v4
with:
repository: ansys/pyaedt
path: "external/pyaedt"
ref: "maint/use_pyedb"
- name: "Install Pyaedt"
run: |
.\.venv\Scripts\Activate.ps1
pip install --no-cache-dir external/pyaedt[full]
- name: Execute legacy pyaedt integration examples
run: |
. .venv\Scripts\Activate.ps1
Get-ChildItem -Path examples/legacy/pyaedt_integration -Filter *.py -File | ? { $_.Name -ne $excluded_example } | ForEach-Object {
Write-Host "Executing pyaedt integration example $($_.FullName)"
$time = Measure-Command {python $_.FullName}
Write-Host "Time taken for example $($_.FullName): $($result.TotalSeconds) seconds"
}