-
Notifications
You must be signed in to change notification settings - Fork 11
157 lines (142 loc) · 6.21 KB
/
base_test_workflow.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Base Test Workflow
on:
workflow_call:
inputs:
python_version:
required: true
type: string
os:
required: false
type: string
default: "ubuntu-24.04"
tox_args:
required: false
type: string
default: ""
pytest_args:
required: false
type: string
default: ""
napari:
required: false
type: string
default: "latest"
qt_backend:
required: false
type: string
default: "PyQt5"
test_data:
required: false
type: boolean
default: False
coverage:
required: false
type: boolean
default: False
timeout:
required: false
type: number
default: 60
pydantic:
required: false
type: string
default: ""
artifact_suffix:
required: false
type: string
default: ""
jobs:
test:
name: ${{ inputs.os }} py ${{ inputs.python_version }} ${{ inputs.napari }} ${{ inputs.qt_backend }} ${{ inputs.pydantic }}
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python ${{ inputs.python_version }}
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
# - name: Install ubuntu libraries
# if: runner.os == 'Linux'
# run: |
# sudo apt update
# sudo apt-get install -y libegl1 libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 x11-utils libxcb-cursor0
- uses: awalsh128/cache-apt-pkgs-action@latest
if: runner.os == 'Linux'
with:
packages: libegl1 libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 x11-utils libxcb-cursor0 libhdf5-dev
version: 1.0
- name: Install Windows OpenGL
if: runner.os == 'Windows'
run: |
git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) {Exit 0} else {Exit 1}
shell: powershell
- name: Download test data
if: ${{ inputs.test_data }}
uses: actions/download-artifact@v4
with:
name: test_data
path: test_data
- name: Install dependencies
run: |
python -m pip install -r requirements/requirements_dev.txt tox-gh-actions>=2.12.0 tox-min-req tox-uv
pip list
- name: Test with tox PartSegImage
if: ${{ inputs.napari == 'latest' }}
run: python -m tox ${{ inputs.tox_args }} -- package/tests/test_PartSegImage ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
- name: Test with tox PartSegCore
if: ${{ inputs.napari == 'latest' }}
run: python -m tox ${{ inputs.tox_args }} -- package/tests/test_PartSegCore ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
- name: Test with tox PartSeg
if: ${{ inputs.napari == 'latest' }}
uses: aganders3/headless-gui@v2
timeout-minutes: ${{ inputs.timeout }}
with:
run: python -m tox ${{ inputs.tox_args }} -- package/tests/test_PartSeg ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
- name: Test with tox all
if: ${{ inputs.napari != 'latest' }}
uses: aganders3/headless-gui@v2
timeout-minutes: ${{ inputs.timeout }}
with:
run: python -m tox ${{ inputs.tox_args }} -- ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
- uses: actions/upload-artifact@v4
with:
name: timing-report-${{ inputs.os }}-py-${{ inputs.python_version }}-${{ inputs.napari }}-${{ inputs.qt_backend }}-${{ inputs.coverage }}${{ inputs.artifact_suffix }}
path: |
./report-*.json
retention-days: 7
- name: Upload coverage data
uses: actions/[email protected]
if: ${{ inputs.coverage }}
with:
name: cov-reports-${{ inputs.os }}-py-${{ inputs.python_version }}-${{ inputs.napari }}-${{ inputs.qt_backend }}${{ inputs.artifact_suffix }}
include-hidden-files: 'true'
path: |
./.coverage.*