Skip to content

Commit c9670f1

Browse files
find extension in pecl directory
Signed-off-by: James Xin <[email protected]>
1 parent daa497f commit c9670f1

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

.github/workflows/run-php-tests/action.yml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,29 +77,40 @@ runs:
7777
env:
7878
EXTENSION_PATH: ${{ inputs.extension-path }}
7979
run: |
80-
# Debug: Check if extension is loaded and classes exist
80+
# Find the actual .so file location
81+
SO_FILE=""
82+
83+
# Check common locations
84+
if [[ -f "$EXTENSION_PATH" ]]; then
85+
SO_FILE="$EXTENSION_PATH"
86+
elif [[ -f "$(php-config --extension-dir)/${EXTENSION_PATH}.so" ]]; then
87+
SO_FILE="$(php-config --extension-dir)/${EXTENSION_PATH}.so"
88+
else
89+
# Search for the extension in common PHP directories
90+
for dir in /opt/homebrew/lib/php/pecl /opt/homebrew/Cellar/php*/*/pecl /usr/lib/php; do
91+
FOUND=$(find "$dir" -name "${EXTENSION_PATH}.so" 2>/dev/null | head -1)
92+
if [[ -n "$FOUND" ]]; then
93+
SO_FILE="$FOUND"
94+
break
95+
fi
96+
done
97+
fi
98+
99+
if [[ -z "$SO_FILE" ]]; then
100+
echo "ERROR: Extension .so file not found"
101+
exit 1
102+
fi
103+
81104
echo "=== Extension Debug Info ==="
82-
echo "Extension path: $EXTENSION_PATH"
83-
echo "Loading extension by name: $EXTENSION_PATH"
105+
echo "Found extension at: $SO_FILE"
84106
85-
php -n -d "extension=$EXTENSION_PATH" -r "
107+
php -n -d "extension=$SO_FILE" -r "
86108
echo 'Extension loaded: ' . (extension_loaded('valkey_glide') ? 'YES' : 'NO') . PHP_EOL;
87-
echo 'Extension version: ' . phpversion('valkey_glide') . PHP_EOL;
88-
echo 'Extension functions: ' . PHP_EOL;
89-
foreach (get_extension_funcs('valkey_glide') as \$func) {
90-
echo ' - ' . \$func . PHP_EOL;
91-
}
92-
echo 'All declared classes: ' . PHP_EOL;
93-
foreach (get_declared_classes() as \$class) {
94-
if (strpos(\$class, 'Valkey') !== false || strpos(\$class, 'Client') !== false || strpos(\$class, 'Mock') !== false) {
95-
echo ' - ' . \$class . PHP_EOL;
96-
}
97-
}
98109
echo 'ClientConstructorMock exists: ' . (class_exists('ClientConstructorMock') ? 'YES' : 'NO') . PHP_EOL;
99110
"
100111
101-
# Run tests using extension loading
102-
php -n -d "extension=$EXTENSION_PATH" tests/TestValkeyGlide.php
112+
# Run tests
113+
php -n -d "extension=$SO_FILE" tests/TestValkeyGlide.php
103114
104115
- name: Run integration tests
105116
shell: bash

0 commit comments

Comments
 (0)