Skip to content

Add pytest to deps and CI #16

Add pytest to deps and CI

Add pytest to deps and CI #16

name: Python application
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "develop", "develop-specact" ]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics --exclude=build/*
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
test-pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
include:
- python-version: "3.11"
pandas-version: "pandas>2.0"
- python-version: "3.11"
pandas-version: "pandas>1.5,<2.0"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install hsp2
run: |
# install the hsp2 executable
pip install .[dev]
- if: ${{ matrix.pandas-version }}
run: pip install ${{ matrix.pandas-version }}
- name: Test with pytest
run: |
# python coverage
NUMBA_DISABLE_JIT=1 pytest --cov --cov-branch --cov-report term-missing
test-cmd:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install hsp2
run: |
# install the hsp2 executable
pip install .
- name: Run hsp2
run: |
# TODO: find much shorter test case.
hsp2 import_uci ./tests/test10/HSP2results/test10.uci _temp_test10.h5
hsp2 run _temp_test10.h5