8000 TST: Add cygwin build to CI by DWesl · Pull Request #18330 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TST: Add cygwin build to CI #18330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 21, 2021
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
67 changes: 67 additions & 0 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Test on Cygwin
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
cygwin_build_test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Install Cygwin
uses: egor-tensin/setup-cygwin@v3
with:
platform: x64
install-dir: 'C:\tools\cygwin'
packages: >
python37-devel python37-zipp python37-importlib-metadata
python37-cython python37-pip python37-wheel python37-cffi
python37-pytz python37-setuptools python37-pytest
python37-hypothesis liblapack-devel libopenblas
gcc-fortran git dash
- name: Set Windows PATH
uses: egor-tensin/cleanup-path@v1
with:
dirs: 'C:\tools\cygwin\bin;C:\tools\cygwin\lib\lapack'
- name: Verify that bash is Cygwin bash
run: |
command bash
bash -c "uname -svrmo"
- name: Update with Cygwin git
# fetch-depth=0 above should make this short.
run: |
dash -c "which git; /usr/bin/git fetch --all -p"
- name: Verify python version
# Make sure it's the Cygwin one, not a Windows one
run: |
dash -c "which python3.7; /usr/bin/python3.7 --version -V"
- name: Build NumPy wheel
run: |
dash -c "/usr/bin/python3.7 -m pip install 'setuptools<49.2.0' pytest pytz cffi pickle5 importlib_metadata typing_extensions"
dash -c "/usr/bin/python3.7 -m pip install -r test_requirements.txt"
dash -c "/usr/bin/python3.7 setup.py bdist_wheel"
- name: Install new NumPy
run: |
bash -c "/usr/bin/python3.7 -m pip install dist/numpy-*cp37*.whl"
- name: Run NumPy test suite
run: >-
dash -c "/usr/bin/python3.7 runtests.py -n -vv"
- name: Upload wheel if tests fail
uses: actions/upload-artifact@v2
if: failure()
with:
name: numpy-cygwin-wheel
path: dist/numpy-*cp37*.whl
- name: On failure check the extension modules
if: failure()
run: |
dash -c "/usr/bin/python3.7 -m pip show numpy"
dash -c "/usr/bin/python3.7 -m pip show -f numpy | grep .dll"
dash -c "/bin/tr -d '\r' <tools/list_installed_dll_dependencies_cygwin.sh >list_dlls_unix.sh"
dash "list_dlls_unix.sh"
2 changes: 1 addition & 1 deletion numpy/core/include/numpy/random/distributions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C" {
#define RAND_INT_MAX INT64_MAX
#endif

#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__CYGWIN__)
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR extern
Expand Down
45 changes: 45 additions & 0 deletions numpy/core/src/common/npy_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,51 @@
#undef HAVE_POWL
#endif

#ifdef __CYGWIN__
/* Loss of precision */
#undef HAVE_CASINHL
#undef HAVE_CASINH
#undef HAVE_CASINHF

/* Loss of precision */
#undef HAVE_CATANHL
#undef HAVE_CATANH
#undef HAVE_CATANHF

/* Loss of precision and branch cuts */
#undef HAVE_CATANL
#undef HAVE_CATAN
#undef HAVE_CATANF

/* Branch cuts */
#undef HAVE_CACOSHF
#undef HAVE_CACOSH

/* Branch cuts */
#undef HAVE_CSQRTF
#undef HAVE_CSQRT

/* Branch cuts and loss of precision */
#undef HAVE_CASINF
#undef HAVE_CASIN
#undef HAVE_CASINL

/* Branch cuts */
#undef HAVE_CACOSF
#undef HAVE_CACOS

/* log2(exp2(i)) off by a few eps */
#undef HAVE_LOG2

/* np.power(..., dtype=np.complex256) doesn't report overflow */
#undef HAVE_CPOWL
#undef HAVE_CEXPL

/* Builtin abs reports overflow */
#undef HAVE_CABSL
#undef HAVE_HYPOTL
#endif

/* Disable broken gnu trig functions */
#if defined(HAVE_FEATURES_H)
#include <features.h>
Expand Down
8 changes: 8 additions & 0 deletions numpy/core/tests/test_scalarmath.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,18 @@ def _test_abs_func(self, absfunc, test_dtype):

@pytest.mark.parametrize("dtype", floating_types + complex_floating_types)
def test_builtin_abs(self, dtype):
if sys.platform == "cygwin" and dtype == np.clongdouble:
pytest.xfail(
reason="absl is computed in double precision on cygwin"
)
self._test_abs_func(abs, dtype)

@pytest.mark.parametrize("dtype", floating_types + complex_floating_types)
def test_numpy_abs(self, dtype):
if sys.platform == "cygwin" and dtype == np.clongdouble:
pytest.xfail(
reason="absl is computed in double precision on cygwin"
)
self._test_abs_func(np.abs, dtype)

class TestBitShifts:
Expand Down
38 changes: 38 additions & 0 deletions tools/list_installed_dll_dependencies_cygwin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/dash
# Check permissions and dependencies on installed DLLs
# DLLs need execute permissions to be used
# DLLs must be able to find their dependencies
# This checks both of those, then does a direct test
# The best way of checking whether a C extension module is importable
# is trying to import it. The rest is trying to give reasons why it
# isn't importing.
#
# One of the tools and the extension for shared libraries are
# Cygwin-specific, but the rest should work on most platforms with
# /bin/sh

py_ver=3.7
site_packages=$(python${py_ver} -m pip show numpy | \
grep Location | cut -d " " -f 2 -);
dll_list=$(for name in $(python${py_ver} -m pip show -f numpy | \
grep -F .dll); do echo ${site_packages}/${name}; done)
echo "Checks for existence, permissions and file type"
ls -l ${dll_list}
file ${dll_list}
echo "Dependency checks"
ldd ${dll_list} | grep -F -e " => not found" && exit 1
cygcheck ${dll_list} >cygcheck_dll_list 2>cygcheck_missing_deps
grep -F -e "cygcheck: track_down: could not find " cygcheck_missing_deps && exit 1
echo "Import tests"
mkdir -p dist/
cd dist/
for name in ${dll_list};
do
echo ${name}
ext_module=$(echo ${name} | \
sed -E \
-e "s/^\/+(home|usr).*?site-packages\/+//" \
-e "s/.cpython-3.m?-x86(_64)?-cygwin.dll$//" \
-e "s/\//./g")
python${py_ver} -c "import ${ext_module}"
done
0