Skip to content

add static opcache 84 patch #148

add static opcache 84 patch

add static opcache 84 patch #148

Workflow file for this run

name: tests
on:
push:
workflow_dispatch:
jobs:
fetchversion:
name: Fetch latest PHP version
runs-on: "ubuntu-latest"
outputs:
info: ${{ steps.fetch.outputs.info }}
steps:
- name: Fetch version info
id: fetch
run: |
printf "info=" >> $GITHUB_OUTPUT
jq -rcs '
# default targets
[{
"name": "master",
"rev":"master",
"patch":"84",
}] +
[.[] | {
# ver is like 8.0.0
"ver" : . | keys | first
} | {
"name": .ver,
"rev": ("php-"+.ver),
"patch": {
# mapping maj.min to patches used
"8.4": "84",
"8.3": "83",
"8.2": "82",
"8.1": "81",
"8.0": "80",
}[.ver | sub("(?<v>\\d+\\.\\d+)\\..+"; .v)],
}]' \
<(curl -sfSL 'https://www.php.net/releases/?json&max=1&version=8.0') \
<(curl -sfSL 'https://www.php.net/releases/?json&max=1&version=8.1') \
<(curl -sfSL 'https://www.php.net/releases/?json&max=1&version=8.2') \
<(curl -sfSL 'https://www.php.net/releases/?json&max=1&version=8.3') >> $GITHUB_OUTPUT
wintests:
name: Windows tests for PHP ${{ matrix.name }}
runs-on: "windows-latest"
needs:
- fetchversion
strategy:
matrix:
include: ${{ fromJSON(needs.fetchversion.outputs.info) }}
max-parallel: 3
fail-fast: false
steps:
- name: Disable autocrlf
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout PHP
uses: actions/checkout@v4
with:
repository: php/php-src
path: php-src
ref: ${{ matrix.rev }}
- name: Checkout micro
uses: actions/checkout@v4
with:
path: php-src/sapi/micro
- name: Checkout php-sdk-binary-tools
uses: actions/checkout@v4
with:
repository: php/php-sdk-binary-tools
path: php-sdk-binary-tools
ref: master
- name: Apply patches
shell: powershell
working-directory: php-src
run: |
$patchVer = "${{ matrix.patch }}"
$series = '84', '83', '82', '81', '80'
$patches = 'cli_checks', 'vcruntime140', 'win32', 'zend_stream', 'phar', 'comctl32', 'static_opcache', 'static_extensions_win32'
foreach ( $patch in $patches )
{
$path = "sapi/micro/patches/${patch}.patch"
if (Test-Path $path -PathType Leaf) {
Write-Host "Applying $path"
Get-Content $path | patch -p1
continue
}
foreach ( $ver in $series ) {
if ( $patchVer -lt $ver ) {
continue
}
$path = "sapi/micro/patches/${patch}_$ver.patch"
if (Test-Path $path -PathType Leaf) {
Write-Host "Applying $path"
Get-Content $path | patch -p1
break
}
}
}
- name: Build micro SAPI for PHP
shell: cmd /c ..\php-sdk-binary-tools\phpsdk-vs17-x64.bat -t {0}
working-directory: php-src
run: |
buildconf && ^
configure ^
--disable-all ^
--enable-micro ^
--disable-zts ^
--enable-opcache ^
--enable-ctype ^
--enable-filter ^
--enable-mbstring ^
--enable-session ^
--enable-tokenizer ^
--enable-phar && ^
nmake micro
- name: Upload built micro as artifact
uses: actions/upload-artifact@v4
with:
name: micro_windows_${{ matrix.name }}
path: php-src/x64/Release/micro.sfx
if-no-files-found: error
- name: Test micro SAPI for PHP
shell: cmd /c ..\php-sdk-binary-tools\phpsdk-vs17-x64.bat -t {0}
working-directory: php-src
run: |
nmake micro_test TESTS="--show-diff --color sapi/micro/tests"
linuxtests:
name: Linux tests for PHP ${{ matrix.name }}
runs-on: "ubuntu-latest"
needs:
- fetchversion
strategy:
matrix:
include: ${{ fromJSON(needs.fetchversion.outputs.info) }}
max-parallel: 3
fail-fast: false
steps:
- name: Checkout PHP
uses: actions/checkout@v4
with:
repository: php/php-src
path: php-src
ref: ${{ matrix.rev }}
- name: Checkout micro
uses: actions/checkout@v4
with:
path: php-src/sapi/micro
- name: Apply patches
shell: bash
working-directory: php-src
run: |
patchVer="${{ matrix.patch }}"
for patch in 'cli_checks' 'disable_huge_page' 'phar' 'static_opcache'
do
path="sapi/micro/patches/${patch}.patch"
if [ -f $path ]
then
echo "Applying $path"
patch -p1 < $path
continue
fi
for ver in '84' '83' '82' '81' '80'
do
if [ $patchVer -lt $ver ]
then
continue
fi
path="sapi/micro/patches/${patch}_${ver}.patch"
if [ -f $path ]
then
echo "Applying $path"
patch -p1 < $path
break
fi
done
done
- name: Install deps
run: |
sudo apt-get update &&
sudo apt-get install -yyq re2c
- name: Build micro SAPI for PHP
working-directory: php-src
run: |
./buildconf --force &&
./configure \
--disable-all \
--disable-cgi \
--disable-cli \
--enable-micro \
--disable-phpdbg \
--enable-opcache \
--without-pear \
--disable-shared \
--enable-static \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--enable-ctype \
--enable-filter \
--enable-mbstring \
--enable-session \
--enable-sockets \
--enable-tokenizer \
--enable-phar \
--enable-posix \
--enable-pcntl \
--disable-mbregex &&
make -j `nproc` \
EXTRA_CFLAGS='-Os' \
EXTRA_LDFLAGS_PROGRAM=-lpthread &&
elfedit --output-osabi linux sapi/micro/micro.sfx
- name: Upload built micro as artifact
uses: actions/upload-artifact@v4
with:
name: micro_linux_${{ matrix.name }}
path: php-src/sapi/micro/micro.sfx
if-no-files-found: error
- name: Test micro SAPI for PHP
working-directory: php-src
run: |
make micro_test TESTS="--show-diff --color sapi/micro/tests"
macostests:
name: macOS tests for PHP ${{ matrix.name }}
#runs-on: "macos-latest"
# macos-14-arm64 now cannot build php without install many things
# we cannot select macos-14 because macos-14 will select arm64
runs-on: "macos-13"
needs:
- fetchversion
strategy:
matrix:
include: ${{ fromJSON(needs.fetchversion.outputs.info) }}
max-parallel: 3
fail-fast: false
steps:
- name: Checkout PHP
uses: actions/checkout@v4
with:
repository: php/php-src
path: php-src
ref: ${{ matrix.rev }}
- name: Checkout micro
uses: actions/checkout@v4
with:
path: php-src/sapi/micro
- name: Apply patches
shell: bash
working-directory: php-src
run: |
patchVer="${{ matrix.patch }}"
for patch in 'cli_checks' 'disable_huge_page' 'phar' 'static_opcache'
do
path="sapi/micro/patches/${patch}.patch"
if [ -f $path ]
then
echo "Applying $path"
patch -p1 < $path
continue
fi
for ver in '84' '83' '82' '81' '80'
do
if [ $patchVer -lt $ver ]
then
continue
fi
path="sapi/micro/patches/${patch}_${ver}.patch"
if [ -f $path ]
then
echo "Applying $path"
patch -p1 < $path
break
fi
done
done
- name: Install deps
run: |
brew install bison re2c
- name: Build micro SAPI for PHP
working-directory: php-src
run: |
export PATH="/usr/local/opt/bison/bin:$PATH"
./buildconf --force &&
./configure \
--disable-all \
--disable-cgi \
--disable-cli \
--enable-micro \
--disable-phpdbg \
--without-pear \
--enable-opcache \
--disable-shared \
--enable-static \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--enable-ctype \
--enable-filter \
--enable-mbstring \
--enable-session \
--enable-sockets \
--enable-tokenizer \
--enable-phar \
--enable-posix \
--enable-pcntl \
--disable-mbregex &&
make -j `sysctl -n hw.logicalcpu` \
EXTRA_CFLAGS='-Os'
- name: Upload built micro as artifact
uses: actions/upload-artifact@v4
with:
name: micro_macos_${{ matrix.name }}
path: php-src/sapi/micro/micro.sfx
if-no-files-found: error
- name: Test micro SAPI for PHP
working-directory: php-src
run: |
make micro_test TESTS="--show-diff --color sapi/micro/tests"