Skip to content

Build

Build #3

Workflow file for this run

name: Build
on:
push:
branches:
- main
- phase2-observer-migration
pull_request:
workflow_dispatch:
inputs:
php-version:
description: 'PHP version to build'
required: false
default: '8.5'
type: choice
options:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
jobs:
build-unix:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
name: macOS (Apple Silicon)
- os: ubuntu-latest
name: Linux (x86_64)
runs-on: ${{ matrix.os }}
name: "${{ matrix.name }} — PHP ${{ inputs.php-version || '8.5' }}"
steps:
- uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version || '8.5' }}
coverage: none
extensions: xmlreader
- name: Build extension
run: |
phpize
./configure --enable-php-debugger
make -j$(sysctl -n hw.logicalcpu 2>/dev/null || nproc)
- name: Verify extension loads
run: |
php -dzend_extension=$PWD/modules/php_debugger.so -v
php -dzend_extension=$PWD/modules/php_debugger.so -r "echo 'xdebug_info() works: ' . (function_exists('xdebug_info') ? 'yes' : 'no') . PHP_EOL;"
- name: Smoke test (DBGp)
run: |
TEST_PHP_ARGS="-n -dzend_extension=$PWD/modules/php_debugger.so"
echo "TEST_PHP_ARGS=$TEST_PHP_ARGS" >> $GITHUB_ENV
export TEST_PHP_ARGS
php -n run-xdebug-tests.php -q tests/debugger/bug00530.phpt
- name: Get build info
id: info
run: |
PHP_VER=$(php -r "echo PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;")
OS_TAG=$(echo "${{ matrix.os }}" | sed 's/-latest//')
ARCH=$(uname -m)
echo "artifact_name=php-debugger-php${PHP_VER}-${OS_TAG}-${ARCH}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.info.outputs.artifact_name }}
path: modules/php_debugger.so
retention-days: 90
build-windows:
strategy:
fail-fast: false
matrix:
ts:
- nts
- ts
runs-on: windows-2022
name: "Windows (x64) — PHP ${{ inputs.php-version || '8.5' }} — ${{ matrix.ts == 'ts' && 'TS' || 'NTS' }}"
steps:
- uses: actions/checkout@v6
- name: Build the extension
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ inputs.php-version || '8.5' }}
arch: x64
ts: ${{ matrix.ts }}
args: --enable-debugger
run-tests: false
- name: Get build info
id: info
shell: bash
run: |
PHP_VER="${{ inputs.php-version || '8.5' }}"
TS_TAG="${{ matrix.ts }}"
echo "artifact_name=php-debugger-php${PHP_VER}-${TS_TAG}-windows-x64" >> $GITHUB_OUTPUT
- name: Find DLL
id: find-dll
shell: pwsh
run: |
$dll = Get-ChildItem -Path ${{ runner.temp }} -Recurse -Filter 'php_debugger.dll' | Select-Object -First 1
if (-not $dll) {
$dll = Get-ChildItem -Recurse -Filter 'php_debugger.dll' | Select-Object -First 1
}
if (-not $dll) { Write-Error 'php_debugger.dll not found'; exit 1 }
Write-Host "Found DLL at: $($dll.FullName)"
echo "dll_path=$($dll.FullName)" >> $env:GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.info.outputs.artifact_name }}
path: ${{ steps.find-dll.outputs.dll_path }}
if-no-files-found: error
retention-days: 90