Skip to content

Unstable build tests and promotion #419

Unstable build tests and promotion

Unstable build tests and promotion #419

name: Nightly Server test - Latest build
on:
workflow_dispatch:
schedule: # UTC at 0300
- cron: "0 3 * * *"
env:
MAIN_PYTHON_VERSION: '3.11'
MAIN_PYTHON_VERSION_WINDOWS_SELFHOSTED: '3.9'
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@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION_WINDOWS_SELFHOSTED }} # self-hosted has an issue with 3.11
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- 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-1' || 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
# =================================================================================================
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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@v4
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 }}