@@ -326,15 +326,92 @@ 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+ # Find Linux .node files and patch their Python SONAME
346+ # Check system Python library symbols
347+ echo "=== Checking system Python library ==="
348+ PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
349+ PYTHON_LIB="/usr/lib/x86_64-linux-gnu/libpython${PYTHON_VERSION}.so.1.0"
350+ if [ -f "$PYTHON_LIB" ]; then
351+ echo "System Python library: $PYTHON_LIB"
352+ echo "PyContextVar_Type symbol in system library:"
353+ nm -D "$PYTHON_LIB" 2>/dev/null | grep PyContextVar_Type || echo "PyContextVar_Type not found in system library"
354+ else
355+ echo "System Python library not found at $PYTHON_LIB"
356+ echo "Available Python libraries:"
357+ find /usr/lib -name "libpython*.so*" 2>/dev/null || echo "No Python libraries found"
358+ fi
359+
360+ echo "=== Patching Python SONAME in Linux binaries ==="
361+ for file in *.node; do
362+ if [ -f "$file" ]; then
363+ case "$file" in
364+ *linux*)
365+ echo "Processing $file..."
366+
367+ # Check current dependencies
368+ echo "Current dependencies:"
369+ ldd "$file" 2>/dev/null | grep python || echo "No Python dependencies found"
370+
371+ # Try to patch libpython3.10.so.1.0 -> libpython3.x.so.1.0
372+ PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
373+ echo "Target Python version: $PYTHON_VERSION"
374+
375+ # Use patchelf to replace SONAME
376+ patchelf --replace-needed "libpython3.10.so.1.0" "libpython${PYTHON_VERSION}.so.1.0" "$file" 2>/dev/null || echo "No libpython3.10.so.1.0 to replace"
377+ patchelf --replace-needed "libpython3.11.so.1.0" "libpython${PYTHON_VERSION}.so.1.0" "$file" 2>/dev/null || echo "No libpython3.11.so.1.0 to replace"
378+ patchelf --replace-needed "libpython3.12.so.1.0" "libpython${PYTHON_VERSION}.so.1.0" "$file" 2>/dev/null || echo "No libpython3.12.so.1.0 to replace"
379+
380+ # Check new dependencies
381+ echo "New dependencies:"
382+ ldd "$file" 2>/dev/null | grep python || echo "No Python dependencies found"
383+
384+ # Check if PyContextVar_Type symbol is available
385+ echo "Checking for PyContextVar_Type symbol:"
386+ nm -D "$file" 2>/dev/null | grep PyContextVar_Type || echo "PyContextVar_Type not found in binary"
387+
388+ # Check what Python library is actually being used
389+ echo "Python library being used:"
390+ ldd "$file" 2>/dev/null | grep libpython || echo "No libpython found"
391+
392+ echo "---"
393+ ;;
394+ *)
395+ echo "Skipping non-Linux file: $file"
396+ ;;
397+ esac
398+ fi
399+ done
334400
335401 # Install pnpm and run tests
402+ echo "=== Installing pnpm ==="
336403 corepack disable
337404 npm i -gf pnpm
405+
406+ echo "=== Running pnpm install ==="
407+ # Should be non-interactive in CI environment
408+ pnpm install --prefer-offline
409+
410+ echo "=== Setting up Python library path ==="
411+ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
412+ echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
413+
414+ echo "=== Running tests ==="
338415 pnpm test
339416
340417 publish :
0 commit comments