-
Notifications
You must be signed in to change notification settings - Fork 15
138 lines (114 loc) · 4.94 KB
/
nightly_docker_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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 }}