-
Notifications
You must be signed in to change notification settings - Fork 99
/
bitbucket-pipelines.yml
378 lines (372 loc) · 12.7 KB
/
bitbucket-pipelines.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
image: ghcr.io/astral-sh/uv:python3.11-bookworm-slim
definitions:
caches:
testfiles: tests_basic/test_files
precommit: ~/.cache/pre-commit
uv: ~/.cache/uv
steps:
- step: &pre-commit-checks-and-setup
name: Pre-commit checks & env setup
script:
- apt-get update
- apt-get -y install git
- uv sync --frozen --quiet
- uv tool run pre-commit run --all-files
caches:
- precommit
- uv
artifacts:
- .venv/**
- step: &push-to-github
name: Push to Github
clone:
depth: full
script:
- apt update
- apt install git -y
- git push [email protected]:jrkerns/pylinac.git $BITBUCKET_BRANCH
- step: &build-docs
name: Build Docs
script:
- uv run nox -s build_docs
condition:
changesets:
includePaths:
- "**/*.rst"
- "*.rst"
- step: &cbct-tests
name: Run CBCT Tests
script:
# set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_cbct.py -n 2 --cov=pylinac.cbct --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_cbct.py"
- "pylinac/ct.py"
artifacts:
- memory_usage.log
- step: &quart-tests
name: Run Quart Tests
script:
- # set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_quart.py --cov=pylinac.quart --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
artifacts:
- memory_usage.log
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_quart.py"
- "pylinac/quart.py"
- "pylinac/ct.py"
- step: &acr-tests
name: Run ACR CT/MRI Tests
script:
- # set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_acr.py --cov=pylinac.acr --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
artifacts:
- memory_usage.log
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_acr.py"
- "pylinac/ct.py"
- "pylinac/acr.py"
- step: &cheese-tests
name: Run Cheese Phantom Tests
script:
- # set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_cheese.py --cov=pylinac.cheese --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
artifacts:
- memory_usage.log
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_cheese.py"
- "pylinac/ct.py"
- "pylinac/cheese.py"
- step: &planar-tests
name: Run Planar Imaging Tests
script:
- # set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_planar_imaging.py --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
artifacts:
- memory_usage.log
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_planar_imaging.py"
- "pylinac/planar_imaging.py"
- step: &dlg-tests
name: Run DLG Tests
script:
- uv run pytest tests_basic/test_dlg.py --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_dlg.py"
- "pylinac/dlg.py"
- step: &field-analysis-tests
name: Run Field Analysis Tests
script:
- uv run pytest tests_basic/test_field_analysis.py --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_field_analysis.py"
- "pylinac/field_analysis.py"
- step: &machine-log-tests
name: Run Machine Logs Tests
script:
- uv run pytest tests_basic/test_logs.py --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_lost.py"
- "pylinac/log_analyzer.py"
- step: &picket-fence-tests
name: Run Picket Fence Tests
script:
- # set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_picketfence.py --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
artifacts:
- memory_usage.log
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_picketfence.py"
- "pylinac/picketfence.py"
- step: &starshot-tests
name: Run Starshot Tests
script:
- uv run pytest tests_basic/test_starshot.py --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_starshot.py"
- "pylinac/starshot.py"
- step: &calibration-tests
name: Run TG-51/TRS-398 Tests
script:
- uv run pytest tests_basic/test_tg51.py tests_basic/test_trs398.py --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_tg51.py"
- "tests_basic/test_trs398.py"
- "pylinac/vmat.py"
- step: &vmat-tests
name: Run VMAT Tests
script:
- uv run pytest tests_basic/test_vmat.py --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_vmat.py"
- "pylinac/vmat.py"
- step: &winston-lutz-tests
name: Run Winston-Lutz Tests
script:
# set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_winstonlutz.py --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_winstonlutz.py"
- "pylinac/winston_lutz.py"
artifacts:
- memory_usage.log
- step: &winston-lutz-mtmf-tests
name: Run Winston-Lutz Multi-Target Multi-Field Tests
script:
# set up memory monitoring
- apt-get update && apt-get install -y --no-install-recommends procps jq
- chmod +x memory_monitor.sh
- nohup ./memory_monitor.sh &
- MONITOR_PID=$!
- uv run pytest tests_basic/test_winstonlutz_mtmf.py --cov-report term --junitxml=./test-reports/pytest_results.xml
# clean up memory monitor
- kill $MONITOR_PID
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/test_winstonlutz.py"
- "pylinac/winston_lutz.py"
artifacts:
- memory_usage.log
- step: &plan-generator-tests
name: Plan generator tests
script:
- uv run pytest tests_basic/test_plan_generator.py tests_basic/test_generated_plans.py --cov-report term --junitxml=./test-reports/pytest_results.xml
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "pylinac/plan_generator/**"
- "tests_basic/test_plan_generator.py"
- "scripts/prefab_plan_generator.py"
- step: &core-module-tests
name: Run core module tests
script:
- uv run pytest tests_basic/core --cov-report term --junitxml=./test-reports/pytest_results.xml
caches:
- testfiles
condition:
changesets:
includePaths:
- "pylinac/core/**"
- "tests_basic/core/**"
- step: &update-dev-kraken
name: Update Dev Kraken
script:
- apt-get update
- apt-get install wget -y
# Get gcloud CLI
- wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-416.0.0-linux-x86_64.tar.gz -O gcloud_cli.tar.gz
- tar -xf gcloud_cli.tar.gz
- ./google-cloud-sdk/install.sh --quiet
- export PATH="./google-cloud-sdk/bin:$PATH"
- uv run nox -s update_dev_kraken
- step: &run-min-python-version
name: Run against min Python version
image: ghcr.io/astral-sh/uv:python3.9-bookworm-slim
caches:
- uv
script:
- uv run nox -s run_min_version_test
pipelines:
custom:
run-min-python-version:
- step: *run-min-python-version
update-kraken:
- step: *pre-commit-checks-and-setup
- step: *update-dev-kraken
pypi:
- step:
name: Set up Env
caches:
- pip
script:
- apt-get update
- python -m venv venv
- source venv/bin/activate
- pip install .[dev]
artifacts:
- venv/**
- step:
name: Push to PYPI
script:
- source venv/bin/activate
- pipe: atlassian/pypi-publish:0.3.1
variables:
PYPI_USERNAME: $PYPI_USERNAME
PYPI_PASSWORD: $PYPI_PASSWORD
DISTRIBUTIONS: 'bdist_wheel'
pull-requests:
'**':
- step: *pre-commit-checks-and-setup
- parallel:
- step: *build-docs
- step: *cbct-tests
- step: *acr-tests
- step: *cheese-tests
- step: *quart-tests
- step: *planar-tests
- step: *dlg-tests
- step: *field-analysis-tests
- step: *machine-log-tests
- step: *picket-fence-tests
- step: *starshot-tests
- step: *calibration-tests
- step: *vmat-tests
- step: *winston-lutz-tests
- step: *winston-lutz-mtmf-tests
- step: *plan-generator-tests
- step: *core-module-tests
branches:
release*:
- step: *run-min-python-version
- step: *push-to-github
master:
- step: *push-to-github
- step: *update-dev-kraken