-
Notifications
You must be signed in to change notification settings - Fork 129
160 lines (131 loc) · 4.34 KB
/
python_tests.yml
File metadata and controls
160 lines (131 loc) · 4.34 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: PyTest
on:
push:
branches: [master]
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
pull_request:
branches: [master]
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
env:
FORCE_COLOR: 1
UV_SYSTEM_PYTHON: 1
YASA_DATA_DIR: ${{ github.workspace }}/.yasa_data
jobs:
test:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Cache sample data
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.yasa_data
key: yasa-sample-data-14564285
- name: Install libomp (macOS)
if: ${{ matrix.platform == 'macos-latest' }}
run: brew install libomp
- name: Install dependencies
run: uv pip install --group=test ".[full]"
- name: Test with pytest
run: uv run pytest --verbose
# Test against different dependency versions
test-dependency-combinations:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest]
deps:
# Minimum supported versions (as defined in pyproject.toml)
- python-version: "3.10"
numpy: "numpy==1.22.4"
scipy: "scipy==1.8.1"
pandas: "pandas==2.1.1"
mne: "mne==1.3.0"
numba: "numba==0.57.1"
label: "minimum-versions"
# Latest available versions (already tested above)
# - python-version: "3.13"
# numpy: "numpy"
# scipy: "scipy"
# pandas: "pandas"
# mne: "mne"
# numba: "numba"
# label: "latest-versions"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.deps.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.deps.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Cache sample data
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.yasa_data
key: yasa-sample-data-14564285
- name: Install setuptools (required by mne==1.3.0)
if: ${{ matrix.deps.label == 'minimum-versions' }}
run: uv pip install setuptools
- name: Install numpy (${{ matrix.deps.label }})
run: uv pip install "${{ matrix.deps.numpy }}"
- name: Install dependencies (${{ matrix.deps.label }})
run: >-
uv pip install --group=test ".[full]"
"${{ matrix.deps.scipy }}"
"${{ matrix.deps.pandas }}"
"${{ matrix.deps.mne }}"
"${{ matrix.deps.numba }}"
- name: Display installed versions
run: |
python -c "import numpy; print(f'numpy: {numpy.__version__}')"
python -c "import scipy; print(f'scipy: {scipy.__version__}')"
python -c "import pandas; print(f'pandas: {pandas.__version__}')"
python -c "import mne; print(f'mne: {mne.__version__}')"
python -c "import numba; print(f'numba: {numba.__version__}')"
- name: Test with pytest
run: pytest --verbose
coverage:
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: "1"
steps:
- uses: actions/checkout@v6
- name: Cache sample data
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.yasa_data
key: yasa-sample-data-14564285
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv pip install --group=test ".[full]"
- name: Run tests with coverage
run: pytest --cov --cov-report=xml --verbose
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true