-
Notifications
You must be signed in to change notification settings - Fork 10
145 lines (132 loc) · 5.35 KB
/
base_test_workflow.yml
File metadata and controls
145 lines (132 loc) · 5.35 KB
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
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 }}
env:
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PYVISTA_OFF_SCREEN: True # required for opengl on windows
TOX_ARGS: ${{ inputs.tox_args }}
PYTEST_ARGS: ${{ inputs.pytest_args }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
name: Install Python ${{ inputs.python_version }}
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Setup headless display
uses: pyvista/setup-headless-display-action@5bc8de3bc71fcda7a96439571287a554901541a0 # v4.3
with:
qt: true
wm: herbstluftwm
- name: Download test data
if: ${{ inputs.test_data }}
uses: actions/download-artifact@v8
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' }}
shell: bash
run: |
# shellcheck disable=SC2086
python -m tox $TOX_ARGS -- package/tests/test_PartSegImage $PYTEST_ARGS
env:
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
- name: Test with tox PartSegCore
if: ${{ inputs.napari == 'latest' }}
shell: bash
run: |
# shellcheck disable=SC2086
python -m tox $TOX_ARGS -- package/tests/test_PartSegCore $PYTEST_ARGS
env:
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
- name: Test with tox PartSeg
if: ${{ inputs.napari == 'latest' }}
timeout-minutes: ${{ inputs.timeout }}
shell: bash
run: |
# shellcheck disable=SC2086
python -m tox $TOX_ARGS -- package/tests/test_PartSeg $PYTEST_ARGS
env:
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
- name: Test with tox all
if: ${{ inputs.napari != 'latest' }}
timeout-minutes: ${{ inputs.timeout }}
shell: bash
run: |
# shellcheck disable=SC2086
python -m tox $TOX_ARGS ${PYTEST_ARGS:+-- $PYTEST_ARGS}
env:
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || 'requirements/version_denylist.txt' }}
- uses: actions/upload-artifact@v7
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/upload-artifact@v7
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.*