Skip to content

Commit

Permalink
Merge branch 'fork' into autoload-bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Nov 21, 2024
2 parents 88a58be + 71cae13 commit 3b5cff7
Show file tree
Hide file tree
Showing 326 changed files with 9,916 additions and 10,728 deletions.
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
Environment
==========

* PHP: *can be obtained with ```php -v```*
* pthreads: *can be obtained with ```php -dextension=pthreads.so --ri pthreads | grep Version```*
* PHP: *can be obtained with `php -v`*
* pthreads: *can be obtained with `php -dextension=pmmpthread.so --ri pmmpthread | grep Version`*
* OS: *if Windows, include arch*
* OPcache: *yes/no (check for `Zend OPcache` in the output of `php -m`)*
* JIT: *can be obtained with `php -i | grep opcache.jit`*

Summary
======
Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
228 changes: 228 additions & 0 deletions .github/workflows/main-php-matrix-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
name: Windows CI (reusable workflow)

on:
workflow_call:
inputs:
php:
description: 'PHP version'
type: string
required: true
vs-arch:
description: 'CPU arch to build for (x86 or x64)'
type: string
default: 'x64'
vs-crt:
description: 'Visual Studio CRT for build (vc15=2017, vs16=2019, vs17=2022)'
type: string
required: true
runs-on:
description: 'GitHub runner'
type: string
default: 'windows-2019'

env:
PHP_SDK_BINARY_TOOLS_VER: 2.2.0
PTHREAD_W32_VER: 3.0.0

jobs:
build-php:
name: Build PHP
runs-on: ${{ inputs.runs-on }}

concurrency: php-debug-${{ inputs.php }}-${{ inputs.runs-on }}-${{ github.ref }}

steps:
- name: Set PHP build cache key
id: cache-key
run: |
echo "key=php-debug-${{ inputs.php }}-${{ inputs.vs-arch }}-${{ inputs.vs-crt }}-${{ inputs.runs-on }}" >> $env:GITHUB_OUTPUT
- name: Check PHP build cache
uses: actions/cache@v4
id: cache
with:
path: |
bin
php-sdk
deps
key: ${{ steps.cache-key.outputs.key }}
lookup-only: true

- name: Checkout PHP build SDK
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: php/php-sdk-binary-tools
ref: php-sdk-${{ env.PHP_SDK_BINARY_TOOLS_VER }} #TODO: probably should update this, but haven't tested newer versions
path: php-sdk

- name: Checkout PHP
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: php/php-src
ref: "php-${{ inputs.php }}"
path: php-src

- name: Download PHP build dependencies
if: steps.cache.outputs.cache-hit != 'true'
working-directory: php-sdk
run: |
$php_base = "${{ inputs.php }}" -replace '^(\d+)\.(\d+).*','$1.$2'
$deps_type = ""
if ("${{ inputs.php }}" -match '^(\d+)\.(\d+)\.(\d+)(.+)') {
$deps_type = "staging"
} else {
$deps_type = "stable"
}
echo "phpsdk_deps -u -t ${{ inputs.vs-crt }} -b $php_base -a ${{ inputs.vs-arch }} -s $deps_type -d `"${{ github.workspace }}\deps`" || exit 1" > task.bat
& .\phpsdk-${{ inputs.vs-crt }}-${{ inputs.vs-arch }}.bat -t task.bat
- name: Download pthreads4w dependency
if: steps.cache.outputs.cache-hit != 'true'
run: |
C:\msys64\usr\bin\wget.exe -nv https://github.com/pmmp/DependencyMirror/releases/download/mirror/pthreads4w-code-v${{ env.PTHREAD_W32_VER }}.zip -O temp.zip
& "C:\Program Files\7-Zip\7z.exe" x -y temp.zip
rm temp.zip
mv pthreads4w-code-* pthreads4w-code
- name: Compile pthreads4w
if: steps.cache.outputs.cache-hit != 'true'
working-directory: pthreads4w-code
run: |
echo "nmake VC || exit 1" > task.bat
& "${{ github.workspace }}\php-sdk\phpsdk-${{ inputs.vs-crt }}-${{ inputs.vs-arch }}.bat" -t task.bat
- name: Copy pthreads4w files to deps dir
if: steps.cache.outputs.cache-hit != 'true'
working-directory: pthreads4w-code
run: |
$DEPS_DIR="${{ github.workspace }}\deps"
cp pthread.h "$DEPS_DIR\include\pthread.h"
cp sched.h "$DEPS_DIR\include\sched.h"
cp semaphore.h "$DEPS_DIR\include\semaphore.h"
cp _ptw32.h "$DEPS_DIR\include\_ptw32.h"
cp pthreadVC3.lib "$DEPS_DIR\lib\pthreadVC3.lib"
cp pthreadVC3.dll "$DEPS_DIR\bin\pthreadVC3.dll"
cp pthreadVC3.pdb "$DEPS_DIR\bin\pthreadVC3.pdb"
- name: Compile PHP
if: steps.cache.outputs.cache-hit != 'true'
id: compile
working-directory: php-src
run: |
echo "call buildconf.bat || exit 1" > task.bat
echo "call configure.bat^`
--disable-all^`
--enable-cli^`
--enable-zts^`
--enable-sockets^`
--enable-ipv6^`
--enable-debug^`
--enable-opcache^`
--enable-opcache-jit^`
--with-prefix=`"${{ github.workspace }}\bin`"^`
--with-php-build=`"${{ github.workspace }}\deps`" || exit 1" >> task.bat
echo "nmake || exit 1" >> task.bat
echo "nmake install || exit 1" >> task.bat
cat task.bat
# php sdk jank! woohoo
& "${{ github.workspace }}\php-sdk\phpsdk-${{ inputs.vs-crt }}-${{ inputs.vs-arch }}.bat" -t task.bat
- name: Add pthreads4w DLL to build result
if: steps.cache.outputs.cache-hit != 'true'
working-directory: bin
run: |
cp "${{ github.workspace }}\deps\bin\pthreadVC*.*" .\
test-extension:
name: Test (OPcache ${{ matrix.opcache }})
runs-on: ${{ inputs.runs-on }}
needs: build-php

strategy:
fail-fast: false
matrix:
opcache:
- "off"
- "on"
- "jit"
#- "jit-tracing" #borked until 8.3 due to php-src bugs

steps:
- uses: actions/checkout@v4

- name: Fetch PHP build cache
uses: actions/cache/restore@v4 #fails if cache is missing
with:
path: |
bin
php-sdk
deps
key: php-debug-${{ inputs.php }}-${{ inputs.vs-arch }}-${{ inputs.vs-crt }}-${{ inputs.runs-on }}

- name: Compile extension
run: |
echo "call ${{ github.workspace }}\bin\SDK\phpize.bat || exit 1" > task.bat
echo "call configure ^`
--with-pmmpthread^`
--with-pmmpthread-sockets^`
--with-prefix=`"${{ github.workspace }}\bin`"^`
--with-php-build=`"${{ github.workspace }}\deps`" || exit 1" >> task.bat
echo "nmake || exit 1" >> task.bat
echo "nmake install || exit 1" >> task.bat
cat task.bat
# php sdk jank! woohoo
& "${{ github.workspace }}\php-sdk\phpsdk-${{ inputs.vs-crt }}-${{ inputs.vs-arch }}.bat" -t task.bat
- name: Generate php.ini
working-directory: bin
run: |
echo "[PHP]" > php.ini
echo "extension_dir=$pwd\ext" >> php.ini
echo "extension=php_pmmpthread.dll" >> php.ini
$opcache = "${{ matrix.opcache }}"
if ($opcache -ne "off") {
echo "Enabling OPcache"
echo "zend_extension=php_opcache.dll" >> php.ini
echo "opcache.enable=1" >> php.ini
echo "opcache.enable_cli=1" >> php.ini
echo "opcache.protect_memory=1" >> php.ini
if ($opcache -eq "jit"){
echo "Enabling function JIT"
echo "opcache.jit=1205" >> php.ini
echo "opcache.jit_buffer_size=128M" >> php.ini
} elseif ( $opcache -eq "jit-tracing" ) {
echo "Enabling tracing JIT"
echo "opcache.jit=tracing" >> php.ini
echo "opcache.jit_buffer_size=128M" >> php.ini
} else {
echo "Disabling JIT"
echo "opcache.jit=0" >> php.ini
}
} else {
echo "OPcache is not enabled for this run"
}
- name: Run test suite
working-directory: bin
timeout-minutes: 30
run: |
$env:REPORT_EXIT_STATUS=1
.\php.exe .\SDK\script\run-tests.php -P -q --show-diff --show-slow 30000 -n -c .\php.ini ${{ github.workspace }}\tests
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ inputs.php }}-opcache-${{ matrix.opcache }}-${{ inputs.runs-on }}
path: |
${{ github.workspace }}/tests/*.log
${{ github.workspace }}/tests/*.diff
${{ github.workspace }}/tests/*.mem
if-no-files-found: ignore
Loading

0 comments on commit 3b5cff7

Please sign in to comment.