diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f2f306b5d8..d605cfca21 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -121,71 +121,6 @@ jobs: with: files: .cov/xml -# ================================================================================================= -# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -# ================================================================================================= - - legacy-examples: - name: "Check legacy examples" - needs: [legacy-tests] - 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: Execute legacy examples (except pyaedt related and 01) - run: | - . .venv\Scripts\Activate.ps1 - $excluded_example = "01_edb_example.py" - # TODO: once pyaedt examples are passing, use -Recurse to cover them - Get-ChildItem -Path examples/legacy -Filter *.py -File | ? { $_.Name -ne $excluded_example } | ForEach-Object { - Write-Host "Executing example $($_.FullName)" - python $_.FullName - } - - # - 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)" - # python $_.FullName - # } - docs-build: name: Build documentation runs-on: ubuntu-20.04 @@ -251,7 +186,7 @@ jobs: package: name: Package library - needs: [legacy-tests, legacy-examples, docs-build] + needs: [legacy-tests, docs-build] runs-on: ubuntu-latest steps: - name: Build library source and wheel artifacts @@ -283,20 +218,20 @@ jobs: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - doc-index-dev: - name: "Deploy dev index docs" - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: upload-dev-docs - steps: - - name: "Deploy the latest documentation index" - uses: ansys/actions/doc-deploy-index@v5 - with: - cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev - index-name: pyedb-vdev - host-url: ${{ env.MEILISEARCH_HOST_URL }} - api-key: ${{ env.MEILISEARCH_API_KEY }} - python-version: ${{ env.MAIN_PYTHON_VERSION }} + # doc-index-dev: + # name: "Deploy dev index docs" + # if: github.ref == 'refs/heads/main' + # runs-on: ubuntu-latest + # needs: upload-dev-docs + # steps: + # - name: "Deploy the latest documentation index" + # uses: ansys/actions/doc-deploy-index@v5 + # with: + # cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev + # index-name: pyedb-vdev + # host-url: ${{ env.MEILISEARCH_HOST_URL }} + # api-key: ${{ env.MEILISEARCH_API_KEY }} + # python-version: ${{ env.MAIN_PYTHON_VERSION }} upload-docs-release: name: Upload release documentation @@ -310,31 +245,32 @@ jobs: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - doc-index-stable: - name: "Deploy stable docs index" - runs-on: ubuntu-latest - needs: upload-docs-release - steps: - - name: "Install Git and clone project" - uses: actions/checkout@v4 - - - name: "Install the package requirements" - run: pip install -e . + # doc-index-stable: + # name: "Deploy stable docs index" + # runs-on: ubuntu-latest + # needs: upload-docs-release + # steps: + # - name: "Install Git and clone project" + # uses: actions/checkout@v4 + + # - name: "Install the package requirements" + # run: pip install -e . + + # - name: "Get the version to PyMeilisearch" + # run: | + # VERSION=$(python -c "from pyedb import __version__; print('.'.join(__version__.split('.')[:2]))") + # VERSION_MEILI=$(python -c "from pyedb import __version__; print('-'.join(__version__.split('.')[:2]))") + # echo "Calculated VERSION: $VERSION" + # echo "Calculated VERSION_MEILI: $VERSION_MEILI" + # echo "VERSION=$VERSION" >> $GITHUB_ENV + # echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV + + # - name: "Deploy the latest documentation index" + # uses: ansys/actions/doc-deploy-index@v5 + # with: + # cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }} + # index-name: pyedb-v${{ env.VERSION_MEILI }} + # host-url: ${{ env.MEILISEARCH_HOST_URL }} + # api-key: ${{ env.MEILISEARCH_API_KEY }} + # python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: "Get the version to PyMeilisearch" - run: | - VERSION=$(python -c "from pyedb import __version__; print('.'.join(__version__.split('.')[:2]))") - VERSION_MEILI=$(python -c "from pyedb import __version__; print('-'.join(__version__.split('.')[:2]))") - echo "Calculated VERSION: $VERSION" - echo "Calculated VERSION_MEILI: $VERSION_MEILI" - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV - - - name: "Deploy the latest documentation index" - uses: ansys/actions/doc-deploy-index@v5 - with: - cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }} - index-name: pyedb-v${{ env.VERSION_MEILI }} - host-url: ${{ env.MEILISEARCH_HOST_URL }} - api-key: ${{ env.MEILISEARCH_API_KEY }} - python-version: ${{ env.MAIN_PYTHON_VERSION }} diff --git a/.github/workflows/nightly-examples.yml b/.github/workflows/nightly-examples.yml new file mode 100644 index 0000000000..f9fe260095 --- /dev/null +++ b/.github/workflows/nightly-examples.yml @@ -0,0 +1,78 @@ +name: Nightly legacy examples + +on: + # Schedule this workflow every day at UTC 2:00. + schedule: + - cron: '0 2 * * *' + +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' + VTK_OSMESA: 'vtk-osmesa==9.2.20230527.dev0' + +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 ] + 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: "Install specific vtk version with OSMesa bundled" + run: | + .\.venv\Scripts\Activate.ps1 + pip uninstall vtk -y + # Note: the vtk-osmesa used is 9.2.X as 9.3.0 is not working + # well with the use of pyvista in our tests atm. + # TODO: update once a stable versio is working + pip install --extra-index-url https://wheels.vtk.org ${{ env.VTK_OSMESA }} + + - name: Execute legacy examples (except pyaedt related and 01) + run: | + . .venv\Scripts\Activate.ps1 + Get-ChildItem -Recurse -Path examples/legacy -Filter *.py -File | ForEach-Object { + Write-Host "Executing example $($_.FullName)" + $time = Measure-Command {python $_.FullName} + Write-Host "Time taken for example $($_.FullName): $($time.TotalSeconds) seconds" + } diff --git a/.github/workflows/nightly-test-pyaedt.yml b/.github/workflows/nightly-test-pyaedt.yml index a8b926aa57..ab92a8b1fe 100644 --- a/.github/workflows/nightly-test-pyaedt.yml +++ b/.github/workflows/nightly-test-pyaedt.yml @@ -1,4 +1,4 @@ -name: Test pyedb as pyaedt dependency +name: Nightly test of pyedb as pyaedt dependency on: # Schedule this workflow every day at UTC 3:00. @@ -80,5 +80,5 @@ jobs: run: | cd external/pyaedt git fetch --all - COMMIT_COUNT=$(git rev-list --count origin/main...origin/maint/use_pyedb) - echo "Number of commits between the main branch and the one using pyedb as dependency: $COMMIT_COUNT" + $counter = git rev-list --count origin/main...origin/maint/use_pyedb + Write-Host "Number of commits between the main branch and the one using pyedb as dependency: $($counter)"" diff --git a/examples/legacy/pyaedt_integration/08_CPWG.py b/examples/legacy/08_CPWG.py similarity index 100% rename from examples/legacy/pyaedt_integration/08_CPWG.py rename to examples/legacy/08_CPWG.py diff --git a/examples/legacy/pyaedt_integration/03_5G_antenna_example.py b/examples/legacy/pyaedt_integration/03_5G_antenna_example.py index e432f0ee4a..384c12f224 100644 --- a/examples/legacy/pyaedt_integration/03_5G_antenna_example.py +++ b/examples/legacy/pyaedt_integration/03_5G_antenna_example.py @@ -20,9 +20,9 @@ ########################################################## # Set non-graphical mode # ~~~~~~~~~~~~~~~~~~~~~~ -# Set non-graphical mode. The default is ``False``. +# Set non-graphical mode. The default is ``True``. -non_graphical = False +non_graphical = True class Patch: diff --git a/examples/legacy/pyaedt_integration/03_5G_antenna_example_parametrics.py b/examples/legacy/pyaedt_integration/03_5G_antenna_example_parametrics.py index dcc5bbec4f..30b5c97056 100644 --- a/examples/legacy/pyaedt_integration/03_5G_antenna_example_parametrics.py +++ b/examples/legacy/pyaedt_integration/03_5G_antenna_example_parametrics.py @@ -21,9 +21,9 @@ ########################################################## # Set non-graphical mode # ~~~~~~~~~~~~~~~~~~~~~~ -# Set non-graphical mode. The default is ``False``. +# Set non-graphical mode. The default is ``True``. -non_graphical = False +non_graphical = True ########################################################## # Creating data classes @@ -261,7 +261,13 @@ def points(self): # ~~~~~~~~~~~~~~ # Launch HFSS 3D. -h3d = Hfss(specified_version="2023.2", new_desktop_session=True, close_on_exit=True, solution_type="Terminal") +h3d = Hfss( + specified_version="2023.2", + new_desktop_session=True, + close_on_exit=True, + solution_type="Terminal", + non_graphical=non_graphical, +) ############################################################################### diff --git a/examples/legacy/pyaedt_integration/04_edb_parametrized_design.py b/examples/legacy/pyaedt_integration/04_edb_parametrized_design.py index 43ea126a69..fb8c898c98 100644 --- a/examples/legacy/pyaedt_integration/04_edb_parametrized_design.py +++ b/examples/legacy/pyaedt_integration/04_edb_parametrized_design.py @@ -23,9 +23,9 @@ ########################################################## # Set non-graphical mode # ~~~~~~~~~~~~~~~~~~~~~~ -# Set non-graphical mode. The default is ``False``. +# Set non-graphical mode. The default is ``True``. -non_graphical = False +non_graphical = True ########################################################## # Launch EDB diff --git a/examples/legacy/pyaedt_integration/09_Configuration.py b/examples/legacy/pyaedt_integration/09_Configuration.py index 19be619244..0d912da260 100644 --- a/examples/legacy/pyaedt_integration/09_Configuration.py +++ b/examples/legacy/pyaedt_integration/09_Configuration.py @@ -14,6 +14,8 @@ import os +from pyaedt import Hfss3dLayout + import pyedb from pyedb.generic.general_methods import generate_unique_folder_name from pyedb.legacy.downloads import download_file diff --git a/examples/legacy/pyaedt_integration/12_edb_sma_connector_on_board.py b/examples/legacy/pyaedt_integration/12_edb_sma_connector_on_board.py index 225e92f2bf..6358b4dc6a 100644 --- a/examples/legacy/pyaedt_integration/12_edb_sma_connector_on_board.py +++ b/examples/legacy/pyaedt_integration/12_edb_sma_connector_on_board.py @@ -36,10 +36,20 @@ ) from pyedb.legacy.downloads import download_file -ansys_version = "2023.2" +########################################################## +# Set non-graphical mode +# ~~~~~~~~~~~~~~~~~~~~~~ +# Set non-graphical mode. The default is ``True``. + +non_graphical = True + +############################################################################### +# Launch EDB +# ~~~~~~~~~~ +# Launch the :class:`pyedb.Edb` class, using EDB 2023 R2. aedb_path = os.path.join(generate_unique_folder_name(), generate_unique_name("pcb") + ".aedb") -edb = pyedb.Edb(edbpath=aedb_path, edbversion=ansys_version) +edb = pyedb.Edb(edbpath=aedb_path, edbversion="2023.2") print("EDB is located at {}".format(aedb_path)) ##################### @@ -177,7 +187,7 @@ # Launch Hfss3dLayout # ~~~~~~~~~~~~~~~~~~~ -h3d = Hfss3dLayout(aedb_path, specified_version=ansys_version, new_desktop_session=True) +h3d = Hfss3dLayout(aedb_path, specified_version="2023.2", new_desktop_session=True, non_graphical=non_graphical) #################### # Place 3D component