Skip to content

Rewrite to be based on php-build #649

Rewrite to be based on php-build

Rewrite to be based on php-build #649

Workflow file for this run

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
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@1.1 openssl@3 pkg-config re2c zlib"
jobs:
plugin_test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
version: 8.0.0
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.0.0
is_legacy: true
# will uncomment later
# - os: ubuntu-latest
# version: 7.4.14
# is_legacy: true
# - os: macos-latest
# version: latest
# is_legacy: false
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
- 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 }}
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
# 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
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"
find /tmp -name "config.log" -path "*/php-build/source/${{ matrix.version }}/*" -exec tail -50 {} \;
find /tmp -name "php-build.${{ matrix.version }}.*.log" -exec tail -100 {} \;
fi
exit 1
fi
- name: Test PHP installation
run: |
asdf set php ${{ matrix.version }}
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:
- 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