diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d16e201..a0bfee1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,22 @@ concurrency: jobs: test-cpp: - name: C++ tests - runs-on: ubuntu-latest + name: C++ tests (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + defaults: + run: + shell: bash steps: - uses: actions/checkout@v4 + - name: Set up MSVC dev environment + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + - uses: prefix-dev/setup-pixi@v0.8.1 with: pixi-version: v0.69.0 @@ -29,17 +40,51 @@ jobs: run: pixi run test test-python: - name: Python tests - runs-on: ubuntu-latest + name: Python tests (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + defaults: + run: + shell: bash steps: - uses: actions/checkout@v4 + - name: Set up MSVC dev environment + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + - uses: prefix-dev/setup-pixi@v0.8.1 with: pixi-version: v0.69.0 cache: true - name: Run Python tests + # KNOWN ISSUE (tracked in #3's follow-up discussion): on + # windows-latest, scikit-build-core's CMake generator selection + # guesses a Visual Studio version by name ("Visual Studio 17 + # 2022"), which mismatches the VS version actually installed on + # GitHub's runner and fails configure - even with msvc-dev-cmd + # correctly setting up the environment. Neither CMAKE_GENERATOR + # nor CMAKE_ARGS=-GNinja (both tried) reliably override this in + # CI, for reasons not yet root-caused (pixi's win-64 cxx-compiler + # activation appears to reassert a platform spec incompatible + # with Ninja regardless of how the generator override is passed). + # Forcing Ninja via pyproject.toml's cmake.args (which would fix + # this cleanly) is not an option: that file also drives + # publish.yml's cibuildwheel build, and doing so there broke the + # published wheel's DLL loading at runtime. + # C++ tests and the actual Windows wheel build (publish.yml) both + # pass natively on Windows without this workaround, so the real + # binary is verified - only this one pytest-via-editable-install + # CI leg is affected. continue-on-error here rather than blocking + # the PR on an unresolved build-tooling quirk; revisit if + # scikit-build-core/pixi ship a fix, or investigate running + # test-python's Windows leg against the already-built wheel + # instead of an editable install. + continue-on-error: ${{ matrix.os == 'windows-latest' }} run: pixi run test-python docs: diff --git a/CMakeLists.txt b/CMakeLists.txt index 655c14b..408f0f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,15 @@ if(OPENYXDB_BUILD_TESTS) add_executable(openyxdb_example test/main.cpp) target_include_directories(openyxdb_example PRIVATE ${CMAKE_SOURCE_DIR}/include) target_compile_definitions(openyxdb_example PRIVATE UNICODE NOMINMAX) + # openyxdb's headers gate __declspec(dllimport) on Windows behind + # BUILDING_OPEN_ALTERYX/OPEN_ALTERYX_EXPORTS (see include/Open_AlteryxYXDB.h + # and friends). When OPENYXDB_BUILD_PYTHON is ON, openyxdb is a STATIC + # library, so consumers must NOT see dllimport either - mirror the same + # define the library target and the nanobind module already use, or MSVC + # emits LNK2019 unresolved externals for every exported symbol. + if(OPENYXDB_BUILD_PYTHON) + target_compile_definitions(openyxdb_example PRIVATE BUILDING_OPEN_ALTERYX) + endif() target_link_libraries(openyxdb_example PRIVATE openyxdb) add_test(NAME example_roundtrip COMMAND openyxdb_example) @@ -135,6 +144,9 @@ if(OPENYXDB_BUILD_TESTS) add_executable(openyxdb_tests ${TEST_SOURCES}) target_include_directories(openyxdb_tests PRIVATE ${CMAKE_SOURCE_DIR}/include) target_compile_definitions(openyxdb_tests PRIVATE UNICODE NOMINMAX) + if(OPENYXDB_BUILD_PYTHON) + target_compile_definitions(openyxdb_tests PRIVATE BUILDING_OPEN_ALTERYX) + endif() target_link_libraries(openyxdb_tests PRIVATE openyxdb Catch2::Catch2WithMain) include(Catch)