|
| 1 | +name: Tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened, ready_for_review] |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + if: github.event.pull_request.draft == false |
| 15 | + |
| 16 | + env: |
| 17 | + python-latest: 3.14 |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: ['3.10', 3.11, 3.12, 3.13, 3.14] |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Set up Python ${{ matrix.python-version }} |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: ${{ matrix.python-version }} |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: | |
| 33 | + python -m pip install --upgrade pip |
| 34 | + python -m pip install -e .[test] |
| 35 | +
|
| 36 | + - name: Check code style with flake8 |
| 37 | + if: ${{ matrix.python-version == env.python-latest }} |
| 38 | + run: | |
| 39 | + python -m flake8 pcpostprocess/*.py tests/*.py pcpostprocess/scripts/*.py |
| 40 | +
|
| 41 | + - name: Check import ordering with isort |
| 42 | + if: ${{ matrix.python-version == env.python-latest }} |
| 43 | + run: | |
| 44 | + python -m isort --verbose --check-only --diff pcpostprocess tests setup.py |
| 45 | +
|
| 46 | + - name: Extract test data |
| 47 | + run: | |
| 48 | + wget https://cardiac.nottingham.ac.uk/syncropatch_export/test_data.tar.xz -P tests/ |
| 49 | + tar xvf tests/test_data.tar.xz -C tests/ |
| 50 | +
|
| 51 | + - name: Run unit tests (without coverage testing) |
| 52 | + if: ${{ success() && matrix.python-version != env.python-latest }} |
| 53 | + run: python -m unittest |
| 54 | + |
| 55 | + - name: Run unit tests (with coverage testing) |
| 56 | + if: ${{ success() && matrix.python-version == env.python-latest }} |
| 57 | + run: coverage run -m unittest |
| 58 | + |
| 59 | + - name: Install TeX dependencies for run_herg_qc test |
| 60 | + timeout-minutes: 15 |
| 61 | + run: sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super -y |
| 62 | + |
| 63 | + - name: Run `run_herg_qc` script |
| 64 | + timeout-minutes: 15 |
| 65 | + run: pcpostprocess run_herg_qc tests/test_data/13112023_MW2_FF -w A01 A02 A03 |
| 66 | + |
| 67 | + - name: Report coverage to codecov |
| 68 | + uses: codecov/codecov-action@v4 |
| 69 | + if: ${{ success() && matrix.python-version == env.python-latest }} |
| 70 | + with: |
| 71 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 72 | + |
0 commit comments