Skip to content

Commit d4c96da

Browse files
author
MarkBaker
committed
Implement performance testing in the CI pipeline using phpbench
1 parent 092ddbd commit d4c96da

13 files changed

+743
-160
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,37 @@ jobs:
182182
- name: Static analysis with PHPStan
183183
run: ./vendor/bin/phpstan analyse
184184

185+
performance:
186+
runs-on: ubuntu-latest
187+
steps:
188+
- name: Checkout
189+
uses: actions/checkout@v2
190+
191+
- name: Setup PHP, with composer and extensions
192+
uses: shivammathur/setup-php@v2
193+
with:
194+
php-version: 7.4
195+
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
196+
coverage: none
197+
tools: cs2pr
198+
199+
- name: Get composer cache directory
200+
id: composer-cache
201+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
202+
203+
- name: Cache composer dependencies
204+
uses: actions/cache@v2
205+
with:
206+
path: ${{ steps.composer-cache.outputs.dir }}
207+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
208+
restore-keys: ${{ runner.os }}-composer-
209+
210+
- name: Install dependencies
211+
run: composer install --no-progress --prefer-dist --optimize-autoloader
212+
213+
- name: Performance tests with PHPBench
214+
run: ./vendor/bin/phpbench run tests/performance --report=aggregate
215+
185216
coverage:
186217
runs-on: ubuntu-latest
187218
steps:

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"friendsofphp/php-cs-fixer": "^3.2",
8484
"jpgraph/jpgraph": "^4.0",
8585
"mpdf/mpdf": "8.1.1",
86+
"phpbench/phpbench": "^1.2",
8687
"phpcompatibility/php-compatibility": "^9.3",
8788
"phpstan/phpstan": "^1.1",
8889
"phpstan/phpstan-phpunit": "^1.0",
@@ -104,6 +105,7 @@
104105
"autoload-dev": {
105106
"psr-4": {
106107
"PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests",
108+
"PhpOffice\\PhpSpreadsheetPerformance\\": "tests/Performance",
107109
"PhpOffice\\PhpSpreadsheetInfra\\": "infra"
108110
}
109111
}

0 commit comments

Comments
 (0)