From 957e84bdc1c1c0aaafd06b6d295eb515cb26e3c8 Mon Sep 17 00:00:00 2001 From: SMoraisAnsys <146729917+SMoraisAnsys@users.noreply.github.com> Date: Fri, 29 Dec 2023 14:11:01 +0000 Subject: [PATCH] CI: fix nightly pyaedt testing (#103) * CI: update labeler and labels * CI: fix nightly pyaedt testing * CI: add examples job for label dependencies --- .github/labeler.yml | 24 ++++--- .github/labels.yml | 4 ++ .github/workflows/ci_cd.yml | 63 +++++++++++++++++++ ...st-pyaedt.yml => nightly-pyaedt-tests.yml} | 2 +- 4 files changed, 83 insertions(+), 10 deletions(-) rename .github/workflows/{nightly-test-pyaedt.yml => nightly-pyaedt-tests.yml} (98%) diff --git a/.github/labeler.yml b/.github/labeler.yml index f80e9995a0..70d4ba8342 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,13 +1,19 @@ documentation: -- doc/source/**/* -- README.md -- README_CN.md +- changed-files: + - any-glob-to-any-file: ['doc/source/**/*', 'examples/**/*', 'README.md'] + maintenance: -- .github/**/* -- .flake8 -- setup.py -- setup-distutils.py +- changed-files: + - any-glob-to-any-file: ['.github/**/*', 'codecov.yml', '.flake8', 'pyproject.toml'] + dependencies: -- requirements/**/* +- changed-files: + - any-glob-to-any-file: ['pyproject.toml'] + +ci/cd: +- changed-files: + - any-glob-to-any-file: ['docker/**/*', '.github/**/*', '.ci/**/*'] + testing: -- tests/**/* +- changed-files: + - any-glob-to-any-file: ['tests/**/*',] diff --git a/.github/labels.yml b/.github/labels.yml index db55cba854..53048cd3dc 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -29,3 +29,7 @@ - name: testing description: Anything related to testing color: 5802B8 + +- name: ci/cd + description: "" + color: b5f226 diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 4047f58a17..14bb45c3b9 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -121,6 +121,69 @@ jobs: with: files: .cov/xml +# ================================================================================================= +# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +# ================================================================================================= + + legacy-examples: + name: "Check legacy examples" + runs-on: [ windows, pyedb, self-hosted ] + if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'dependencies') + 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 + 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" + } + docs-build: name: Build documentation runs-on: ubuntu-20.04 diff --git a/.github/workflows/nightly-test-pyaedt.yml b/.github/workflows/nightly-pyaedt-tests.yml similarity index 98% rename from .github/workflows/nightly-test-pyaedt.yml rename to .github/workflows/nightly-pyaedt-tests.yml index ab92a8b1fe..05b7cd7901 100644 --- a/.github/workflows/nightly-test-pyaedt.yml +++ b/.github/workflows/nightly-pyaedt-tests.yml @@ -81,4 +81,4 @@ jobs: cd external/pyaedt git fetch --all $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)"" + Write-Host "Number of commits between the main branch and the one using pyedb as dependency: $($counter)"