@@ -541,18 +541,11 @@ jobs:
541
541
542
542
name : PHP ${{ matrix.php-version }} on ${{ matrix.os }}
543
543
runs-on : ${{ matrix.os }}
544
- env :
545
- CARGO_TERM_COLOR : always
546
544
steps :
547
545
- uses : actions/checkout@v4
548
546
549
547
- uses : dtolnay/rust-toolchain@stable
550
548
551
- - name : Cache cargo dependencies
552
- uses : Swatinem/rust-cache@v2
553
- with :
554
- workspaces : bindings/php
555
-
556
549
- name : Cache LLVM and Clang
557
550
id : cache-llvm
558
551
uses : actions/cache@v4
@@ -585,71 +578,31 @@ jobs:
585
578
586
579
- name : Build PHP extension
587
580
run : |
588
- # Export PHP configuration for ext-php-rs
589
581
export PHP_CONFIG=$(which php-config)
590
-
582
+
591
583
cargo build --release
592
-
593
- # Get PHP extension directory
584
+
594
585
EXT_DIR=$(php -r "echo ini_get('extension_dir');")
595
-
596
- # Find the built library - ext-php-rs names it differently on different platforms
586
+
597
587
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
598
- # On macOS, look for .dylib files
599
- BUILT_LIB=$(find target/release -name "libcss_inline_php.dylib" -o -name "css_inline_php.dylib" | head -1)
600
- if [[ -z "$BUILT_LIB" ]]; then
601
- # Fallback: any .dylib file
602
- BUILT_LIB=$(find target/release -name "*.dylib" | head -1)
603
- fi
604
- sudo cp "$BUILT_LIB" "$EXT_DIR/css_inline.so"
588
+ BUILT_LIB=$(find target/release -name "*.dylib" | head -1)
605
589
else
606
- # On Linux, look for .so files
607
- BUILT_LIB=$(find target/release -name "libcss_inline_php.so" -o -name "css_inline_php.so" | head -1)
608
- if [[ -z "$BUILT_LIB" ]]; then
609
- # Fallback: any .so file
610
- BUILT_LIB=$(find target/release -name "*.so" | head -1)
611
- fi
612
- sudo cp "$BUILT_LIB" "$EXT_DIR/css_inline.so"
590
+ BUILT_LIB=$(find target/release -name "*.so" | head -1)
613
591
fi
614
-
615
- echo "Built library: $BUILT_LIB"
616
- echo "Installed to: $EXT_DIR/css_inline.so"
617
-
618
- # Verify the file exists and has correct permissions
619
- ls -la "$EXT_DIR/css_inline.so"
592
+ sudo cp "$BUILT_LIB" "$EXT_DIR/css_inline.so"
620
593
working-directory : ./bindings/php
621
594
shell : bash
622
595
623
596
- name : Enable and verify extension
624
597
run : |
625
- # Create ini file to load extension
626
598
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
627
- # On macOS, find the additional ini directory
628
- PHP_INI_DIR=$(php -i | grep "Scan this dir for additional .ini files" | cut -d' ' -f9 | tr -d ' ')
629
- if [[ -z "$PHP_INI_DIR" || "$PHP_INI_DIR" == "(none)" ]]; then
630
- # If no scan dir, use the main php.ini location
631
- PHP_INI=$(php -i | grep "Loaded Configuration File" | cut -d' ' -f9)
632
- PHP_INI_DIR=$(dirname "$PHP_INI")/conf.d
633
- sudo mkdir -p "$PHP_INI_DIR"
634
- fi
599
+ PHP_INI=$(php -i | grep "Loaded Configuration File" | cut -d' ' -f9)
600
+ PHP_INI_DIR=$(dirname "$PHP_INI")/conf.d
601
+ sudo mkdir -p "$PHP_INI_DIR"
635
602
echo "extension=css_inline" | sudo tee "$PHP_INI_DIR/99-css_inline.ini"
636
603
else
637
604
echo "extension=css_inline" | sudo tee /etc/php/${{ matrix.php-version }}/cli/conf.d/99-css_inline.ini
638
605
fi
639
-
640
- # Verify extension is loaded
641
- php -m | grep -i css_inline || (
642
- echo "Extension failed to load. Debugging info:"
643
- echo "PHP Version:"
644
- php -v
645
- echo "Extension dir contents:"
646
- ls -la $(php -r "echo ini_get('extension_dir');")
647
- echo "PHP info grep for css_inline:"
648
- php -i | grep -i css_inline || true
649
- echo "Try loading directly:"
650
- php -d "extension=$(php -r 'echo ini_get("extension_dir");')/css_inline.so" -m | grep -i css_inline || true
651
- exit 1
652
- )
653
606
shell : bash
654
607
655
608
- name : Install dependencies
0 commit comments