-
Notifications
You must be signed in to change notification settings - Fork 9
54 lines (43 loc) · 1.67 KB
/
python-package.yml
File metadata and controls
54 lines (43 loc) · 1.67 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
name: Python package
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.13 is now available and worth testing for NumPy 2.0+
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # Automatically caches your dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov
# Install requirements first
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Install remaining packages without --user
pip install pyyaml TextGrid mne-bids
# Final sanity check to ensure NumPy 2.0 didn't get downgraded
python -c "import numpy; print(f'Using NumPy {numpy.__version__}')"
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and get coverage
run: |
# Using -v helps identify exactly which test crashes if collection fails
pytest -v tests/ --cov=./naplib/ --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4 # Updated to v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # v4 often requires a token