1313 # branches: [ "main" ]
1414
1515jobs :
16- build :
16+ lint :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v6
20+ - name : Set up uv
21+ uses : astral-sh/setup-uv@v7
22+ with :
23+ enable-cache : true
24+ - name : Install ruff
25+ run : |
26+ uv venv .venv
27+ source .venv/bin/activate
28+ uv pip install ruff
29+ - name : Lint with ruff
30+ run : |
31+ source .venv/bin/activate
32+ # stop the build if there are Python syntax errors or undefined names
33+ ruff check . --select=E9,F63,F7,F82 --exclude=.venv
34+ # summary first, then run again with exit-zero to show all errors as warnings (and ignore line length)
35+ ruff check . --select=E,F,C90 --ignore=E501 --exclude=.venv --statistics --quiet --exit-zero
36+ # exit-zero treats all errors as warnings. ignore line length (E501)
37+ ruff check . --select=E,F,C90 --ignore=E501 --exclude=.venv --exit-zero
1738
39+
40+ build-linux :
41+ needs : lint
1842 runs-on : ubuntu-latest
1943 strategy :
2044 fail-fast : false
@@ -24,35 +48,86 @@ jobs:
2448
2549 steps :
2650 - uses : actions/checkout@v6
27- - name : Set up Python ${{ matrix.python-version }}
28- uses : actions /setup-python@v6
51+ - name : Set up uv
52+ uses : astral-sh /setup-uv@v7
2953 with :
30- python-version : ${{ matrix.python-version }}
54+ enable-cache : true
55+ - name : Set up Python ${{ matrix.python-version }}
56+ run : uv python install ${{ matrix.python-version }}
3157 - name : Install dependencies
3258 run : |
33- python -m pip install --upgrade pip
34- python -m pip install flake8 nbmake pytest pytest-doctestplus pytest-cov pytest-mpl pytest-xdist pytest-split
35- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
36- pip freeze > ${{ matrix.python-version }}-${{ matrix.group }}_pip_freeze.txt
37- - name : Lint with flake8
38- run : |
39- # stop the build if there are Python syntax errors or undefined names
40- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
41- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
42- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
59+ uv venv .venv --python ${{ matrix.python-version }}
60+ source .venv/bin/activate
61+ uv pip install nbmake pytest pytest-doctestplus pytest-cov pytest-mpl pytest-xdist pytest-split
62+ if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
63+ uv pip freeze > ${{ matrix.python-version }}-${{ matrix.group }}_pip_freeze.txt
4364 - name : Test with pytest
4465 run : |
66+ source .venv/bin/activate
4567 pytest -ra --mpl --mpl-baseline-path=baseline --mpl-baseline-relative --mpl-generate-summary=html --mpl-results-path='/home/runner/work/sep_tools/tests_report/' --cov --cov-report=xml --nbmake -n=auto --nbmake-kernel=python3 --nbmake-timeout=500 --ignore=SEP_Multi-Instrument-Plot.ipynb --ignore=SEP_PyOnset.ipynb --durations=0 --splits 5 --group ${{ matrix.group }} --splitting-algorithm=least_duration
4668 - name : Upload coverage reports to Codecov
4769 uses : codecov/codecov-action@v6
4870 with :
4971 token : ${{ secrets.CODECOV_TOKEN }}
50-
51- - name : Save pytest-mpl report and pip freeze as artifcat
72+ - name : Save pytest-mpl report and pip freeze as artifact
5273 if : always()
5374 uses : actions/upload-artifact@v7
5475 with :
55- name : ${{ matrix.python-version }}-${{ matrix.group }}-pytest-mpl-report-artifact
76+ name : ubuntu- ${{ matrix.python-version }}-${{ matrix.group }}-pytest-mpl-report-artifact
5677 path : |
5778 ${{ matrix.python-version }}-${{ matrix.group }}_pip_freeze.txt
5879 /home/runner/work/sep_tools/tests_report/
80+
81+
82+ build-windows :
83+ needs : lint
84+ # Only run on pull requests to avoid doubling job count on every push
85+ if : github.event_name == 'pull_request'
86+ runs-on : windows-latest
87+ strategy :
88+ fail-fast : false
89+ matrix :
90+ # Only test oldest and newest Python versions on Windows
91+ python-version : ["3.10", "3.14"]
92+ # Only use 2 groups on Windows to limit job count
93+ group : [1, 2]
94+
95+ steps :
96+ - uses : actions/checkout@v6
97+ - name : Set up uv
98+ uses : astral-sh/setup-uv@v7
99+ with :
100+ enable-cache : true
101+ - name : Set up Python ${{ matrix.python-version }}
102+ run : uv python install ${{ matrix.python-version }}
103+ - name : Install dependencies
104+ run : |
105+ uv venv .venv --python ${{ matrix.python-version }}
106+ .venv\Scripts\activate
107+ uv pip install nbmake pytest pytest-doctestplus pytest-cov pytest-mpl pytest-xdist pytest-split
108+ if (Test-Path requirements.txt) { uv pip install -r requirements.txt }
109+ uv pip freeze > ${{ matrix.python-version }}-${{ matrix.group }}_pip_freeze.txt
110+ shell : pwsh
111+ - name : Test with pytest
112+ run : |
113+ .venv\Scripts\activate
114+ pytest -ra --mpl --mpl-baseline-path=baseline --mpl-baseline-relative `
115+ --mpl-generate-summary=html `
116+ --mpl-results-path='D:\a\sep_tools\tests_report\' `
117+ --cov --cov-report=xml --nbmake -n=auto --nbmake-kernel=python3 `
118+ --nbmake-timeout=500 --ignore=SEP_Multi-Instrument-Plot.ipynb `
119+ --ignore=SEP_PyOnset.ipynb --durations=0 `
120+ --splits 2 --group ${{ matrix.group }} --splitting-algorithm=least_duration
121+ shell : pwsh
122+ - name : Upload coverage reports to Codecov
123+ uses : codecov/codecov-action@v6
124+ with :
125+ token : ${{ secrets.CODECOV_TOKEN }}
126+ - name : Save pytest-mpl report and pip freeze as artifact
127+ if : always()
128+ uses : actions/upload-artifact@v7
129+ with :
130+ name : windows-${{ matrix.python-version }}-${{ matrix.group }}-pytest-mpl-report-artifact
131+ path : |
132+ ${{ matrix.python-version }}-${{ matrix.group }}_pip_freeze.txt
133+ D:\a\sep_tools\tests_report\
0 commit comments