Skip to content

Commit b52199b

Browse files
authored
Adding benchmark to CI (#174)
Adding benchmark to CI
1 parent 63c78c0 commit b52199b

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cache:
77
matrix:
88
include:
99
- php: 7.2
10-
env: PREFER_LOWEST="" DB=mysql RUN_PHPSTAN=1 RUN_CSCHECK=1 RUN_REQUIRECHECKER=1
10+
env: PREFER_LOWEST="" DB=mysql RUN_PHPSTAN=1 RUN_CSCHECK=1 RUN_REQUIRECHECKER=1 RUN_PERF_TEST=1
1111
services:
1212
- mysql
1313
- php: 7.3
@@ -98,6 +98,21 @@ script:
9898
if [ "$RUN_REQUIRECHECKER" == "1" ] ; then
9999
composer require-checker
100100
fi
101+
- |
102+
if [ "$RUN_PERF_TEST" == "1" ] ; then
103+
echo "***** Running PHPBENCH on current branch *****" && \
104+
./phpbench.dist.sh run --tag=current_pr --store
105+
fi
106+
after_success:
107+
- |
108+
if [ "$RUN_PERF_TEST" == "1" ] && [ "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" != "master" ] ; then
109+
git fetch --unshallow && \
110+
git checkout master && \
111+
composer update && \
112+
echo "***** Running PHPBENCH on master branch for comparison *****" && \
113+
./phpbench.dist.sh run --tag=master --store && \
114+
./phpbench.dist.sh report --uuid=tag:current_pr --uuid=tag:master --report='{extends: compare, compare: tag}'
115+
fi
101116
after_script:
102117
- if [ "$COVERALLS" = "true" ] ; then ./vendor/bin/php-coveralls -v; fi
103118
- if [ "$COVERALLS" = "true" ] ; then vendor/bin/couscous travis-auto-deploy --php-version=7.1 -vvv; fi

phpbench.dist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export DB_USERNAME=root
88
export DB_PASSWORD=
99
export DB_NAME=tdbm_benchmark
1010

11-
vendor/bin/phpbench
11+
vendor/bin/phpbench "$@"

tests/Performance/ManyToOneBench.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private static function recursiveDelete(string $str): bool
120120
return false;
121121
}
122122

123-
private function getConnection(): Connection
123+
private static function getConnection(): Connection
124124
{
125125
return ConnectionFactory::createConnection(
126126
getenv('DB_DRIVER') ?: null,

0 commit comments

Comments
 (0)