-
Notifications
You must be signed in to change notification settings - Fork 28
396 lines (383 loc) · 12.9 KB
/
ci.yaml
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
name: ci
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true
on: # yamllint disable-line rule:truthy
pull_request:
push:
branches: [main]
workflow_dispatch:
release:
types: [published]
jobs:
get_commit_message:
name: get commit message
runs-on: ubuntu-latest
outputs:
commit_message: ${{ steps.get_message.outputs.commit_message }}
steps:
- uses: actions/checkout@v4
with:
# ensure the correct commit is checked out for PRs or pushes
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 1
- run: echo "commit_message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
id: get_message
cibuildwheel:
needs: get_commit_message
name: build wheels on ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
arch: [native]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: astral-sh/setup-uv@v4
- uses: pypa/[email protected]
env:
MNE_LSL_LIBLSL_BUILD_UNITTESTS: ${{ (github.event_name != 'pull_request' || contains(needs.get_commit_message.outputs.commit_message, '[liblsl]')) && '1' || '0' }}
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
cibuildwheel_emulated:
needs: get_commit_message
if: ${{ github.event_name != 'pull_request' || contains(needs.get_commit_message.outputs.commit_message, '[aarch64]') }}
name: build wheels on ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: aarch64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.arch }}
- uses: astral-sh/setup-uv@v4
- uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.arch }}
MNE_LSL_LIBLSL_BUILD_UNITTESTS: 0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
test:
needs: cibuildwheel
name: test wheels on ${{ matrix.os }} - py${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
python: ["3.10", "3.13"]
exclude:
- os: macos-13
python: "3.13"
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-${{ matrix.os }}-native-*
merge-multiple: true
path: dist
- run: ls -alt . && ls -alt dist/
- run: uv pip install mne-lsl[test] --only-binary mne-lsl --find-links dist --pre --quiet --system
- run: mne-lsl sys-info --developer
- uses: ./.github/actions/get-testing-dataset
- name: Run pytest
uses: ./.github/actions/retry-step
with:
command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s
retry_error_codes: "3,127,134,139"
env:
MNE_LSL_LOG_LEVEL: DEBUG
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-mne-compat:
needs: cibuildwheel
name: test mne compat ${{ matrix.mne-version }} - py${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mne-version: ["1.4.2", "1.5.0"]
python: ["3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-ubuntu-latest-native-*
merge-multiple: true
path: dist
- run: ls -alt . && ls -alt dist/
- run: |
uv pip install mne-lsl[test] --only-binary mne-lsl --find-links dist --pre --quiet --system
uv pip uninstall numpy mne --quiet --system
uv pip install "numpy<2" --quiet --system
uv pip install mne==${{ matrix.mne-version }} --quiet --system
- run: mne-lsl sys-info --developer
- uses: ./.github/actions/get-testing-dataset
- name: Run pytest
uses: ./.github/actions/retry-step
with:
command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s
retry_error_codes: "3,134,139"
env:
MNE_LSL_LOG_LEVEL: DEBUG
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-pip-pre:
needs: cibuildwheel
name: test pip pre-release - py${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-ubuntu-latest-native-*
merge-multiple: true
path: dist
- run: ls -alt . && ls -alt dist/
- run: |
uv pip install mne-lsl[test] --only-binary mne-lsl --find-links dist --pre --quiet --system
uv pip install git+https://github.com/mne-tools/mne-python --upgrade --quiet --system
uv pip install matplotlib --quiet --system
uv pip install matplotlib --upgrade --quiet --system --prerelease allow --only-binary :all: -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --no-deps
uv pip install numpy scipy --upgrade --quiet --system --prerelease allow --only-binary :all: -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
- run: mne-lsl sys-info --developer
- uses: ./.github/actions/get-testing-dataset
- name: Run pytest
uses: ./.github/actions/retry-step
with:
command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s
retry_error_codes: "3,134,139"
env:
MNE_LSL_LOG_LEVEL: DEBUG
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-editable:
name: test editable install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: astral-sh/setup-uv@v4
- run: uv pip install -e .[test] --verbose --system
- run: mne-lsl sys-info --developer
- name: Run pytest
uses: ./.github/actions/retry-step
with:
command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s
retry_error_codes: "3,134,139"
env:
MNE_LSL_LOG_LEVEL: DEBUG
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
sdist:
name: create sdist
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: astral-sh/setup-uv@v4
- run: uv pip install build --upgrade --quiet --system
- run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-sdist
path: ./dist/*.tar.gz
check:
# run even if 'cibuildwheel_emulated' is skipped
if: ${{ always() }}
needs: [cibuildwheel, cibuildwheel_emulated, sdist]
name: run twine check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
merge-multiple: true
path: dist
- run: ls -alt . && ls -alt dist/
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: astral-sh/setup-uv@v4
- run: uv pip install twine --upgrade --quiet --system
- run: twine check --strict dist/*
doc-build:
needs: cibuildwheel
name: build documentation
runs-on: ubuntu-latest
steps:
- run: sudo apt update && sudo apt install -y optipng
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: astral-sh/setup-uv@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-ubuntu-latest-native-*
merge-multiple: true
path: dist
- run: ls -alt . && ls -alt dist/
- run: uv pip install mne-lsl[doc] --only-binary mne-lsl --find-links dist --pre --quiet --system
- run: mne-lsl sys-info --developer
- uses: ./.github/actions/get-testing-dataset
with:
sample: "true"
testing: "false"
- uses: ./.github/actions/retry-step
with:
command: "make -C doc html"
retry_error_codes: "2"
command_between_retries: "make -C doc clean"
- run: rm -R ./doc/_build/html/.doctrees
- uses: actions/upload-artifact@v4
with:
name: doc-dev
path: ./doc/_build/html
doc-deploy-dev:
if: github.event_name == 'push'
needs: doc-build
name: deploy development documentation
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: doc-dev
path: ./doc-dev
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./doc-dev
target-folder: ./dev
git-config-name: 'github-actions[bot]'
git-config-email: 'github-actions[bot]@users.noreply.github.com'
single-commit: true
force: true
doc-deploy-release:
if: github.event_name == 'release'
needs: doc-build
name: deploy stable documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: doc-dev
path: ./doc-dev
- name: Get previous release tag
run: |
PREVIOUS_RELEASE_TAG=$(git tag --sort=-creatordate | sed "/^$RELEASE_TAG$/d" | sed -n 1p)
if [ -z "$PREVIOUS_RELEASE_TAG" ]; then
echo "No previous release tag found."
exit 1
fi
echo "Previous release tag: $PREVIOUS_RELEASE_TAG"
echo "PREVIOUS_RELEASE_TAG=$PREVIOUS_RELEASE_TAG" >> $GITHUB_ENV
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
- name: Move stable to previous release tag
run: |
if [ -d "stable" ]; then
if [ -d "$PREVIOUS_RELEASE_TAG" ]; then
echo "Folder $PREVIOUS_RELEASE_TAG already exists. Exiting."
exit 1
fi
git mv stable "$PREVIOUS_RELEASE_TAG"
else
echo "No stable folder found."
exit 1
fi
- run: mv doc-dev stable
- run: rm -rf dev && cp -r stable dev
if: github.event.release.target_commitish == 'main'
- name: Commit and push changes
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "update documentation for release ${{ github.event.release.tag_name }}"
git push origin gh-pages
publish:
if: github.event_name == 'release'
needs: [check, test, test-mne-compat, test-pip-pre, test-editable, doc-deploy-release]
name: publish to PyPI
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
id-token: write
contents: write
environment:
name: pypi
url: https://pypi.org/p/mne-lsl
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
merge-multiple: true
path: dist
- uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.event.release.tag_name }}
- uses: pypa/gh-action-pypi-publish@release/v1