Skip to content

Commit 07dea03

Browse files
committed
Windows: skip site-packages copy when source dir is missing + propagate
flutter test failure on Windows runner. Two bugs surfaced in the previous Windows CI run: 1. The workflow-level env var SERIOUS_PYTHON_SITE_PACKAGES is set, but the directory it points at only exists when an outer step (the old cibuildwheel-based workflow) populated it. With the new pre-built-binary pipeline that step is gone, so cmake -E copy_directory ran against a missing source and CopyPythonDLLs.vcxproj exited 1. Guard with `if(DEFINED ENV{...} AND EXISTS "$ENV{...}")`. 2. The Windows job's GitHub Actions step used the default PowerShell shell, where `flutter test ... | tail -200` swallows flutter's non-zero exit (PowerShell pipelines don't honor pipefail). Tests reported "0 tests passed, 1 failed" yet the step reported success. Switch to `shell: bash` + explicit `set -o pipefail` so failures surface.
1 parent 195b604 commit 07dea03

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/test-bridge-build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,14 @@ jobs:
197197

198198
- name: Package + run integration test
199199
working-directory: "src/serious_python/example/bridge_example"
200+
shell: bash
200201
run: |
201202
dart run serious_python:main package app/src --platform Windows --python-version ${{ matrix.python_version }}
202-
flutter test integration_test -d windows -v 2>&1 | tail -200
203+
# bash + pipefail so the test step actually fails when flutter fails
204+
# (default PowerShell shell on windows runners eats the failure when
205+
# piping into tail).
206+
set -o pipefail
207+
flutter test integration_test -d windows -v 2>&1 | tail -300
203208
204209
- name: Diagnostics on failure
205210
if: failure()

src/serious_python_windows/windows/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,17 @@ add_custom_command(TARGET CopyPythonDLLs POST_BUILD
139139
-P "${CMAKE_CURRENT_SOURCE_DIR}/rm_globs.cmake"
140140
)
141141

142-
if(DEFINED ENV{SERIOUS_PYTHON_SITE_PACKAGES})
142+
# Mirror the user's external site-packages dir into runner/site-packages if
143+
# the env var is set AND points at an existing directory. (The CI env var
144+
# may be set workflow-wide while specific jobs don't actually create the
145+
# directory — `cmake -E copy_directory` against a missing source fails,
146+
# which used to wedge CopyPythonDLLs.)
147+
if(DEFINED ENV{SERIOUS_PYTHON_SITE_PACKAGES} AND EXISTS "$ENV{SERIOUS_PYTHON_SITE_PACKAGES}")
143148
add_custom_command(TARGET CopyPythonDLLs POST_BUILD
144-
COMMAND ${CMAKE_COMMAND} -E remove_directory
145-
"${CMAKE_BINARY_DIR}/runner/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>/site-packages"
146-
COMMAND ${CMAKE_COMMAND} -E make_directory
147-
"${CMAKE_BINARY_DIR}/runner/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>/site-packages"
149+
COMMAND ${CMAKE_COMMAND} -E rm -rf "${SP_RUNNER_OUT}/site-packages"
150+
COMMAND ${CMAKE_COMMAND} -E make_directory "${SP_RUNNER_OUT}/site-packages"
148151
COMMAND ${CMAKE_COMMAND} -E copy_directory
149152
"$ENV{SERIOUS_PYTHON_SITE_PACKAGES}"
150-
"${CMAKE_BINARY_DIR}/runner/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>/site-packages"
153+
"${SP_RUNNER_OUT}/site-packages"
151154
)
152155
endif()

0 commit comments

Comments
 (0)