Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
fb4d92b
Refactor: Complete rewrite to use php-build instead of custom downloa…
Rusydy Dec 25, 2025
8e37fe6
docs: Expand local testing instructions with latest, 8.5.1, and 8.3.2…
Rusydy Dec 25, 2025
96fa124
fix: Apply shfmt formatting to shell scripts
Rusydy Dec 25, 2025
33718cf
fix: Resolve shellcheck warnings for improved code quality
Rusydy Dec 25, 2025
e7e6ba1
Fix sed command and executable permissions for bin/install and bin/ex…
Rusydy Dec 25, 2025
1f4a08b
Fix Composer installation and make OpenSSL installation non-interacti…
Rusydy Dec 25, 2025
4f4f464
Update CI matrix with compatible PHP versions and build environment
Rusydy Dec 25, 2025
29a4ee3
Add install monitoring and verification steps
Rusydy Dec 25, 2025
25e33ee
Replace plugin-test action with custom workflow to handle submodule a…
Rusydy Dec 25, 2025
900d327
Add timeout and better error handling to CI workflow
Rusydy Dec 25, 2025
9265189
Add verbose logging for troubleshooting CI failures
Rusydy Dec 25, 2025
b12f743
Fix asdf setup and plugin installation conflicts in CI
Rusydy Dec 25, 2025
c17091d
Consolidate CI steps into single script to avoid shell environment is…
Rusydy Dec 25, 2025
3b506dd
Fix shell environment and improve asdf setup in CI
Rusydy Dec 25, 2025
58eecc9
Rename workflow step and add setup logs
Rusydy Dec 25, 2025
5c994cd
Use asdf actions and simplify CI workflow
Rusydy Dec 25, 2025
1c39688
Replace asdf actions with direct tool installs
Rusydy Dec 25, 2025
b3eeb23
Pass git URL and ref into PHP setup step
Rusydy Dec 25, 2025
13729dc
Replace plugin-test with manual asdf setup
Rusydy Dec 25, 2025
2f8686f
Update workflow.yml
Rusydy Dec 25, 2025
6b3c80a
Improve compiler setup for old PHP versions
Rusydy Dec 26, 2025
df1d428
Update workflow.yml
Rusydy Dec 26, 2025
ea32499
Fix shell test grouping and clean up spacing
Rusydy Dec 26, 2025
1837a05
Only set conservative build flags if unset
Rusydy Dec 26, 2025
222fa63
Update workflow.yml
Rusydy Dec 26, 2025
ad1b832
Remove trailing whitespace in bin/install
Rusydy Dec 26, 2025
0bcaf4e
Update workflow.yml
Rusydy Dec 26, 2025
b221853
Improve Composer installer robustness and logging
Rusydy Dec 26, 2025
7c4e668
Update workflow.yml
Rusydy Dec 26, 2025
286b3d0
Refactor CI workflow and unify setup
Rusydy Dec 26, 2025
93a9e35
Update workflow.yml
Rusydy Dec 26, 2025
3a69797
Improve macOS PHP build and fix mktemp usage
Rusydy Dec 27, 2025
2df02a5
Update workflow.yml
Rusydy Dec 27, 2025
288f136
Make sed -i usage cross-platform
Rusydy Jan 4, 2026
86f7e38
Default php_patch to 0 for comparisons
Rusydy Jan 4, 2026
3492506
Remove unnecessary quotes in OSTYPE test
Rusydy Jan 4, 2026
6f7d251
Escape variables in generated wrapper script
Rusydy Jan 4, 2026
17a62e3
Use array for sed -i to ensure portability
Rusydy Jan 4, 2026
84a7c67
Remove unnecessary quotes from OSTYPE check
Rusydy Jan 4, 2026
03cee54
Add SHA256 verification and --help to installer
Rusydy Jan 4, 2026
50860b7
Consolidate macOS brew setup in workflow
Rusydy Jan 4, 2026
00178e3
Update README with architecture and setup
Rusydy Jan 4, 2026
1885f94
Update workflow.yml
Rusydy Jan 4, 2026
0dee937
Fix BSD sed compatibility by replacing sed append commands with awk
Rusydy Jan 4, 2026
5c3f687
Fix macOS-specific configuration for legacy PHP versions
Rusydy Jan 4, 2026
20f08c9
Create separate temp source and exe files
Rusydy Jan 4, 2026
e842857
Simplify shell conditionals and redirects
Rusydy Jan 4, 2026
8815b53
Update local testing docs for PHP plugin install
Rusydy-Mekari Apr 6, 2026
f5f7647
Add macOS-specific dependency configuration for PHP builds
Rusydy-Mekari Apr 8, 2026
b710f74
Add macOS-specific tests and verification for bzip2 configuration
Rusydy-Mekari Apr 8, 2026
82fbfa2
Handle Homebrew keg-only prefixes and CXXFLAGS
Rusydy-Mekari Apr 15, 2026
509aff4
Extract correct function in test setup
Rusydy-Mekari Apr 15, 2026
9ce400c
Require C++17 for intl extension
Rusydy-Mekari Apr 16, 2026
9c0ad42
Fix C++17/ICU build issues for old PHP
Rusydy-Mekari Apr 16, 2026
663cfe6
Use ASDF_CONCURRENCY=8 for PHP installs
Rusydy-Mekari Apr 16, 2026
b51a040
Improve macOS diagnostics and idempotent flags
Rusydy-Mekari Apr 16, 2026
588b235
[TICKET-01]: delete redundant validate_compiler_setup
Rusydy Jun 28, 2026
e7d5c8b
[TICKET-01]: delete prepare_php_build_environment wrapper
Rusydy Jun 28, 2026
7346c32
[TICKET-01]: delete verify_bzip2_fix.sh and verify target
Rusydy Jun 28, 2026
32d40fe
[TICKET-05.1]: Update MACOS_DEPS to use OpenSSL 3 only
Rusydy Jun 28, 2026
0131a8f
[TICKET-05.2]: Fix type casting for xmlStructuredErrorFunc in libxml.c
Rusydy Jun 28, 2026
d8b46ad
[TICKET-05.2]: inject php-8.0-libxml2-const-handler.patch for PHP 8.0…
Rusydy Jun 28, 2026
7868cbf
[TICKET-05.3]: inject php-8.0-libxml2-attribute-unused.patch for PHP …
Rusydy Jun 28, 2026
67d7569
[TICKET-05.4]: inject php-8.0-bcmath-knr-to-ansi.patch for PHP 8.0.x
Rusydy Jun 28, 2026
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
249 changes: 195 additions & 54 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,214 @@ name: Main workflow

on:
pull_request:
types:
- opened
- synchronize
- reopened
paths-ignore:
- "**.md"
push:
branches:
- master
- main
paths-ignore:
- "**.md"
schedule:
- cron: 0 0 * * 5

jobs:
plugin-test-docker:
strategy:
matrix:
container:
- ubuntu:latest
php-version:
- 7.4.14
- 8.0.0
- latest

env:
DEBIAN_FRONTEND: noninteractive

container:
image: ${{ matrix.container }}

runs-on: ubuntu-latest

steps:
- name: Install packages
run: apt-get update && apt-get install -y autoconf bison build-essential curl gettext git libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev openssl pkg-config re2c zlib1g-dev

- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v4
with:
command: php --version
version: ${{ matrix.php-version }}
env:
# Common dependencies for all builds
UBUNTU_DEPS: "autoconf bison build-essential curl gettext git libgd-dev libcurl4-openssl-dev libedit-dev libicu-dev libjpeg-dev libmysqlclient-dev libonig-dev libpng-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libzip-dev libtidy-dev openssl pkg-config re2c zlib1g-dev ca-certificates wget libtool automake gcc-9 g++-9 libxslt1.1 libxslt1-dev autotools-dev m4 libtool-bin"
MACOS_DEPS: "autoconf automake bison freetype gd gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip openssl@3 pkg-config re2c zlib bzip2"

plugin-test-vm:
jobs:
plugin_test:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
php-version:
- 7.4.14
- 8.0.0
- latest
include:
- os: ubuntu-latest
version: 8.0.0
is_legacy: true
- os: ubuntu-latest
version: 8.3.29
is_legacy: true
- os: ubuntu-latest
version: 7.4.14
is_legacy: true
- os: ubuntu-latest
version: latest
is_legacy: false
- os: macos-latest
version: 8.3.29
is_legacy: true
- os: macos-latest
version: 8.0.0
is_legacy: true
# will uncomment later
# - os: macos-latest
# version: 7.4.14
# is_legacy: true
# - os: ubuntu-latest
# version: latest
# is_legacy: false

runs-on: ${{ matrix.os }}
timeout-minutes: 45

steps:
- name: Install packages
run: brew install autoconf automake bison freetype gd gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip openssl@1.1 pkg-config re2c zlib

- name: Install conflicting packages
run: brew install openssl@3

- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v4
with:
command: php --version
version: ${{ matrix.php-version }}
- name: Checkout code
uses: actions/checkout@v4

- name: Initialize submodule and set permissions
run: |
git submodule update --init --recursive
chmod +x bin/* lib/*

- name: Install system packages
run: |
set -e
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get update
sudo apt-get install -y ${{ env.UBUNTU_DEPS }}
elif [ "${{ runner.os }}" = "macOS" ]; then
brew install ${{ env.MACOS_DEPS }}
# Set up macOS-specific environment for PHP build
echo "CXXFLAGS=-std=c++17 -stdlib=libc++" >> $GITHUB_ENV
# Set up library paths for configure to find dependencies
echo "LDFLAGS=-L$(brew --prefix)/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I$(brew --prefix)/include" >> $GITHUB_ENV
# Set ICU4C prefix once for reuse
if brew --prefix icu4c@78 >/dev/null 2>&1; then
ICU_PREFIX="$(brew --prefix icu4c@78)"
else
ICU_PREFIX="$(brew --prefix icu4c)"
fi
echo "ICU_PREFIX=$ICU_PREFIX" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$ICU_PREFIX/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix libxml2)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV

# Configure tidy once for reuse
TIDY_PREFIX="$(brew --prefix tidy-html5)"
if [ -f "$TIDY_PREFIX/lib/libtidy.dylib" ] || [ -f "$TIDY_PREFIX/lib/libtidy.a" ]; then
echo "✓ tidy library found, enabling tidy support"
echo "TIDY_CONFIG=--with-tidy=$TIDY_PREFIX" >> $GITHUB_ENV
else
echo "⚠ tidy library not found, disabling tidy support"
echo "TIDY_CONFIG=--without-tidy" >> $GITHUB_ENV
fi
fi

- name: Setup asdf
uses: asdf-vm/actions/setup@v4

- name: Configure environment for PHP ${{ matrix.version }}
run: |
# Add plugin from current checkout
asdf plugin add php $GITHUB_WORKSPACE

# Set common environment
export PHP_BUILD_XDEBUG_ENABLE=off
echo "PHP_BUILD_XDEBUG_ENABLE=off" >> $GITHUB_ENV

if [ "${{ matrix.is_legacy }}" = "true" ]; then
echo "=== Configuring for legacy PHP ${{ matrix.version }} ==="

# Use gcc-9 for legacy versions, fallback to gcc
if command -v gcc-9 >/dev/null 2>&1; then
COMPILER="gcc-9"
CXXCOMPILER="g++-9"
else
COMPILER="gcc"
CXXCOMPILER="g++"
fi

# Set legacy-specific environment
echo "ASDF_PHP_OPENSSL_AUTO=yes" >> $GITHUB_ENV
echo "CC=$COMPILER" >> $GITHUB_ENV
echo "CXX=$CXXCOMPILER" >> $GITHUB_ENV
echo "ac_cv_prog_CC=$COMPILER" >> $GITHUB_ENV
echo "ac_cv_prog_CXX=$CXXCOMPILER" >> $GITHUB_ENV
echo "CONFIG_SHELL=/bin/bash" >> $GITHUB_ENV

# Add macOS-specific PHP build configure options
if [ "${{ runner.os }}" = "macOS" ]; then
echo "PHP_BUILD_CONFIGURE_OPTS=--with-bz2=$(brew --prefix bzip2) --with-iconv=$(brew --prefix libiconv) --with-openssl=$(brew --prefix openssl@3) ${{ env.TIDY_CONFIG }}" >> $GITHUB_ENV
fi

# Debug output
echo "Compiler: $COMPILER ($($COMPILER --version | head -1))"
echo 'int main() { return 0; }' > /tmp/test.c
$COMPILER -o /tmp/test /tmp/test.c && echo "✓ Compiler works" || echo "✗ Compiler failed"
rm -f /tmp/test /tmp/test.c
else
echo "=== Configuring for modern PHP ${{ matrix.version }} ==="
echo "ASDF_PHP_OPENSSL_AUTO=no" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV

# Add macOS-specific PHP build configure options for modern versions
if [ "${{ runner.os }}" = "macOS" ]; then
echo "PHP_BUILD_CONFIGURE_OPTS=--with-bz2=$(brew --prefix bzip2) --with-iconv=$(brew --prefix libiconv) --with-openssl=$(brew --prefix openssl@3) ${{ env.TIDY_CONFIG }}" >> $GITHUB_ENV
fi
fi

- name: Install PHP ${{ matrix.version }}
run: |
echo "Installing PHP ${{ matrix.version }}..."

if ! asdf install php ${{ matrix.version }}; then
if [ "${{ matrix.is_legacy }}" = "true" ]; then
echo "=== Build failed - gathering diagnostics ==="
echo "Environment: CC=$CC, ac_cv_prog_CC=$ac_cv_prog_CC"
# On macOS, php-build writes its log to $TMPDIR (/var/folders/…), not /tmp
# Search both locations so diagnostics work on macOS and Linux
SEARCH_DIRS="${TMPDIR:-} /tmp /var/folders"
for _sdir in $SEARCH_DIRS; do
[ -d "$_sdir" ] || continue
find "$_sdir" -maxdepth 6 -name "php-build.${{ matrix.version }}.*.log" 2>/dev/null | while read -r _log; do
echo "=== $( basename \"$_log\" ) ==="
tail -150 "$_log"
done
done
find /var/tmp -maxdepth 6 -name "config.log" -path "*/${{ matrix.version }}/*" 2>/dev/null -exec tail -50 {} \; || true
fi
exit 1
fi

- name: Test PHP installation
run: |
asdf set php ${{ matrix.version }}
Comment thread
Rusydy marked this conversation as resolved.
php --version
echo "Installation path: $(asdf where php)"

# Test Composer if available
if command -v composer >/dev/null 2>&1; then
echo "Composer: $(composer --version)"
else
echo "Composer not available"
fi

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y shellcheck make
- name: Run lint
run: make lint

format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Install shfmt
run: brew install shfmt

- name: Run shfmt
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make
curl -sL "https://github.com/mvdan/sh/releases/download/v3.8.0/shfmt_v3.8.0_linux_amd64" -o shfmt
chmod +x shfmt
sudo mv shfmt /usr/local/bin/
- name: Check format
run: make fmt-check
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ignore vendor directory (contains php-build submodule/clone)
vendor/

# Ignore temporary files
*.tmp
*.log
.DS_Store

# Ignore editor files
.vscode/
.idea/
*.swp
*.swo
*~

# Ignore OS files
Thumbs.db
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendor/php-build"]
path = vendor/php-build
url = https://github.com/php-build/php-build.git
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SH_SRCFILES = $(shell git ls-files "bin/*")
SHFMT_BASE_FLAGS = -s -i 2 -ci
TEST_FILES = $(wildcard tests/*.bats)

fmt:
shfmt -w $(SHFMT_BASE_FLAGS) $(SH_SRCFILES)
Expand All @@ -12,3 +13,26 @@ fmt-check:
lint:
shellcheck $(SH_SRCFILES)
.PHONY: lint

test:
@if command -v bats >/dev/null 2>&1; then \
bats $(TEST_FILES); \
else \
echo "Error: bats is not installed. Please install bats-core."; \
echo "macOS: brew install bats-core"; \
echo "Linux: apt-get install bats or yum install bats"; \
exit 1; \
fi
.PHONY: test

test-verbose:
@if command -v bats >/dev/null 2>&1; then \
bats --tap $(TEST_FILES); \
else \
echo "Error: bats is not installed. Please install bats-core."; \
exit 1; \
fi
.PHONY: test-verbose

check: fmt-check lint test
.PHONY: check
Loading
Loading