Nightly Server test - Latest build #666
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Server test - Latest build | |
on: | |
workflow_dispatch: | |
schedule: # UTC at 0300 | |
- cron: "0 3 * * *" | |
# Trigger workflow when file is modified | |
push: | |
paths: | |
- '.github/workflows/nightly_docker_test.yml' | |
# Sequence of patterns matched against refs/heads | |
branches-ignore: | |
- 'release/**' | |
# Sequence of patterns matched against refs/tags | |
tags-ignore: | |
- v* | |
env: | |
MAIN_PYTHON_VERSION: '3.11' | |
ANSRV_GEO_IMAGE_WINDOWS_TAG: ghcr.io/ansys/geometry:windows-latest-unstable | |
ANSRV_GEO_IMAGE_LINUX_TAG: ghcr.io/ansys/geometry:linux-latest-unstable | |
ANSRV_GEO_PORT: 710 | |
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
GEO_CONT_NAME: ans_geo_nightly | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# ================================================================================================= | |
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
# ================================================================================================= | |
windows-tests: | |
name: Nightly unstable testing - Windows | |
if: vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY != 1 | |
runs-on: [self-hosted, Windows, pygeometry] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Set up headless display | |
uses: pyvista/setup-headless-display-action@v2 | |
- name: Create Python venv | |
run: | | |
python -m venv .venv | |
.\.venv\Scripts\Activate.ps1 | |
- name: Install packages for testing | |
run: | | |
.\.venv\Scripts\Activate.ps1 | |
pip install --upgrade build | |
pip install .[tests] | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download Geometry service container (always latest version) | |
run: | | |
docker image rm $env:ANSRV_GEO_IMAGE_WINDOWS_TAG | |
docker pull $env:ANSRV_GEO_IMAGE_WINDOWS_TAG | |
- name: Check location of self-hosted runner and define license server accordingly | |
if: runner.name == 'pygeometry-ci-2' | |
run: | |
echo "ANSRV_GEO_LICENSE_SERVER=${{ secrets.INTERNAL_LICENSE_SERVER }}" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: Start Geometry service and verify start | |
run: | | |
.\.venv\Scripts\Activate.ps1 | |
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE_WINDOWS_TAG }} python -c "from ansys.geometry.core.connection.validate import validate; validate()" | |
python -c "from ansys.geometry.core.connection.validate import validate; validate()" | |
- name: Run PyAnsys Geometry tests | |
run: | | |
.\.venv\Scripts\Activate.ps1 | |
pytest -v | |
- name: Stop the Geometry service | |
if: always() | |
run: | | |
docker stop $env:GEO_CONT_NAME | |
docker logs $env:GEO_CONT_NAME | |
docker rm $env:GEO_CONT_NAME | |
- name: Stop any remaining containers | |
if: always() | |
run: | | |
$dockerContainers = docker ps -a -q | |
if (-not [string]::IsNullOrEmpty($dockerContainers)) { | |
docker stop $dockerContainers | |
docker rm $dockerContainers | |
} | |
- name: Clean all Docker dangling images | |
if: always() | |
run: docker image prune -f | |
- name: Microsoft Teams Notification | |
uses: skitionek/notify-microsoft-teams@master | |
if: failure() | |
with: | |
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }} | |
# Message to send to Teams as a webhook notification in JSON Payload format | |
raw: >- | |
{ | |
"@type": "MessageCard", | |
"@context": "http://schema.org/extensions", | |
"summary": "Nightly Tests for Windows failing", | |
"themeColor": "f44336", | |
"title": "PyAnsys Geometry Nightly Tests - Windows failing", | |
"sections": [ | |
{ | |
"activityTitle": "Windows nightly tests are failing", | |
"activitySubtitle": "Check the run for more details: https://github.com/ansys/pyansys-geometry/actions/runs/${{ github.run_id }}", | |
"facts": [ | |
{ | |
"name": "Status", | |
"value": "Failed" | |
} | |
] | |
} | |
] | |
} | |
# ================================================================================================= | |
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
# ================================================================================================= | |
linux-tests: | |
name: Nightly unstable testing - Linux | |
if: vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY != 1 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login in Github Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull and launch geometry service | |
run: | | |
docker pull ${{ env.ANSRV_GEO_IMAGE_LINUX_TAG }} | |
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE_LINUX_TAG }} | |
- name: Run pytest | |
uses: ansys/actions/tests-pytest@v6 | |
env: | |
ALLOW_PLOTTING: true | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
requires-xvfb: true | |
- name: Stop the Geometry service | |
if: always() | |
run: | | |
docker stop ${{ env.GEO_CONT_NAME }} | |
docker logs ${{ env.GEO_CONT_NAME }} | |
docker rm ${{ env.GEO_CONT_NAME }} | |
- name: Microsoft Teams Notification | |
uses: skitionek/notify-microsoft-teams@master | |
if: failure() | |
with: | |
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }} | |
# Message to send to Teams as a webhook notification in JSON Payload format | |
raw: >- | |
{ | |
"@type": "MessageCard", | |
"@context": "http://schema.org/extensions", | |
"summary": "Nightly Tests for Linux failing", | |
"themeColor": "f44336", | |
"title": "PyAnsys Geometry Nightly Tests - Linux failing", | |
"sections": [ | |
{ | |
"activityTitle": "Linux nightly tests are failing", | |
"activitySubtitle": "Check the run for more details: https://github.com/ansys/pyansys-geometry/actions/runs/${{ github.run_id }}", | |
"facts": [ | |
{ | |
"name": "Status", | |
"value": "Failed" | |
} | |
] | |
} | |
] | |
} |