|
1 | | -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
3 | | - |
4 | 1 | name: Python package |
5 | 2 |
|
6 | 3 | on: |
|
11 | 8 |
|
12 | 9 | jobs: |
13 | 10 | build: |
14 | | - |
15 | 11 | runs-on: ubuntu-latest |
16 | 12 | strategy: |
17 | 13 | fail-fast: false |
18 | 14 | matrix: |
19 | | - python-version: ["3.8","3.9","3.10"] |
| 15 | + # 3.13 is now available and worth testing for NumPy 2.0+ |
| 16 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
20 | 17 |
|
21 | 18 | steps: |
22 | | - - uses: actions/checkout@v3 |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
23 | 21 | - name: Set up Python ${{ matrix.python-version }} |
24 | | - uses: actions/setup-python@v3 |
| 22 | + uses: actions/setup-python@v5 |
25 | 23 | with: |
26 | 24 | python-version: ${{ matrix.python-version }} |
| 25 | + cache: 'pip' # Automatically caches your dependencies |
| 26 | + |
27 | 27 | - name: Install dependencies |
28 | 28 | run: | |
29 | 29 | python -m pip install --upgrade pip |
30 | 30 | python -m pip install flake8 pytest pytest-cov |
| 31 | + |
| 32 | + # Install requirements first |
31 | 33 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
32 | | - pip install pyyaml TextGrid |
33 | | - pip install --user -U mne-bids |
| 34 | + |
| 35 | + # Install remaining packages without --user |
| 36 | + pip install pyyaml TextGrid mne-bids |
| 37 | + |
| 38 | + # Final sanity check to ensure NumPy 2.0 didn't get downgraded |
| 39 | + python -c "import numpy; print(f'Using NumPy {numpy.__version__}')" |
| 40 | +
|
34 | 41 | - name: Lint with flake8 |
35 | 42 | run: | |
36 | | - # stop the build if there are Python syntax errors or undefined names |
37 | 43 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
38 | | - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
39 | 44 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 45 | +
|
40 | 46 | - name: Test with pytest and get coverage |
41 | 47 | run: | |
42 | | - pytest tests/ --cov=./naplib/ --cov-report=xml |
| 48 | + # Using -v helps identify exactly which test crashes if collection fails |
| 49 | + pytest -v tests/ --cov=./naplib/ --cov-report=xml |
| 50 | +
|
43 | 51 | - name: Upload coverage reports to Codecov |
44 | | - uses: codecov/codecov-action@v3 |
| 52 | + uses: codecov/codecov-action@v4 # Updated to v4 |
| 53 | + with: |
| 54 | + token: ${{ secrets.CODECOV_TOKEN }} # v4 often requires a token |
0 commit comments