diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 91cd08dff0..a79f9d8eae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -253,4 +253,35 @@ stages: pathToPublish: '$(Build.SourcesDirectory)/wheelhouse' condition: succeeded() displayName: 'Publish wheel as build artifact' + - job: 'test Linux wheels' + strategy: + matrix: + ${{ if eq(variables.buildWheel, True) }}: + Python38: + python.version: '3.8' + Python39: + python.version: '3.9' + Python310: + python.version: '3.10' + Python311: + python.version: '3.11' + Python312: + python.version: '3.12' + ${{ if eq(variables.buildWheel, False) }}: + Python311: + python.version: '3.11' + - script: | + sudo apt-add-repository -y ppa:deadsnakes/ppa + sudo apt-get update + sudo apt-get install -y python$(python.version) python$(python.version)-dev python$(python.version)-venv + - script: | + package_dir="${PWD}" + tmp_dir="$(mktemp -d)" + cd "${tmp_dir}" + python$(python.version) -m venv "${tmp_dir}/env" + find ${package_dir} -name "*cp$(echo $(python.version) | tr -d '.')*.whl" -exec sh -c ". ${tmp_dir}/env/bin/activate && python -m pip install '{}[test]'" \; + . ${tmp_dir}/env/bin/activate && bash ${package_dir}/packaging/test_wheel.bash ${package_dir} + cd - + condition: succeeded() + displayName: 'Test Linux Wheel with Python $(python.version)' - template: ci/upload-wheels.yml diff --git a/packaging/test_cli.bash b/packaging/test_cli.bash deleted file mode 100644 index 0cbf02354f..0000000000 --- a/packaging/test_cli.bash +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# A simple set of tests checking if the NMODL CLI (called from Python) is -# working correctly -set -xe - -find "$1/test/" "$1/nmodl/ext/" \ - -name "*.mod" \ - -exec nmodl '{}' sympy --analytic \; diff --git a/packaging/test_wheel.bash b/packaging/test_wheel.bash index 111d73a34e..b97fc6a165 100755 --- a/packaging/test_wheel.bash +++ b/packaging/test_wheel.bash @@ -2,6 +2,8 @@ # A simple set of tests checking if a wheel is working correctly set -xe +python -m pytest "$1/test/unit/pybind" find "$1/test/" "$1/nmodl/ext/" \ -name "*.mod" \ + -exec nmodl '{}' sympy --analytic \; \ -exec python -c "import nmodl; driver = nmodl.NmodlDriver(); driver.parse_file('{}')" \; diff --git a/pyproject.toml b/pyproject.toml index 4e35950392..2e76b1ec70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,24 +56,21 @@ NMODL_BUILD_WHEEL = "ON" [tool.cibuildwheel] skip = ["pp*", "*-win32", "*-manylinux_i686", "*-musllinux_i686", "*-musllinux_x86_64", "*-musllinux_aarch64"] +test-extras = ["test"] test-command = [ - "pytest {package}/test/unit/pybind", "bash {package}/packaging/test_wheel.bash {package}", ] -test-extras = ["test"] [tool.cibuildwheel.macos] environment = { PATH = "/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin:/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH", MACOSX_DEPLOYMENT_TARGET = "10.15" } config-settings = {build-dir = "_build"} -test-command = [ - "pytest {package}/test/unit/pybind", - "bash {package}/packaging/test_wheel.bash {package}", - "bash {package}/packaging/test_cli.bash {package}", -] [tool.cibuildwheel.linux] before-all = "bash packaging/install_dependencies.sh" environment = { PATH = "/nmodlwheel/flex/bin:/nmodlwheel/bison/bin:$PATH" } +# the Linux wheel is not tested in cibuildwheel due to manylinux images not having +# libpython*.so, so this is tested manually in the CI +test-command = "true" [tool.pytest.ini_options] testpaths = "test/unit/pybind"