Skip to content

chore(v3): cleanup #814

chore(v3): cleanup

chore(v3): cleanup #814

Workflow file for this run

name: Benchmarks with PHPBench
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/benchmarks.yml
- bin/tools/phpbench
- src/**
- tests/Benchmark/**
- composer.json
- phpbench.json
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
run:
name: "Benchmarks ${{ matrix.database }} - ${{ matrix.with-dama && 'with Dama' || 'without Dama' }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.5 ]
symfony: [ 8.0.* ]
database: [ mysql|mongo ]
with-dama: [ 0 ]
env:
DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || contains(matrix.database, 'sqlite') && 'sqlite:///%kernel.project_dir%/var/data.db' || '' }}
MONGO_URL: ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }}
USE_DAMA_DOCTRINE_TEST_BUNDLE: ${{ matrix.with-dama }}
services:
mongo:
image: ${{ contains(matrix.database, 'mongo') && 'mongo:4' || '' }}
ports:
- 27017:27017
steps:
- name: Set up MySQL
if: contains(matrix.database, 'mysql')
run: sudo /etc/init.d/mysql start
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex
- name: Checkout
uses: actions/checkout@v4
with:
ref: 3.x
fetch-depth: 1
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.deps }}
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
- name: Install PHPBench
run: composer bin phpbench install
- name: Run benchmarks baseline
run: |
bin/tools/phpbench/vendor/phpbench/phpbench/bin/phpbench run \
tests/Benchmark \
--report=aggregate \
--tag=3.x \
--iterations=5 \
--progress=plain \
--retry-threshold=10
- name: Clear vendor files
run: |
rm -rf vendor composer.lock
- name: Checkout
uses: actions/checkout@v4
with:
clean: false
fetch-depth: 1
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.deps }}
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
- name: Run benchmarks and compare
run: |
bin/tools/phpbench/vendor/phpbench/phpbench/bin/phpbench run \
tests/Benchmark \
--report=aggregate \
--ref=3.x \
--iterations=5 \
--progress=plain \
--retry-threshold=10 \
--assert="mode(variant.time.avg) <= mode(baseline.time.avg) +/- 10%"