@@ -326,15 +326,83 @@ jobs:
326326 uses : addnab/docker-run-action@v3
327327 with :
328328 image : ${{ steps.docker.outputs.IMAGE }}
329- options : -v ${{ steps.docker.outputs.PNPM_STORE_PATH }}:${{ steps.docker.outputs.PNPM_STORE_PATH }} -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}
329+ options : -v ${{ steps.docker.outputs.PNPM_STORE_PATH }}:${{ steps.docker.outputs.PNPM_STORE_PATH }} -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }} -e CI=true -e GITHUB_ACTIONS=true
330330 run : |
331331 # Install Python 3.9+ (any version will work with abi3-py39)
332332 apt-get update -y
333- apt-get install -y python3 python3-dev
333+ apt-get install -y python3 python3-dev patchelf
334+
335+ echo "=== Starting test setup ==="
336+ echo "Current directory: $(pwd)"
337+ echo "Python version: $(python3 --version)"
338+ echo "Patchelf version: $(patchelf --version)"
339+ echo "CI environment: CI=$CI, GITHUB_ACTIONS=$GITHUB_ACTIONS"
340+
341+ # Check what .node files exist
342+ echo "=== Available .node files ==="
343+ ls -la *.node || echo "No .node files found"
344+
345+ # Check what Python version the binary was built with and patch SONAME if needed
346+ echo "=== Checking .node file Python dependencies ==="
347+ for file in *.node; do
348+ if [ -f "$file" ]; then
349+ case "$file" in
350+ *linux*)
351+ echo "Checking $file..."
352+ echo "Python dependencies before patching:"
353+ ldd "$file" 2>/dev/null | grep python || echo "No Python dependencies found"
354+
355+ # Check if we need to patch SONAME
356+ current_python_lib=$(ldd "$file" 2>/dev/null | grep "libpython" | head -1 | awk '{print $1}')
357+ if [ -n "$current_python_lib" ]; then
358+ echo "Current Python library: $current_python_lib"
359+
360+ # Find the actual Python library on the system
361+ system_python_lib=$(find /usr/lib* -name "libpython3*.so.*" -type f 2>/dev/null | head -1)
362+ if [ -n "$system_python_lib" ]; then
363+ system_python_soname=$(basename "$system_python_lib")
364+ echo "System Python library: $system_python_soname"
365+
366+ # Only patch if they're different
367+ if [ "$current_python_lib" != "$system_python_soname" ]; then
368+ echo "Patching SONAME from $current_python_lib to $system_python_soname"
369+ patchelf --replace-needed "$current_python_lib" "$system_python_soname" "$file"
370+ echo "SONAME patching completed"
371+ else
372+ echo "SONAME already matches system Python"
373+ fi
374+ else
375+ echo "Warning: Could not find system Python library"
376+ fi
377+ else
378+ echo "No Python library dependency found"
379+ fi
380+
381+ echo "Python dependencies after patching:"
382+ ldd "$file" 2>/dev/null | grep python || echo "No Python dependencies found"
383+ echo "---"
384+ ;;
385+ *)
386+ echo "Skipping non-Linux file: $file"
387+ ;;
388+ esac
389+ fi
390+ done
334391
335392 # Install pnpm and run tests
393+ echo "=== Installing pnpm ==="
336394 corepack disable
337395 npm i -gf pnpm
396+
397+ echo "=== Running pnpm install ==="
398+ # Should be non-interactive in CI environment
399+ pnpm install --prefer-offline
400+
401+ echo "=== Setting up Python library path ==="
402+ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
403+ echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
404+
405+ echo "=== Running tests ==="
338406 pnpm test
339407
340408 publish :
0 commit comments