1717 ANSRV_GEO_PORT : 700
1818 ANSRV_GEO_LICENSE_SERVER : ${{ secrets.LICENSE_SERVER }}
1919 GEO_CONT_NAME : ans_geo
20- RESET_IMAGE_CACHE : 2
20+ RESET_IMAGE_CACHE : 3
2121 IS_WORKFLOW_RUNNING : True
22+ ARTIFACTORY_VERSION : v241
2223
2324concurrency :
2425 group : ${{ github.workflow }}-${{ github.ref }}
2526 cancel-in-progress : true
2627
2728jobs :
2829
29- style :
30- name : Code style
31- runs-on : ubuntu-latest
32- steps :
33- - name : PyAnsys code style checks
34- uses : ansys/actions/code-style@v4
35- with :
36- python-version : ${{ env.MAIN_PYTHON_VERSION }}
37-
3830 docs-style :
3931 name : Documentation Style Check
4032 runs-on : ubuntu-latest
4739 smoke-tests :
4840 name : Build and Smoke tests
4941 runs-on : ${{ matrix.os }}
50- needs : [style]
5142 strategy :
5243 fail-fast : false
5344 matrix :
@@ -214,7 +205,7 @@ jobs:
214205 pip install --upgrade build wheel
215206 pip install .[doc]
216207 # TODO - To be removed once it is published
217- pip uninstall sphinx-autoapi
208+ pip uninstall --yes sphinx-autoapi
218209 pip install "sphinx-autoapi @ git+https://github.com/jorgepiloto/sphinx-autoapi@feat/single-page-option"
219210
220211 - name : Login to GitHub Container Registry
@@ -363,6 +354,10 @@ jobs:
363354 library-name : ${{ env.PACKAGE_NAME }}
364355 python-version : ${{ env.MAIN_PYTHON_VERSION }}
365356
357+ # =================================================================================================
358+ # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
359+ # =================================================================================================
360+
366361 fetch-release-artifacts :
367362 name : Fetch release artifacts
368363 needs : [testing-windows, testing-linux, docs]
@@ -374,8 +369,8 @@ jobs:
374369 steps :
375370 - name : Download binaries
376371 run : |
377- curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/DockerWindows.zip --output windows-binaries.zip
378- curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/DockerLinux.zip --output linux-binaries.zip
372+ curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/ DockerWindows.zip --output windows-binaries.zip
373+ curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/ DockerLinux.zip --output linux-binaries.zip
379374
380375 - name : Upload Windows binaries as workflow artifacts
381376 uses : actions/upload-artifact@v3
@@ -391,10 +386,147 @@ jobs:
391386 path : linux-binaries.zip
392387 retention-days : 7
393388
389+ build-windows-container :
390+ name : Building Geometry Service - Windows
391+ runs-on : [self-hosted, Windows, pygeometry]
392+ needs : [fetch-release-artifacts]
393+ steps :
394+ - name : Checkout repository
395+ uses : actions/checkout@v4
396+
397+ - name : Set up Python
398+ uses : actions/setup-python@v4
399+ with :
400+ python-version : ' 3.9' # use python3.9, self-hosted has an issue with 3.10
401+
402+ - name : Download Windows binaries
403+ uses : actions/download-artifact@v3
404+ with :
405+ name : windows-binaries.zip
406+ path : docker/windows-binaries.zip
407+
408+ - name : Build Docker image
409+ working-directory : docker
410+ run : |
411+ docker build -f Dockerfile.windows -t ghcr.io/ansys/geometry:windows-latest-tmp .
412+
413+ - name : Check location of self-hosted runner and define license server accordingly
414+ if : runner.name == 'pygeometry-ci-1' || runner.name == 'pygeometry-ci-2'
415+ run :
416+ echo "ANSRV_GEO_LICENSE_SERVER=${{ secrets.INTERNAL_LICENSE_SERVER }}" | Out-File -FilePath $env:GITHUB_ENV -Append
417+
418+ - name : Launch Geometry service
419+ run : |
420+ docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ghcr.io/ansys/geometry:windows-latest-tmp
421+
422+ - name : Validate connection using PyAnsys Geometry
423+ run : |
424+ python -m venv .venv
425+ .\.venv\Scripts\Activate.ps1
426+ python -m pip install --upgrade pip
427+ pip install -e .[tests]
428+ python -c "from ansys.geometry.core.connection.validate import validate; validate()"
429+
430+ - name : Restore images cache
431+ uses : actions/cache@v3
432+ with :
433+ path : .\tests\integration\image_cache
434+ key : pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
435+ restore-keys : pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
436+
437+ - name : Testing
438+ run : |
439+ .\.venv\Scripts\Activate.ps1
440+ pytest -v --use-existing-service=yes
441+
442+ - name : Stop the Geometry service
443+ if : always()
444+ run : |
445+ docker stop ${{ env.GEO_CONT_NAME }}
446+ docker logs ${{ env.GEO_CONT_NAME }}
447+ docker rm ${{ env.GEO_CONT_NAME }}
448+
449+ - name : Stop any remaining containers
450+ if : always()
451+ run : |
452+ $dockerContainers = docker ps -a -q
453+ if (-not [string]::IsNullOrEmpty($dockerContainers)) {
454+ docker stop $dockerContainers
455+ docker rm $dockerContainers
456+ }
457+
458+ - name : Delete the Docker images (and untagged ones)
459+ if : always()
460+ run : |
461+ docker image rm ghcr.io/ansys/geometry:windows-latest-tmp
462+ docker system prune -f
463+
464+ # =================================================================================================
465+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
466+ # =================================================================================================
467+
468+ build-linux-container :
469+ name : Building Geometry Service - Linux
470+ runs-on : ubuntu-latest
471+ needs : [fetch-release-artifacts]
472+ steps :
473+ - name : Checkout repository
474+ uses : actions/checkout@v4
475+
476+ - name : Set up Python
477+ uses : actions/setup-python@v4
478+ with :
479+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
480+
481+ - name : Download Linux binaries
482+ uses : actions/download-artifact@v3
483+ with :
484+ name : linux-binaries.zip
485+ path : docker/linux-binaries.zip
486+
487+ - name : Build Docker image
488+ working-directory : docker
489+ run : |
490+ docker build -f Dockerfile.linux -t ghcr.io/ansys/geometry:linux-latest-tmp .
491+
492+ - name : Launch Geometry service
493+ run : |
494+ docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ghcr.io/ansys/geometry:linux-latest-tmp
495+
496+ - name : Validate connection using PyAnsys Geometry
497+ run : |
498+ python -m pip install --upgrade pip
499+ pip install -e .[tests]
500+ python -c "from ansys.geometry.core.connection.validate import validate; validate()"
501+
502+ - name : Restore images cache
503+ uses : actions/cache@v3
504+ with :
505+ path : .\tests\integration\image_cache
506+ key : pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
507+ restore-keys : pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
508+
509+ - name : Run pytest
510+ uses : ansys/actions/tests-pytest@v4
511+ env :
512+ ALLOW_PLOTTING : true
513+ with :
514+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
515+ pytest-extra-args : " --service-os=linux --use-existing-service=yes"
516+ checkout : false
517+ requires-xvfb : true
518+
519+ - name : Stop the Geometry service
520+ if : always()
521+ run : |
522+ docker stop ${{ env.GEO_CONT_NAME }}
523+ docker logs ${{ env.GEO_CONT_NAME }}
524+ docker rm ${{ env.GEO_CONT_NAME }}
525+
394526 release :
395527 name : Release project
396528 if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
397- needs : [package, fetch-release-artifacts ]
529+ needs : [package, build-windows-container, build-linux-container ]
398530 runs-on : ubuntu-latest
399531 steps :
400532 - name : Release to the public PyPI repository
0 commit comments