9
9
workflow_dispatch :
10
10
inputs :
11
11
php_version :
12
- description : ' PHP version to build (leave empty for auto-detection)'
12
+ description : PHP version to build (leave empty for auto-detection)
13
13
required : false
14
14
type : string
15
15
php_config :
16
- description : ' PHP build configuration'
16
+ description : PHP build configuration
17
17
required : true
18
- default : ' laravel-mysql'
18
+ default : laravel-mysql
19
19
type : choice
20
20
options :
21
21
- laravel-mysql
26
26
- wordpress
27
27
- full-stack
28
28
force_rebuild :
29
- description : ' Force rebuild even if no updates'
29
+ description : Force rebuild even if no updates
30
30
required : false
31
31
default : false
32
32
type : boolean
@@ -243,7 +243,7 @@ jobs:
243
243
binaries/$BINARY_NAME/bin/php --version
244
244
echo "📋 All available extensions:"
245
245
binaries/$BINARY_NAME/bin/php -m
246
-
246
+
247
247
# Define essential extensions that MUST be present
248
248
REQUIRED_EXTENSIONS=(
249
249
"Core" "date" "hash" "json" "pcre" "Reflection" "SPL" "standard"
@@ -252,10 +252,10 @@ jobs:
252
252
"curl" "openssl" "zip" "zlib" "calendar" "ftp" "pcntl" "posix"
253
253
"shmop" "sockets" "exif" "bcmath" "bz2" "gettext" "readline"
254
254
)
255
-
255
+
256
256
# Define Zend extensions that need special checking
257
257
ZEND_EXTENSIONS=("opcache")
258
-
258
+
259
259
# Test each required extension
260
260
echo "🧪 Testing essential extensions..."
261
261
MISSING_EXTENSIONS=()
@@ -268,7 +268,7 @@ jobs:
268
268
MISSING_EXTENSIONS+=("$ext")
269
269
fi
270
270
done
271
-
271
+
272
272
# Test Zend extensions separately
273
273
for ext in "${ZEND_EXTENSIONS[@]}"; do
274
274
EXT_LOADED=$(binaries/$BINARY_NAME/bin/php -r "echo function_exists('opcache_get_status') ? '1' : '0';")
@@ -279,22 +279,22 @@ jobs:
279
279
MISSING_EXTENSIONS+=("$ext")
280
280
fi
281
281
done
282
-
282
+
283
283
# Check if any essential extensions are missing
284
284
if [ ${#MISSING_EXTENSIONS[@]} -gt 0 ]; then
285
285
echo "❌ Critical extensions missing: ${MISSING_EXTENSIONS[*]}"
286
286
echo "This build is incomplete and will cause issues with Composer and Laravel."
287
287
exit 1
288
288
fi
289
-
289
+
290
290
# Test phar extension functionality specifically
291
291
echo "🧪 Testing phar extension functionality..."
292
292
PHAR_LOADED=$(binaries/$BINARY_NAME/bin/php -r 'echo extension_loaded("phar") ? "1" : "0";')
293
293
if [ "$PHAR_LOADED" = "1" ]; then
294
294
echo "✅ Phar extension is loaded"
295
295
# Test phar creation (essential for Composer)
296
296
echo "🧪 Testing phar creation..."
297
- echo '<?php
297
+ echo '<?php
298
298
if (extension_loaded("phar")) {
299
299
try {
300
300
$phar = new Phar("test.phar");
@@ -316,7 +316,7 @@ jobs:
316
316
echo "❌ Phar extension not loaded - this will break Composer!"
317
317
exit 1
318
318
fi
319
-
319
+
320
320
# Test Composer compatibility
321
321
echo "🧪 Testing Composer compatibility..."
322
322
echo '<?php
@@ -325,7 +325,7 @@ jobs:
325
325
"iconv", "mb_strlen", "filter_var", "hash", "json_encode",
326
326
"curl_init", "openssl_get_cert_locations", "file_get_contents"
327
327
];
328
-
328
+
329
329
foreach ($required_functions as $func) {
330
330
if (function_exists($func)) {
331
331
echo "✅ Function $func: Available\n";
@@ -334,7 +334,7 @@ jobs:
334
334
exit(1);
335
335
}
336
336
}
337
-
337
+
338
338
// Test essential classes
339
339
$required_classes = ["Phar", "DOMDocument", "XMLReader", "ZipArchive"];
340
340
foreach ($required_classes as $class) {
@@ -345,12 +345,12 @@ jobs:
345
345
exit(1);
346
346
}
347
347
}
348
-
348
+
349
349
echo "✅ All Composer compatibility checks passed\n";
350
350
?>' > test_composer_compat.php
351
351
binaries/$BINARY_NAME/bin/php test_composer_compat.php
352
352
rm test_composer_compat.php
353
-
353
+
354
354
echo "✅ All PHP binary tests passed successfully!"
355
355
else
356
356
echo "❌ PHP binary not found"
@@ -365,25 +365,25 @@ jobs:
365
365
$phpExeBin = "binaries\$BINARY_NAME\bin\php.exe"
366
366
$PHP = if (Test-Path -Path $phpExeRoot -PathType Leaf) { $phpExeRoot } elseif (Test-Path -Path $phpExeBin -PathType Leaf) { $phpExeBin } else { $null }
367
367
Write-Host "Checking for binary at: $PHP"
368
-
368
+
369
369
# List all files in the binary directory to verify structure
370
370
Write-Host "📂 Binary directory structure:"
371
371
Get-ChildItem -Path "binaries\$BINARY_NAME" -Recurse | Format-Table Name, Length, LastWriteTime
372
-
372
+
373
373
# Check if the PHP binary exists
374
374
if ($PHP -and (Test-Path -Path $PHP -PathType Leaf)) {
375
375
Write-Host "✅ PHP binary exists at expected location"
376
-
376
+
377
377
# Get file size to verify it's a real binary (not just a placeholder)
378
378
$fileSize = (Get-Item $PHP).Length
379
379
Write-Host "📊 PHP binary size: $fileSize bytes"
380
-
380
+
381
381
# Test PHP version and extensions
382
382
Write-Host "🧪 Testing PHP binary..."
383
383
& $PHP --version
384
384
Write-Host "📋 All available extensions:"
385
385
& $PHP -m
386
-
386
+
387
387
# Define essential extensions that MUST be present
388
388
$REQUIRED_EXTENSIONS = @(
389
389
"Core", "date", "hash", "json", "pcre", "Reflection", "SPL", "standard",
@@ -392,10 +392,10 @@ jobs:
392
392
"curl", "openssl", "zip", "zlib", "calendar", "ftp",
393
393
"shmop", "sockets", "exif", "bcmath", "bz2", "gettext", "readline"
394
394
)
395
-
395
+
396
396
# Define Zend extensions that need special checking
397
397
$ZEND_EXTENSIONS = @("opcache")
398
-
398
+
399
399
# Test each required extension
400
400
Write-Host "🧪 Testing essential extensions..."
401
401
$MISSING_EXTENSIONS = @()
@@ -408,7 +408,7 @@ jobs:
408
408
$MISSING_EXTENSIONS += $ext
409
409
}
410
410
}
411
-
411
+
412
412
# Test Zend extensions separately
413
413
foreach ($ext in $ZEND_EXTENSIONS) {
414
414
$extLoaded = & $PHP -r "echo function_exists('opcache_get_status') ? '1' : '0';"
@@ -419,14 +419,14 @@ jobs:
419
419
$MISSING_EXTENSIONS += $ext
420
420
}
421
421
}
422
-
422
+
423
423
# Check if any essential extensions are missing
424
424
if ($MISSING_EXTENSIONS.Count -gt 0) {
425
425
Write-Host "❌ Critical extensions missing: $($MISSING_EXTENSIONS -join ', ')"
426
426
Write-Host "This build is incomplete and will cause issues with Composer and Laravel."
427
427
exit 1
428
428
}
429
-
429
+
430
430
# Test phar extension functionality specifically
431
431
Write-Host "🧪 Testing phar extension functionality..."
432
432
$pharLoaded = & $PHP -r 'echo extension_loaded("phar") ? "1" : "0";'
@@ -445,22 +445,22 @@ jobs:
445
445
Write-Host "❌ Phar extension not loaded - this will break Composer!"
446
446
exit 1
447
447
}
448
-
448
+
449
449
# Test Composer compatibility
450
450
Write-Host "🧪 Testing Composer compatibility..."
451
451
$composerTestContent = "<?php`n// Test essential functions for Composer`n`$required_functions = [`n `"iconv`", `"mb_strlen`", `"filter_var`", `"hash`", `"json_encode`",`n `"curl_init`", `"openssl_get_cert_locations`", `"file_get_contents`"`n];`n`nforeach (`$required_functions as `$func) {`n if (function_exists(`$func)) {`n echo `"✅ Function `$func: Available\n`";`n } else {`n echo `"❌ Function `$func: Missing\n`";`n exit(1);`n }`n}`n`n// Test essential classes`n`$required_classes = [`"Phar`", `"DOMDocument`", `"XMLReader`", `"ZipArchive`"];`nforeach (`$required_classes as `$class) {`n if (class_exists(`$class)) {`n echo `"✅ Class `$class: Available\n`";`n } else {`n echo `"❌ Class `$class: Missing\n`";`n exit(1);`n }`n}`n`necho `"✅ All Composer compatibility checks passed\n`";`n?>"
452
452
$composerTestContent | Out-File -FilePath "test_composer_compat.php" -Encoding UTF8
453
453
& $PHP "test_composer_compat.php"
454
454
Remove-Item "test_composer_compat.php"
455
-
455
+
456
456
# Check if this is likely a real binary based on file size
457
457
if ($fileSize -gt 1000000) {
458
458
Write-Host "✅ PHP binary appears to be a real Windows binary (file size: $fileSize bytes)"
459
-
459
+
460
460
# Check for DLLs which should be present in a real PHP distribution
461
461
$dllCount = (Get-ChildItem -Path "binaries\$BINARY_NAME" -Filter "*.dll" -Recurse).Count
462
462
Write-Host "Found $dllCount DLL files in the PHP distribution"
463
-
463
+
464
464
if ($dllCount -gt 10) {
465
465
Write-Host "✅ PHP distribution contains expected DLL files"
466
466
} else {
@@ -469,7 +469,7 @@ jobs:
469
469
} else {
470
470
Write-Host "⚠️ PHP binary is smaller than expected, might be a placeholder"
471
471
}
472
-
472
+
473
473
Write-Host "✅ All PHP binary tests passed successfully!"
474
474
} else {
475
475
Write-Host "❌ PHP binary not found at expected location"
@@ -603,7 +603,7 @@ jobs:
603
603
jq --argjson binary "$binary_json" '. += [$binary]' binaries_array.json > temp_array.json
604
604
mv temp_array.json binaries_array.json
605
605
done
606
-
606
+
607
607
# Process zip files (Windows binaries)
608
608
echo "Processing Windows binaries (.zip files)..."
609
609
for zipfile in $(find . -name "*.zip" -type f); do
@@ -635,10 +635,10 @@ jobs:
635
635
# Create a temporary directory
636
636
temp_dir="temp_extract_$RANDOM"
637
637
mkdir -p "$temp_dir"
638
-
638
+
639
639
# Try to extract just the metadata file
640
640
unzip -q -j "$zipfile" "*/metadata.json" -d "$temp_dir" 2>/dev/null || echo '{}' > "$temp_dir/metadata.json"
641
-
641
+
642
642
# Create JSON object for this binary
643
643
binary_json=$(jq -n \
644
644
--arg filename "$filename" \
@@ -663,7 +663,7 @@ jobs:
663
663
# Add this binary to the array using jq
664
664
jq --argjson binary "$binary_json" '. += [$binary]' binaries_array.json > temp_array.json
665
665
mv temp_array.json binaries_array.json
666
-
666
+
667
667
# Clean up temp directory
668
668
rm -rf "$temp_dir"
669
669
done
0 commit comments