-
Notifications
You must be signed in to change notification settings - Fork 16
180 lines (173 loc) · 6.15 KB
/
unit_tests.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
name: test_suite
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.type }}
cancel-in-progress: true
on:
pull_request:
paths:
- "**"
push:
branches: [main]
paths:
- "**.py"
tags:
- "v*.*.*"
env:
INSTALLDIR: "build-install"
CCACHE_DIR: "${{ github.workspace }}/.ccache"
jobs:
style:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
architecture: "x64"
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .[style]
- name: Run flake8
uses: py-actions/flake8@v2
with:
path: "mne_hfo"
- name: Run isort
uses: isort/isort-action@master
- name: Run black
uses: psf/black@stable
with:
options: "--check --verbose"
- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
skip: "./.git,./build,./.mypy_cache,./.pytest_cache,./.codespellignore,./doc/tutorials/*"
ignore_words_file: ./.codespellignore
- name: Run pydocstyle
run: pydocstyle .
- name: Run mypy
uses: jpetrucciani/mypy-check@master
with:
path: "./mne_hfo"
mypy_flags: "--config-file pyproject.toml"
- name: Run bibclean
run: |
pwd
ls
bibclean-check ./doc/references.bib
build:
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: [3.8, 3.9, "3.10", "3.11"]
name: build ${{ matrix.os }} - py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .[build]
- name: Test package install
run: python -c "import mne_hfo; print(mne_hfo.__version__)"
- name: Remove package install
run: python -m pip uninstall -yq mne_hfo
- name: Build package
run: python -m build
- name: Upload package distribution files
if: ${{ matrix.os == 'ubuntu' && matrix.python-version == '3.10' }}
uses: actions/upload-artifact@v3
with:
name: package
path: dist
- name: Install sdist
run: pip install ./dist/*.tar.gz
- name: Test sdist install
run: python -c "import mne_hfo; print(mne_hfo.__version__)"
- name: Remove sdist install
run: python -m pip uninstall -yq mne_hfo
- name: Install wheel
run: pip install ./dist/*.whl
- name: Test wheel install
run: python -c "import mne_hfo; print(mne_hfo.__version__)"
- name: Remove wheel install
run: python -m pip uninstall -yq mne_hfo
test:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: [3.8, "3.11"] # oldest and newest supported versions
mne: [stable, main]
name: pytest ${{ matrix.os }} - py${{ matrix.python-version }} - MNE ${{ matrix.mne }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
path: main # clone repository in a sub-directory
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"
- name: Setup headless display
uses: pyvista/setup-headless-display-action@main
with:
qt: true
- name: Install package
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off main/.[test]
# We install both MNE Python and BIDS to be in-line with their latest version
- name: Install MNE (main)
if: "matrix.mne == 'main'"
run: |
python -m pip uninstall -yq mne
python -m pip install git+https://github.com/mne-tools/mne-python
python -m pip install git+https://github.com/mne-tools/mne-bids
- name: Display MNE infos
run: mne sys_info
- name: Retrieve MNE/MNE-HFO testing dataset version
run: |
curl https://raw.githubusercontent.com/mne-tools/mne-testing-data/master/version.txt -o mne_testing_data_version.txt
curl https://raw.githubusercontent.com/adam2392/mne-testing-icalabel-data/main/version.txt -o mne_hfo_testing_data_version.txt
- name: Cache MNE/ICA-Label testing dataset
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-${{ matrix.mne }}-${{ hashFiles('mne_testing_data_version.txt') }}-${{ hashFiles('mne_hfo_testing_data_version.txt') }}
path: ~/mne_data
- name: Download MNE/MNE-HFO testing dataset
run: |
python -c "import mne; mne.datasets.testing.data_path()"
- name: Run pytest
run: pytest main/mne_hfo --cov=main/mne_hfo --cov-report=xml --cov-config=main/pyproject.toml
- name: Upload coverage stats to codecov
if: ${{ matrix.os == 'ubuntu' && matrix.python-version == '3.10' && matrix.mne == 'stable' }}
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)