forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
258 lines (236 loc) · 7.18 KB
/
test_pull_requests.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Our minimal suite of tests that run on each pull request
name: PR Test
on:
pull_request:
branches:
- main
- "v*x"
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
COLUMNS: 120
jobs:
import_lint:
name: Import lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install --upgrade pip
pip install tox
- name: Run import lint
run: tox -e import-lint
manifest:
# make sure all necessary files will be bundled in the release
name: Check Manifest
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache-dependency-path: pyproject.toml
cache: 'pip'
- name: Install Dependencies
run: pip install --upgrade pip
- name: Install Napari dev
run: pip install -e .[build]
env:
PIP_CONSTRAINT: resources/constraints/constraints_py3.11.txt
- name: Make Typestubs
run: |
make typestubs
- name: Check Manifest
run: |
make check-manifest
localization_syntax:
# make sure all necessary files will be bundled in the release
name: Check l18n syntax
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Check localization formatting
run: |
pip install --upgrade pip semgrep
# f"..." and f'...' are the same for semgrep
semgrep --error --lang python --pattern 'trans._(f"...")' napari
semgrep --error --lang python --pattern "trans._(\$X.format(...))" napari
build_wheel:
name: Build wheel
uses: ./.github/workflows/reusable_build_wheel.yml
test_initial:
name: Initial test
uses: ./.github/workflows/reusable_run_tox_test.yml
needs: build_wheel
strategy:
fail-fast: false
matrix:
include:
- python: 3.9
platform: ubuntu-latest
backend: pyqt5
pydantic: "_pydantic_1"
coverage: no_cov
min_req: ""
- python: 3.12
platform: ubuntu-latest
backend: pyqt6
pydantic: ""
coverage: no_cov
min_req: ""
with:
python_version: ${{ matrix.python }}
platform: ${{ matrix.platform }}
qt_backend: ${{ matrix.backend }}
coverage: ${{ matrix.coverage }}
min_req: ${{ matrix.MIN_REQ }}
constraints_suffix: ${{ matrix.pydantic }}
test:
name: ${{ matrix.platform }}
uses: ./.github/workflows/reusable_run_tox_test.yml
needs: test_initial
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest ]
python: [ "3.10", "3.11" ]
backend: [ "pyqt5,pyside6" ]
coverage: [ cov ]
pydantic: ["_pydantic_1"]
include:
# Windows py310
- python: "3.10"
platform: windows-latest
backend: pyqt5 #,pyside2
coverage: no_cov
- python: "3.12"
platform: windows-latest
backend: pyqt6
coverage: cov
- python: "3.12"
platform: macos-13
backend: pyqt5
coverage: no_cov
- python: "3.12"
platform: macos-latest
backend: pyqt5
coverage: no_cov
# minimum specified requirements
- python: "3.9"
platform: ubuntu-20.04
backend: pyqt5
MIN_REQ: 1
coverage: cov
- python: "3.11"
platform: ubuntu-22.04
backend: pyqt5
coverage: cov
pydantic: ""
tox_extras: "optional"
# test without any Qt backends
- python: "3.10"
platform: ubuntu-20.04
backend: headless
coverage: no_cov
- python: "3.12"
platform: ubuntu-latest
backend: pyqt6
coverage: cov
tox_extras: "testing_extra"
# pyside2 test
- python: "3.10"
platform: ubuntu-latest
backend: pyside2
coverage: no_cov
with:
python_version: ${{ matrix.python }}
platform: ${{ matrix.platform }}
qt_backend: ${{ matrix.backend }}
min_req: ${{ matrix.MIN_REQ }}
coverage: ${{ matrix.coverage }}
tox_extras: ${{ matrix.tox_extras }}
constraints_suffix: ${{ matrix.pydantic }}
test_pip_install:
needs: test_initial
name: pip install
uses: ./.github/workflows/reusable_pip_test.yml
test_examples:
name: test examples
uses: ./.github/workflows/reusable_run_tox_test.yml
needs: test_initial
with:
toxenv: py39-linux-pyside2-examples-cov
timeout: 60
python_version: 3.9
constraints_suffix: _examples
coverage: cov
coverage_report:
if: ${{ always() }}
needs:
- test
- test_examples
uses: ./.github/workflows/reusable_coverage_upload.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
test_benchmarks:
name: test benchmarks
runs-on: ubuntu-latest
needs: test_initial
timeout-minutes: 60
env:
GIT_LFS_SKIP_SMUDGE: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.11
cache-dependency-path: pyproject.toml
- uses: tlambert03/setup-qt-libs@v1
- uses: octokit/[email protected]
# here we get hash of the latest release commit to compare with PR
id: latest_release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: napari
repo: napari
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: install dependencies
run: |
pip install --upgrade pip
pip install "asv[virtualenv]"
env:
PIP_CONSTRAINT: resources/constraints/benchmark.txt
- name: asv machine
run: asv machine --yes
- name: Run benchmarks PR
uses: aganders3/headless-gui@v2
with:
run: |
asv run --show-stderr --quick --attribute timeout=300 HEAD^!
env:
PR: 1 # prevents asv from running very compute-intensive benchmarks
PIP_CONSTRAINT: ${{ github.workspace }}/resources/constraints/benchmark.txt
- name: Run benchmarks latest release
# here we check if the benchmark on the latest release is not broken
uses: aganders3/headless-gui@v2
with:
run: |
asv run --show-stderr --quick --attribute timeout=300 ${{ fromJSON(steps.latest_release.outputs.data).target_commitish }}^!
env:
PR: 1 # prevents asv from running very compute-intensive benchmarks
PIP_CONSTRAINT: ${{ github.workspace }}/resources/constraints/benchmark.txt