Skip to content

Commit 4f29b8a

Browse files
ci: extend msys2 mingw CI (#3207)
* extend msys2 CI - add 32-bit job - add c++11/17 c++/interface tests copied from standard ci - add numpy/scipy * account for padding of PartialStruct in numpy dtypes test with mingw32 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * msys2 ci: add c++14 tests Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 998d45e commit 4f29b8a

File tree

2 files changed

+78
-17
lines changed

2 files changed

+78
-17
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -861,32 +861,85 @@ jobs:
861861
run: cmake --build build -t check
862862

863863
mingw:
864+
name: "🐍 3 • windows-latest • ${{ matrix.sys }}"
864865
runs-on: windows-latest
865866
defaults:
866867
run:
867868
shell: msys2 {0}
869+
strategy:
870+
fail-fast: false
871+
matrix:
872+
include:
873+
- { sys: mingw64, env: x86_64 }
874+
- { sys: mingw32, env: i686 }
868875
steps:
869876
- uses: msys2/setup-msys2@v2
870877
with:
878+
msystem: ${{matrix.sys}}
871879
install: >-
872-
mingw-w64-x86_64-gcc
873-
mingw-w64-x86_64-python-pip
874-
mingw-w64-x86_64-cmake
875-
mingw-w64-x86_64-make
876-
mingw-w64-x86_64-python-pytest
877-
mingw-w64-x86_64-eigen3
878-
mingw-w64-x86_64-boost
879-
mingw-w64-x86_64-catch
880+
git
881+
mingw-w64-${{matrix.env}}-gcc
882+
mingw-w64-${{matrix.env}}-python-pip
883+
mingw-w64-${{matrix.env}}-python-numpy
884+
mingw-w64-${{matrix.env}}-python-scipy
885+
mingw-w64-${{matrix.env}}-cmake
886+
mingw-w64-${{matrix.env}}-make
887+
mingw-w64-${{matrix.env}}-python-pytest
888+
mingw-w64-${{matrix.env}}-eigen3
889+
mingw-w64-${{matrix.env}}-boost
890+
mingw-w64-${{matrix.env}}-catch
880891
881-
- uses: actions/checkout@v1
892+
- uses: actions/checkout@v2
882893

883-
- name: Configure
894+
- name: Configure C++11
884895
# LTO leads to many undefined reference like
885896
# `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&)
886-
run: cmake -G "MinGW Makefiles" -S . -B build
897+
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -S . -B build
887898

888-
- name: Build
899+
- name: Build C++11
889900
run: cmake --build build -j 2
890901

891-
- name: Python tests
892-
run: cmake --build build --target pytest
902+
- name: Python tests C++11
903+
run: cmake --build build --target pytest -j 2
904+
905+
- name: C++11 tests
906+
run: cmake --build build --target cpptest -j 2
907+
908+
- name: Interface test C++11
909+
run: cmake --build build --target test_cmake_build
910+
911+
- name: Clean directory
912+
run: git clean -fdx
913+
914+
- name: Configure C++14
915+
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -S . -B build2
916+
917+
- name: Build C++14
918+
run: cmake --build build2 -j 2
919+
920+
- name: Python tests C++14
921+
run: cmake --build build2 --target pytest -j 2
922+
923+
- name: C++14 tests
924+
run: cmake --build build2 --target cpptest -j 2
925+
926+
- name: Interface test C++14
927+
run: cmake --build build2 --target test_cmake_build
928+
929+
- name: Clean directory
930+
run: git clean -fdx
931+
932+
- name: Configure C++17
933+
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -S . -B build3
934+
935+
- name: Build C++17
936+
run: cmake --build build3 -j 2
937+
938+
- name: Python tests C++17
939+
run: cmake --build build3 --target pytest -j 2
940+
941+
- name: C++17 tests
942+
run: cmake --build build3 --target cpptest -j 2
943+
944+
- name: Interface test C++17
945+
run: cmake --build build3 --target test_cmake_build

tests/test_numpy_dtypes.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,20 @@ def partial_ld_offset():
6363
def partial_dtype_fmt():
6464
ld = np.dtype("longdouble")
6565
partial_ld_off = partial_ld_offset()
66-
return dt_fmt().format(ld.itemsize, partial_ld_off, partial_ld_off + ld.itemsize)
66+
partial_size = partial_ld_off + ld.itemsize
67+
partial_end_padding = partial_size % np.dtype("uint64").alignment
68+
return dt_fmt().format(
69+
ld.itemsize, partial_ld_off, partial_size + partial_end_padding
70+
)
6771

6872

6973
def partial_nested_fmt():
7074
ld = np.dtype("longdouble")
7175
partial_nested_off = 8 + 8 * (ld.alignment > 8)
7276
partial_ld_off = partial_ld_offset()
73-
partial_nested_size = partial_nested_off * 2 + partial_ld_off + ld.itemsize
77+
partial_size = partial_ld_off + ld.itemsize
78+
partial_end_padding = partial_size % np.dtype("uint64").alignment
79+
partial_nested_size = partial_nested_off * 2 + partial_size + partial_end_padding
7480
return "{{'names':['a'], 'formats':[{}], 'offsets':[{}], 'itemsize':{}}}".format(
7581
partial_dtype_fmt(), partial_nested_off, partial_nested_size
7682
)
@@ -91,10 +97,12 @@ def test_format_descriptors():
9197
ldbl_fmt = ("4x" if ld.alignment > 4 else "") + ld.char
9298
ss_fmt = "^T{?:bool_:3xI:uint_:f:float_:" + ldbl_fmt + ":ldbl_:}"
9399
dbl = np.dtype("double")
100+
end_padding = ld.itemsize % np.dtype("uint64").alignment
94101
partial_fmt = (
95102
"^T{?:bool_:3xI:uint_:f:float_:"
96103
+ str(4 * (dbl.alignment > 4) + dbl.itemsize + 8 * (ld.alignment > 8))
97-
+ "xg:ldbl_:}"
104+
+ "xg:ldbl_:"
105+
+ (str(end_padding) + "x}" if end_padding > 0 else "}")
98106
)
99107
nested_extra = str(max(8, ld.alignment))
100108
assert m.print_format_descriptors() == [

0 commit comments

Comments
 (0)