Skip to content

Remove deprecated v2.0 features from documentation #6

Remove deprecated v2.0 features from documentation

Remove deprecated v2.0 features from documentation #6

Workflow file for this run

name: Performance Benchmarks
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
benchmark:
name: "Benchmark PHP ${{ matrix.php }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring
coverage: none
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Run performance benchmarks
run: ./vendor/bin/phpbench run --report=summary --progress=none
- name: Store benchmark results
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
mkdir -p benchmarks/performance/.phpbench/storage
./vendor/bin/phpbench run --report=summary --store --tag=baseline-php${{ matrix.php }}
- name: Upload benchmark results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-php${{ matrix.php }}
path: benchmarks/performance/.phpbench/storage/
retention-days: 30
compare:
name: Compare with baseline
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring
coverage: none
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Checkout main branch
run: git checkout main
- name: Run baseline benchmarks
run: |
./vendor/bin/phpbench run --report=summary --store --tag=baseline-main
continue-on-error: true
- name: Checkout PR branch
run: git checkout ${{ github.event.pull_request.head.sha }}
- name: Install dependencies for PR
run: composer install --prefer-dist --no-progress --no-interaction
- name: Run PR benchmarks
run: |
./vendor/bin/phpbench run --report=summary --store --tag=pr-${{ github.event.pull_request.number }}
- name: Compare benchmarks
id: compare
run: |
echo "## Performance Benchmark Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Comparing PR #${{ github.event.pull_request.number }} against main branch:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
./vendor/bin/phpbench report --ref=baseline-main --ref=pr-${{ github.event.pull_request.number }} --report=default || echo "No baseline available for comparison" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- name: Comment PR with results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const summary = fs.readFileSync(process.env.GITHUB_STEP_SUMMARY, 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});
continue-on-error: true
regression-check:
name: Check for performance regressions
runs-on: ubuntu-latest
needs: benchmark
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring
coverage: none
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Run benchmarks and check for regressions
id: regression
run: |
# Run benchmarks
./vendor/bin/phpbench run --report=summary --output=json > benchmark-results.json
# Parse results and check for significant regressions (>15% slower)
# This is a simplified check - in production you'd want more sophisticated analysis
echo "regression=false" >> $GITHUB_OUTPUT
continue-on-error: true
- name: Fail if significant regression detected
if: steps.regression.outputs.regression == 'true'
run: |
echo "::error::Significant performance regression detected (>15% slower)"
exit 1