Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/sdk/generate-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ npx @openapitools/openapi-generator-cli generate \
-g php \
-c "${CONFIGS_DIR}/php.yaml" \
-o "${OUTPUT_DIR}" \
--additional-properties=invokerPackage=Shotstack\\\\Client,licenseName="MIT",composerPackageName="shotstack/shotstack-sdk-php",srcBasePath="src",artifactVersion="${VERSION}",artifactUrl="https://shotstack.io",developerOrganization="Shotstack",developerOrganizationUrl="https://shotstack.io"
--additional-properties=invokerPackage=Shotstack\\Client,licenseName="MIT",composerPackageName="shotstack/shotstack-sdk-php",srcBasePath="src",artifactVersion="${VERSION}",artifactUrl="https://shotstack.io",developerOrganization="Shotstack",developerOrganizationUrl="https://shotstack.io"

echo "PHP SDK generated at ${OUTPUT_DIR}"
52 changes: 40 additions & 12 deletions scripts/sdk/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@ case "${LANGUAGE}" in
;;

php)
if ! command -v php &>/dev/null; then
echo "✗ php not found — skipping (install PHP or use setup-php action in CI)"
exit 1
fi
echo "→ PHP syntax check..."
find "${SDK_DIR}/src" -name "*.php" -print0 | xargs -0 -n1 php -l 2>&1 | grep -v "No syntax errors" | head -20
php_errors=$(find "${SDK_DIR}/src" -name "*.php" -print0 | xargs -0 -n1 php -l 2>&1 | grep -c "Parse error" || true)
php_errors=0
while IFS= read -r -d '' file; do
if ! php -l "$file" 2>&1 | grep -q "No syntax errors"; then
php -l "$file" 2>&1
php_errors=$((php_errors + 1))
fi
done < <(find "${SDK_DIR}/src" -name "*.php" -print0)
if [ "${php_errors}" -gt 0 ]; then
echo "✗ ${php_errors} PHP syntax errors found"
exit 1
Expand All @@ -35,29 +44,48 @@ case "${LANGUAGE}" in
if [ -f "composer.json" ]; then
composer install --no-interaction --quiet 2>/dev/null || true
php -r "require_once 'vendor/autoload.php'; new \Shotstack\Client\Configuration();" 2>/dev/null || \
echo " (Skipping autoload check — composer deps may not be available in CI)"
echo " (Skipping autoload check — composer deps may not be available)"
fi
echo "✓ PHP smoke tests passed"
;;

python)
if ! command -v python3 &>/dev/null; then
echo "✗ python3 not found — skipping"
exit 1
fi
echo "→ Python syntax check..."
find "${SDK_DIR}" -name "*.py" -not -path "*/test/*" -print0 | \
xargs -0 python3 -m py_compile 2>&1 || {
echo "✗ Python syntax errors found"
exit 1
}
py_errors=0
while IFS= read -r -d '' file; do
if ! python3 -m py_compile "$file" 2>/dev/null; then
echo " Syntax error: $file"
py_errors=$((py_errors + 1))
fi
done < <(find "${SDK_DIR}/shotstack_sdk" -name "*.py" -not -path "*/test/*" -not -path "*/__pycache__/*" -print0)
if [ "${py_errors}" -gt 0 ]; then
echo "✗ ${py_errors} Python syntax errors found"
exit 1
fi
echo "→ Import check..."
cd "${SDK_DIR}"
python3 -c "import shotstack_sdk; print('Modules:', dir(shotstack_sdk))" 2>/dev/null || \
echo " (Skipping import check — dependencies may not be available in CI)"
echo " (Skipping import check — dependencies may not be available)"
echo "✓ Python smoke tests passed"
;;

ruby)
if ! command -v ruby &>/dev/null; then
echo "✗ ruby not found — skipping"
exit 1
fi
echo "→ Ruby syntax check..."
find "${SDK_DIR}/lib" -name "*.rb" -print0 | xargs -0 -n1 ruby -c 2>&1 | grep -v "Syntax OK" | head -20
ruby_errors=$(find "${SDK_DIR}/lib" -name "*.rb" -print0 | xargs -0 -n1 ruby -c 2>&1 | grep -c "SyntaxError" || true)
ruby_errors=0
while IFS= read -r -d '' file; do
if ! ruby -c "$file" 2>/dev/null | grep -q "Syntax OK"; then
ruby -c "$file" 2>&1
ruby_errors=$((ruby_errors + 1))
fi
done < <(find "${SDK_DIR}/lib" -name "*.rb" -print0)
if [ "${ruby_errors}" -gt 0 ]; then
echo "✗ ${ruby_errors} Ruby syntax errors found"
exit 1
Expand All @@ -67,7 +95,7 @@ case "${LANGUAGE}" in
if [ -f "Gemfile" ] || [ -f "shotstack.gemspec" ]; then
bundle install --quiet 2>/dev/null || true
ruby -e "require_relative 'lib/shotstack'; puts 'Module loaded: Shotstack'" 2>/dev/null || \
echo " (Skipping require check — gem deps may not be available in CI)"
echo " (Skipping require check — gem deps may not be available)"
fi
echo "✓ Ruby smoke tests passed"
;;
Expand Down
Loading