Skip to content

Commit cf73ced

Browse files
committed
ci: fail the macOS example build on linker-signed bundled libraries
After the integration tests, check every .so/.dylib under the built app's Contents/Resources and fail if any still carries a linker signature, on both the CocoaPods and SwiftPM legs.
1 parent 45fb46f commit cf73ced

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,31 @@ jobs:
138138
flutter test integration_test/throughput_test.dart -d macos --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }}
139139
flutter test integration_test/memory_test.dart -d macos --dart-define=EXPECTED_PYTHON_VERSION=${{ matrix.python_version }}
140140
141+
- name: Check bundled native libraries are not linker-signed
142+
working-directory: "src/serious_python/example/bridge_example"
143+
run: |
144+
# Xcode distribution signing mis-signs linker-signed libraries (see
145+
# src/serious_python_darwin/darwin/linker_signatures.sh), so none may
146+
# reach the app bundle.
147+
app=$(find build/macos/Build/Products -maxdepth 2 -type d -name '*.app' | head -n 1)
148+
if [ -z "$app" ]; then
149+
echo "::error::No built app under build/macos/Build/Products"
150+
exit 1
151+
fi
152+
total=0
153+
linker_signed=0
154+
while IFS= read -r bin; do
155+
total=$((total + 1))
156+
case $(codesign -d --verbose=1 "$bin" 2>&1) in
157+
*"CodeDirectory "*linker-signed*)
158+
echo "::error::Linker-signed: ${bin#"$app"/}"
159+
linker_signed=$((linker_signed + 1))
160+
;;
161+
esac
162+
done < <(find "$app/Contents/Resources" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.dylib' \))
163+
echo "Checked $total bundled native libraries, $linker_signed linker-signed."
164+
[ "$total" -gt 0 ] && [ "$linker_signed" -eq 0 ]
165+
141166
bridge_example_ios:
142167
name: Test Bridge example on iOS (${{ matrix.build_system }}, Python ${{ matrix.python_version }})
143168
if: ${{ !startsWith(github.ref, 'refs/tags/') }}

0 commit comments

Comments
 (0)