Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/conda-env/test-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: test-env
dependencies:
# in addtion to package dependencies and explicit LAPACK/BLAS implementations installed in workflow
- conda-build # for conda index
- scipy
- matplotlib
- pytest-cov
- coverage
- coveralls
34 changes: 34 additions & 0 deletions .github/scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

echo "::group::Slycot unit tests"
pytest -v --pyargs slycot \
--cov=${slycot_libdir:=$(python -c "import slycot; print(slycot.__path__[0])")} \
--cov-config=${slycot_srcdir:=$(realpath ./slycot-src)}/.coveragerc
mv .coverage ${slycot_srcdir}/.coverage.slycot
echo "::endgroup::"

echo "::group::python-control unit tests"
pushd ${python_control_srcdir:=./python-control}
# test_root_locus_zoom, test_sisotool: problems with the toolbar for MPL backends, not relevant to Slycot
pytest control/tests \
--cov=$slycot_libdir \
--cov-config=${slycot_srcdir}/.coveragerc \
-k "not (test_root_locus_zoom or test_sisotool)"
mv .coverage ${slycot_srcdir}/.coverage.control
popd
echo "::endgroup::"

echo "::group::run slycot.test() inside interpreter"
echo 'import slycot; slycot.test()' > runtest.py
coverage run --source ${slycot_libdir} --rcfile ${slycot_srcdir}/.coveragerc runtest.py
mv .coverage ${slycot_srcdir}/.coverage.slycot-inline

echo "::group::Combine coverage"
# needs to run from within slycot source dir
cd ${slycot_srcdir}
echo " ${slycot_libdir}" >> .coveragerc
coverage combine
coverage report
echo "::endgroup::"
33 changes: 33 additions & 0 deletions .github/scripts/set-conda-test-matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
""" set-conda-test-matrix.py

Create test matrix for conda packages
"""
import json, re
from pathlib import Path

osmap = {'linux': 'ubuntu',
'osx': 'macos',
'win': 'windows',
}

conda_jobs = []
for conda_pkg_file in Path("slycot-conda-pkgs").glob("*/*.tar.bz2"):
cos = osmap[conda_pkg_file.parent.name.split("-")[0]]
m = re.search(r'py(\d)(\d+)_', conda_pkg_file.name)
pymajor, pyminor = int(m[1]), int(m[2])
cpy = f'{pymajor}.{pyminor}'
for cbl in ['unset', 'Generic', 'OpenBLAS', 'Intel10_64lp']:
cjob = {'packagekey': f'{cos}-{cpy}',
'os': cos,
'python': cpy,
'blas_lib': cbl}
if (cos == 'windows' and
pyminor < 8 and
cbl not in ['unset', 'Intel10_64lp']):
# fatal windows error because numpy and matplotlib directly
# link to mkl on older versions
cjob['failok'] = "FAILOK"
conda_jobs.append(cjob)

matrix = { 'include': conda_jobs }
print(json.dumps(matrix))
28 changes: 28 additions & 0 deletions .github/scripts/set-pip-test-matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
""" set-pip-test-matrix.py

Create test matrix for pip wheels
"""
import json
from pathlib import Path

system_opt_blas_libs = {'ubuntu': ['OpenBLAS'],
'macos' : ['OpenBLAS', 'Apple']}

wheel_jobs = []
for wkey in Path("slycot-wheels").iterdir():
wos, wpy, wbl = wkey.name.split("-")
wheel_jobs.append({'packagekey': wkey.name,
'os': wos,
'python': wpy,
'blas_lib': wbl,
})
if wbl == "Generic":
for bl in system_opt_blas_libs[wos]:
wheel_jobs.append({ 'packagekey': wkey.name,
'os': wos,
'python': wpy,
'blas_lib': bl,
})

matrix = { 'include': wheel_jobs }
print(json.dumps(matrix))
Loading