diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a72908d2..82c72e79 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,7 +34,7 @@ jobs: run: python3 -m pip install setuptools_scm --break-system-packages - name: Configure - run: cmake -S . -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*" + run: cmake -S. -Bbuild -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*" - name: Build run: cmake --build build -j 2 @@ -80,10 +80,10 @@ jobs: allow-prereleases: true - name: Install python tools - run: python -m pip install -r dev-requirements.txt pytest-github-actions-annotate-failures numpy>=2.0a1 + run: python -m pip install -r dev-requirements.txt pytest-github-actions-annotate-failures numpy>=2.0.0rc1 - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBOOST_HISTOGRAM_ERRORS=ON ${{ matrix.cmake-extras }} + run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DBOOST_HISTOGRAM_ERRORS=ON ${{ matrix.cmake-extras }} - name: Build run: cmake --build build -j 2 @@ -98,7 +98,17 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-2019, macos-13, macos-14] + include: + - os: ubuntu-latest + build: cp312-manylinux_x86_64 + - os: windows-2019 + build: cp38-win32 + - os: windows-2019 + build: cp37-win_amd64 + - os: macos-13 + build: cp39-macosx_x86_64 + - os: macos-14 + build: cp39-macosx_arm64 steps: - uses: actions/checkout@v4 @@ -112,7 +122,7 @@ jobs: - uses: pypa/cibuildwheel@v2.17 env: - CIBW_BUILD: cp38-win32 cp37-win_amd64 cp312-manylinux_x86_64 cp39-macosx_* + CIBW_BUILD: "${{ matrix.build }}" CIBW_BUILD_VERBOSITY: 1 - uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 89880d1d..cc27945e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,7 @@ target_include_directories( # Support older Windows from newer MSVC target_compile_options(_core PRIVATE $<$:/d2FH4->) + # Better error messages target_compile_definitions(_core PRIVATE PYBIND11_DETAILED_ERROR_MESSAGES) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9ad27a86..d84700d2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,6 +2,9 @@ pybind11_find_import(numpy) pybind11_find_import(pytest) pybind11_find_import(pytest-benchmark) +# Much better test target on CMake 3.29+ +set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE) + # Support for running from build directory file(WRITE "${PROJECT_BINARY_DIR}/pytest.ini" "[pytest]\n" "addopts = --benchmark-disable\n" "testpaths = ${CMAKE_CURRENT_SOURCE_DIR}\n") @@ -18,8 +21,6 @@ foreach(TEST_FILE IN LISTS BOOST_HIST_PY_TESTS) get_filename_component(TEST_NAME "${TEST_FILE}" NAME_WE) add_test( NAME ${TEST_NAME} - COMMAND ${PYTHON_EXECUTABLE} -m pytest "${TEST_FILE}" --rootdir=. + COMMAND ${Python_EXECUTABLE} -m pytest "${TEST_FILE}" --rootdir=. WORKING_DIRECTORY "${PROJECT_BINARY_DIR}") endforeach() - -add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose)