Skip to content

Commit

Permalink
add new benchmark GitHub Workflows to compare performance between PHP…
Browse files Browse the repository at this point in the history
… 8.1 and 8.3
  • Loading branch information
llaville committed Dec 15, 2023
1 parent fcd227d commit 935c1fc
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
name: Benchmarking

on:
workflow_dispatch:

jobs:
benchmark-baseline:
name: "Benchmark Baseline"

runs-on: "${{ matrix.operating-system }}"

strategy:
fail-fast: false

matrix:
operating-system:
- "ubuntu-22.04"

php-version:
- "8.1"

steps:
- # https://github.com/actions/checkout
name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "9.1"
repository: "overtrue/phplint"

- # https://github.com/shivammathur/setup-php
name: Setup PHP runtime
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"

- # https://github.com/ramsey/composer-install
name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--prefer-dist"

- # https://github.com/phpbench/phpbench
name: Install PHPBench
run: |
curl -Ls https://github.com/phpbench/phpbench/releases/download/1.2.15/phpbench.phar -o /usr/local/bin/phpbench
chmod +x /usr/local/bin/phpbench
- # https://github.com/phpbench/phpbench
name: Benchmark baseline
run: |
phpbench run tests/Benchmark --tag=${{ matrix.php-version }}
- # https://github.com/actions/upload-artifact
name: Upload PHPBench baseline
uses: actions/upload-artifact@v3
with:
name: "PHPBench-Baseline"
path: ".phpbench/"

benchmark-report:
needs: benchmark-baseline

name: "Benchmark Report"

runs-on: "${{ matrix.operating-system }}"

strategy:
fail-fast: false

matrix:
operating-system:
- "ubuntu-22.04"

php-version:
- "8.3"

steps:
- # https://github.com/actions/checkout
name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "9.1"
repository: "overtrue/phplint"

- # https://github.com/shivammathur/setup-php
name: Setup PHP runtime
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"

- # https://github.com/ramsey/composer-install
name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--prefer-dist"

- # https://github.com/phpbench/phpbench
name: Install PHPBench
run: |
curl -Ls https://github.com/phpbench/phpbench/releases/download/1.2.15/phpbench.phar -o /usr/local/bin/phpbench
chmod +x /usr/local/bin/phpbench
- # https://github.com/actions/download-artifact
name: Retrieve PHPBench baseline results
uses: actions/download-artifact@v3
with:
name: "PHPBench-Baseline"
path: ".phpbench/"

- # https://github.com/phpbench/phpbench
name: Benchmark Reports
run: |
phpbench run tests/Benchmark --tag=${{ matrix.php-version }} --ref="8.1" --report=aggregate --report overview --output=html
- # https://github.com/actions/upload-artifact
name: Upload PHPBench report
uses: actions/upload-artifact@v3
with:
name: "PHPBench-Report"
path: ".phpbench/html/index.html"

0 comments on commit 935c1fc

Please sign in to comment.