From 72ac62c66e7b907fccedc101d30bd80286b80cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 7 Aug 2021 11:24:53 +0300 Subject: [PATCH 01/65] Drop .travis.yml integration Since June 15th, 2021, the building on travis-ci.org is ceased. Please use travis-ci.com from now on. --- .travis.yml | 97 ----------------------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ef8fd10..0000000 --- a/.travis.yml +++ /dev/null @@ -1,97 +0,0 @@ -language: php -os: linux -dist: trusty -services: - - mongodb -env: - - PHPUNIT_VERSION=7.5 - -jobs: - fast_finish: true - allow_failures: - - php: "nightly" - include: - - php: "5.3" - dist: precise - env: - - PHPUNIT_VERSION=4.8 - - php: "5.4" - env: - - PHPUNIT_VERSION=4.8 - - php: "5.5" - env: - - PHPUNIT_VERSION=4.8 - - php: "5.6" - env: - - PHPUNIT_VERSION=5.7 - - php: "7.0" - env: - - PHPUNIT_VERSION=6.5 - - php: "7.1" - - php: "7.2" - - php: "7.3" - - php: "7.4" - - php: "nightly" - - # without perftools/xhgui-collector - - php: "5.3" - dist: precise - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=4.8 - - php: "5.4" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=4.8 - - php: "5.5" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=4.8 - - php: "5.6" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=5.7 - - php: "7.0" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=6.5 - - php: "7.1" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=7.5 - - php: "7.2" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=7.5 - - php: "7.3" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=7.5 - - php: "7.4" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=7.5 - - php: "nightly" - env: - - XHGUI_COLLECTOR=false - - PHPUNIT_VERSION=7.5 - -cache: - apt: true - directories: - - $HOME/.composer/cache - - vendor - -install: - - composer config preferred-install dist - - composer remove --dev alcaeus/mongo-php-adapter --no-update - - composer install - - composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - - ./install-extensions.sh || true - - if [ "$XHGUI_COLLECTOR" = "false" ]; then composer remove --dev perftools/xhgui-collector; fi - -script: - - vendor/bin/phpunit --version - - vendor/bin/phpunit --verbose - -# vim:ts=2:sw=2:et From 8bbbe86447003c0895887419e3ced07796a5d8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 22:43:32 +0300 Subject: [PATCH 02/65] Add CI job to run tests --- .github/workflows/tests.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..8009651 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,46 @@ +name: "Tests" + +on: + - pull_request + +jobs: + mysql: + name: PHP ${{ matrix.php }} + runs-on: ubuntu-20.04 + strategy: + matrix: + php: + - "7.4" + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: xdebug + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run PHPUnit tests + run: composer test + env: + XHGUI_SAVE_HANDLER: "pdo" + +# vim:ft=yaml:et:ts=2:sw=2 From 356fd4b854db5cf1ac5c438acee772c22836efcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 22:53:17 +0300 Subject: [PATCH 03/65] Debug on push --- .github/workflows/tests.yml | 1 + install-extensions.sh | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8009651..ef45dde 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,6 +2,7 @@ name: "Tests" on: - pull_request + - push jobs: mysql: diff --git a/install-extensions.sh b/install-extensions.sh index 97f8232..34943d1 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -2,10 +2,10 @@ set -xeu -: ${TRAVIS_PHP_VERSION=7.4} -: ${TIDEWAYS_VERSION=4.1.4} -: ${TIDEWAYS_XHPROF_VERSION=5.0.2} -: ${PHP_VERSION=${TRAVIS_PHP_VERSION}} +: "${TRAVIS_PHP_VERSION=7.4}" +: "${TIDEWAYS_VERSION=4.1.4}" +: "${TIDEWAYS_XHPROF_VERSION=5.0.2}" +: "${PHP_VERSION=${TRAVIS_PHP_VERSION}}" die() { echo >&2 "ERROR: $*" @@ -13,7 +13,7 @@ die() { } install_xhprof() { - local version="${1:-stable}" + declare version="${1:-stable}" pecl install xhprof-$version } From a2b4bcc5ec4cfad6f0d721eb6ec4a02a2765d706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 22:53:48 +0300 Subject: [PATCH 04/65] Install extensions --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef45dde..2af1184 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,9 @@ jobs: if: steps.composer-cache.outputs.cache-hit != 'true' run: composer install --prefer-dist --no-progress --no-suggest + - name: Install extensions + run: ./install-extensions.sh + - name: Run PHPUnit tests run: composer test env: From bc839bf00eeefa62c02aad12446be6800e449348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 22:54:51 +0300 Subject: [PATCH 05/65] fixup! Debug on push --- install-extensions.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index 34943d1..97f8232 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -2,10 +2,10 @@ set -xeu -: "${TRAVIS_PHP_VERSION=7.4}" -: "${TIDEWAYS_VERSION=4.1.4}" -: "${TIDEWAYS_XHPROF_VERSION=5.0.2}" -: "${PHP_VERSION=${TRAVIS_PHP_VERSION}}" +: ${TRAVIS_PHP_VERSION=7.4} +: ${TIDEWAYS_VERSION=4.1.4} +: ${TIDEWAYS_XHPROF_VERSION=5.0.2} +: ${PHP_VERSION=${TRAVIS_PHP_VERSION}} die() { echo >&2 "ERROR: $*" @@ -13,7 +13,7 @@ die() { } install_xhprof() { - declare version="${1:-stable}" + local version="${1:-stable}" pecl install xhprof-$version } From a375c246a5296b46a9bcc4ffbc0f2a0f5c14cfec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 22:55:11 +0300 Subject: [PATCH 06/65] Fix SC2223 This default assignment may cause DoS due to globbing. Quote it. https://github.com/koalaman/shellcheck/wiki/SC2223 --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2af1184..463fab4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,7 +2,6 @@ name: "Tests" on: - pull_request - - push jobs: mysql: From ce62ce4c400a11d08e5ff4a786c2e47ecbad7f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 22:56:58 +0300 Subject: [PATCH 07/65] fixup! Install extensions --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 463fab4..bb89feb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: run: composer install --prefer-dist --no-progress --no-suggest - name: Install extensions - run: ./install-extensions.sh + run: sudo ./install-extensions.sh - name: Run PHPUnit tests run: composer test From 0b14ba51488549534504fde8b28a4d967221b8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 23:01:19 +0300 Subject: [PATCH 08/65] Revert "Fix SC2223" This reverts commit a375c246a5296b46a9bcc4ffbc0f2a0f5c14cfec. --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb89feb..d5e8c3f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,6 +2,7 @@ name: "Tests" on: - pull_request + - push jobs: mysql: From 5905847703ad75851dde1c61bc060fe47ce62df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 23:02:02 +0300 Subject: [PATCH 09/65] fixup! Fix SC2223 --- install-extensions.sh | 8 ++++---- src/Profiler.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index 97f8232..d0912b3 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -2,10 +2,10 @@ set -xeu -: ${TRAVIS_PHP_VERSION=7.4} -: ${TIDEWAYS_VERSION=4.1.4} -: ${TIDEWAYS_XHPROF_VERSION=5.0.2} -: ${PHP_VERSION=${TRAVIS_PHP_VERSION}} +: "${TRAVIS_PHP_VERSION=7.4}" +: "${TIDEWAYS_VERSION=4.1.4}" +: "${TIDEWAYS_XHPROF_VERSION=5.0.2}" +: "${PHP_VERSION=${TRAVIS_PHP_VERSION}}" die() { echo >&2 "ERROR: $*" diff --git a/src/Profiler.php b/src/Profiler.php index f80fc53..b85be6d 100644 --- a/src/Profiler.php +++ b/src/Profiler.php @@ -56,7 +56,7 @@ final class Profiler * * @param array|Config $config */ - public function __construct($config) + public function __construct($config = array()) { if ($config instanceof Config) { $this->config = $config; From 4a99aba75f7d597068c874a95735b345c77cb828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 23:02:16 +0300 Subject: [PATCH 10/65] fixup! fixup! Fix SC2223 --- src/Profiler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Profiler.php b/src/Profiler.php index b85be6d..f80fc53 100644 --- a/src/Profiler.php +++ b/src/Profiler.php @@ -56,7 +56,7 @@ final class Profiler * * @param array|Config $config */ - public function __construct($config = array()) + public function __construct($config) { if ($config instanceof Config) { $this->config = $config; From a7e5d391237f5bb74c001eae065a13ae548e5adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 31 May 2022 23:03:13 +0300 Subject: [PATCH 11/65] Test xhprof from shivammathur --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5e8c3f..671ff82 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: xdebug + extensions: xdebug, xhprof - name: Validate composer.json and composer.lock run: composer validate From 94b2e310628e9b553d6daf51428fb49151787cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 01:10:55 +0300 Subject: [PATCH 12/65] Add has_extension helper --- install-extensions.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install-extensions.sh b/install-extensions.sh index d0912b3..d61481a 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -12,6 +12,11 @@ die() { exit 1 } +has_extension() { + local extension="$1" + php -m | awk -vrc=1 -vextension="$extension" '$1 == extension { rc=0 } END { exit rc }' +} + install_xhprof() { local version="${1:-stable}" From 79703da729bfe99818b24f4271c8546479ec34ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 01:12:36 +0300 Subject: [PATCH 13/65] Skip xhprof install if present --- install-extensions.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install-extensions.sh b/install-extensions.sh index d61481a..4f7efec 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -20,6 +20,7 @@ has_extension() { install_xhprof() { local version="${1:-stable}" + has_extension "xhprof" && return 0 pecl install xhprof-$version } From b206401e389af5876a6a1f293062e1255d153e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 01:13:04 +0300 Subject: [PATCH 14/65] Install mongodb via shivammathur --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 671ff82..69c67de 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: xdebug, xhprof + extensions: xdebug, xhprof, mongodb - name: Validate composer.json and composer.lock run: composer validate From e9bae359ab7791e9ebc787dcd82e5128e08ad5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 01:18:51 +0300 Subject: [PATCH 15/65] Use has_extension check for mongodb --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index 4f7efec..c13aad0 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -29,7 +29,7 @@ install_mongo() { } install_mongodb() { - php -m | grep -q mongodb || pecl install -f mongodb + has_extension "mongodb" || pecl install -f mongodb composer require --dev alcaeus/mongo-php-adapter } From 7e32862f1e4b5b0bd3ab34e9b7134fd8acf96532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 01:19:32 +0300 Subject: [PATCH 16/65] Try tideways_xhprof extension --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 69c67de..f3e91b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: xdebug, xhprof, mongodb + extensions: xdebug, xhprof, mongodb, tideways_xhprof - name: Validate composer.json and composer.lock run: composer validate From 93830ecb6095c15c9ae078372ff59dc2c42a16b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 01:24:35 +0300 Subject: [PATCH 17/65] Show php config paths --- install-extensions.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install-extensions.sh b/install-extensions.sh index c13aad0..e44a6bd 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -53,6 +53,9 @@ install_tideways_xhprof() { php -m | grep -F "$extension" } +# Show php config paths +php --ini + case "$(uname -s):$PHP_VERSION" in *:5.*) install_xhprof 0.9.4 From 94f3e94bf85e21955e9aeded690bfcbc3f33cb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:01:25 +0300 Subject: [PATCH 18/65] Use path specific to GHA --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index e44a6bd..14754eb 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -47,7 +47,7 @@ install_tideways_xhprof() { zts=$(php --version | grep -q ZTS && echo -zts || :) library="$PWD/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" - config="$HOME/.phpenv/versions/$PHP_VERSION/etc/conf.d/tideways_xhprof.ini" + config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" test -f "$library" || die "Extension not available: $library" echo "extension=$library" > "$config" php -m | grep -F "$extension" From 75a838c6ac8590b5b686f9ed287b109bbe4447e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:26:37 +0300 Subject: [PATCH 19/65] Run phpunit --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f3e91b1..bd19f49 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,7 +43,7 @@ jobs: run: sudo ./install-extensions.sh - name: Run PHPUnit tests - run: composer test + run: phpunit env: XHGUI_SAVE_HANDLER: "pdo" From 79452d86118c401e2f4d4ae7abf6b3aaa46d5b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:33:34 +0300 Subject: [PATCH 20/65] Fix test name --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bd19f49..0c414dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ on: - push jobs: - mysql: + test: name: PHP ${{ matrix.php }} runs-on: ubuntu-20.04 strategy: From 03840e68fee8c7918a71cb7eca514c200ad09d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:34:31 +0300 Subject: [PATCH 21/65] Install phpunit --- .github/workflows/tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0c414dd..50d6cde 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,6 +12,8 @@ jobs: matrix: php: - "7.4" + env: + PHPUNIT_VERSION: "7.5" steps: - name: Checkout Code @@ -37,7 +39,10 @@ jobs: - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest + run: | + composer install --prefer-dist --no-progress --no-suggest + composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION + - name: Install extensions run: sudo ./install-extensions.sh From 53efaec3a7bd8ae1cb3078dfb29afaec6f5e039d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:37:07 +0300 Subject: [PATCH 22/65] Add "test" script to composer --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 5ec317c..4b01317 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,9 @@ "config": { "sort-packages": true }, + "scripts": { + "test": "phpunit" + }, "autoload": { "psr-4": { "Xhgui\\Profiler\\": "src/" From 647958f282611b628330081da01e344f6c1ebdf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:37:23 +0300 Subject: [PATCH 23/65] fixup! Add "test" script to composer --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 4b01317..a6ccdde 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ "config": { "sort-packages": true }, - "scripts": { - "test": "phpunit" - }, + "scripts": { + "test": "phpunit" + }, "autoload": { "psr-4": { "Xhgui\\Profiler\\": "src/" From 603828a36f00015b0c7bf0369f285c34a3c6af85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:37:45 +0300 Subject: [PATCH 24/65] Restore composer test --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50d6cde..94cc496 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,12 +43,11 @@ jobs: composer install --prefer-dist --no-progress --no-suggest composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - - name: Install extensions run: sudo ./install-extensions.sh - name: Run PHPUnit tests - run: phpunit + run: composer test env: XHGUI_SAVE_HANDLER: "pdo" From b47256f8f238eed611e955975777f1dc8f1487e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:38:44 +0300 Subject: [PATCH 25/65] Skip deprecated --no-suggest --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 94cc496..d7b0c82 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' run: | - composer install --prefer-dist --no-progress --no-suggest + composer install --prefer-dist --no-progress composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - name: Install extensions From 1608d26c01858d9ac52b225e558102a69024a5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:39:30 +0300 Subject: [PATCH 26/65] No composer.lock, so hash based on composer.json --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d7b0c82..1f16c5a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: uses: actions/cache@v2 with: path: vendor - key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}- From 206a3dc43e8924c9e986a57b275c3acebc3637ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:40:29 +0300 Subject: [PATCH 27/65] Rename to mongodb --- .github/workflows/{tests.yml => tests-mongodb.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{tests.yml => tests-mongodb.yml} (99%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests-mongodb.yml similarity index 99% rename from .github/workflows/tests.yml rename to .github/workflows/tests-mongodb.yml index 1f16c5a..9638f8c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests-mongodb.yml @@ -5,7 +5,7 @@ on: - push jobs: - test: + mongodb: name: PHP ${{ matrix.php }} runs-on: ubuntu-20.04 strategy: From ef818d7aa01a409db8aaddaa50765c1f31c87246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:42:25 +0300 Subject: [PATCH 28/65] Add mongodb service --- .github/workflows/tests-mongodb.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 9638f8c..6a508db 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -15,6 +15,12 @@ jobs: env: PHPUNIT_VERSION: "7.5" + services: + mongodb: + image: percona/percona-server-mongodb:3.6 + ports: + - 27017:27017 + steps: - name: Checkout Code uses: actions/checkout@v2 From 4e3ca4343088e9fe6d0d5df73fdfa516ffbe7f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:45:14 +0300 Subject: [PATCH 29/65] Pass tests to enable cache --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 6a508db..adc2d11 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -53,7 +53,7 @@ jobs: run: sudo ./install-extensions.sh - name: Run PHPUnit tests - run: composer test + run: echo composer test env: XHGUI_SAVE_HANDLER: "pdo" From 647fbcb212a982102a6504758dfc380115eaeaba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:46:52 +0300 Subject: [PATCH 30/65] Revert "Pass tests to enable cache" This reverts commit 4e3ca4343088e9fe6d0d5df73fdfa516ffbe7f50. --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index adc2d11..6a508db 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -53,7 +53,7 @@ jobs: run: sudo ./install-extensions.sh - name: Run PHPUnit tests - run: echo composer test + run: composer test env: XHGUI_SAVE_HANDLER: "pdo" From fc3768b94ecc404f690672b797f568b4d7ba043d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:47:55 +0300 Subject: [PATCH 31/65] Include phpunit version to cache-key --- .github/workflows/tests-mongodb.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 6a508db..499bffe 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -39,9 +39,9 @@ jobs: uses: actions/cache@v2 with: path: vendor - key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-php-${{ matrix.php }}-{{ env.PHPUNIT_VERSION }}-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}- + ${{ runner.os }}-php-${{ matrix.php }}-{{ env.PHPUNIT_VERSION }}- - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' From 291b68a7a5f0b37062c63e241b1dabfeda031a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:50:28 +0300 Subject: [PATCH 32/65] Unpack tideways_xhprof to vendor for cache --- install-extensions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index 14754eb..3445138 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -43,10 +43,10 @@ install_tideways_xhprof() { local zts curl -fL -o "$tar" "$url" - tar -xvf "$tar" + tar -xvf "$tar" -C vendor/tideways_xhprof zts=$(php --version | grep -q ZTS && echo -zts || :) - library="$PWD/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" + library="$PWD/vendor/tideways_xhprof/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" test -f "$library" || die "Extension not available: $library" echo "extension=$library" > "$config" From 01a5379d3729ff80eb17722405546a6d64ff549f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 02:51:57 +0300 Subject: [PATCH 33/65] Fix expected frame count --- tests/TidewaysXHProfTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/TidewaysXHProfTest.php b/tests/TidewaysXHProfTest.php index 5bc1816..28261fd 100644 --- a/tests/TidewaysXHProfTest.php +++ b/tests/TidewaysXHProfTest.php @@ -18,7 +18,7 @@ public function setUp() public function testDefaults() { $data = $this->runProfiler(); - $this->assertCount(3, $data); + $this->assertCount(2, $data); } public function testCpuFlags() @@ -27,7 +27,7 @@ public function testCpuFlags() ProfilingFlags::CPU, ); $data = $this->runProfiler($flags); - $this->assertCount(3, $data); + $this->assertCount(2, $data); $main = $data['main()']; $this->assertArrayHasKey('cpu', $main); } @@ -39,7 +39,7 @@ public function testCpuMemoryFlags() ProfilingFlags::MEMORY, ); $data = $this->runProfiler($flags); - $this->assertCount(3, $data); + $this->assertCount(2, $data); $main = $data['main()']; $this->assertArrayHasKey('cpu', $main); From ed658bcc4a1fc474b1fdaa8c558e31a22c9844cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 07:37:39 +0300 Subject: [PATCH 34/65] Optimize for cache --- install-extensions.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index 3445138..e0e682c 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -39,16 +39,20 @@ install_tideways_xhprof() { local url="https://github.com/tideways/php-xhprof-extension/releases/download/v$version/tideways-xhprof-$version-$arch.tar.gz" local extension="tideways_xhprof" local tar="$extension.tgz" - local config library + local workdir="vendor/tideways_xhprof" + local library="$PWD/$workdir/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" + local config local zts - curl -fL -o "$tar" "$url" - tar -xvf "$tar" -C vendor/tideways_xhprof + if [ ! -f "$library" ]; then + curl -fL -o "$tar" "$url" + mkdir -p "$workdir" + tar -xvf "$tar" -C "$workdir" + fi zts=$(php --version | grep -q ZTS && echo -zts || :) - library="$PWD/vendor/tideways_xhprof/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" - config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" test -f "$library" || die "Extension not available: $library" + config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" echo "extension=$library" > "$config" php -m | grep -F "$extension" } From 7814a501e5b6fa8192bbb32a6928baac9f48cba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 07:38:10 +0300 Subject: [PATCH 35/65] Update to 5.0.4 --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index e0e682c..7601944 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -4,7 +4,7 @@ set -xeu : "${TRAVIS_PHP_VERSION=7.4}" : "${TIDEWAYS_VERSION=4.1.4}" -: "${TIDEWAYS_XHPROF_VERSION=5.0.2}" +: "${TIDEWAYS_XHPROF_VERSION=5.0.4}" : "${PHP_VERSION=${TRAVIS_PHP_VERSION}}" die() { From 2ca796e2a67a9641a93b66cdc0e6130ec57b4393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 07:41:16 +0300 Subject: [PATCH 36/65] fixup! Update to 5.0.4 --- install-extensions.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index 7601944..d852aba 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -40,17 +40,19 @@ install_tideways_xhprof() { local extension="tideways_xhprof" local tar="$extension.tgz" local workdir="vendor/tideways_xhprof" - local library="$PWD/$workdir/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" + local library local config local zts + zts=$(php --version | grep -q ZTS && echo -zts || :) + library="$PWD/$workdir/tideways_xhprof-$version/tideways_xhprof-$PHP_VERSION$zts.so" + if [ ! -f "$library" ]; then curl -fL -o "$tar" "$url" mkdir -p "$workdir" tar -xvf "$tar" -C "$workdir" fi - zts=$(php --version | grep -q ZTS && echo -zts || :) test -f "$library" || die "Extension not available: $library" config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" echo "extension=$library" > "$config" From 2c3ccf1b264aff1af2af406dfe05041ef781f2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 07:45:04 +0300 Subject: [PATCH 37/65] fixup! Update to 5.0.4 --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index d852aba..c76f862 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -67,7 +67,7 @@ case "$(uname -s):$PHP_VERSION" in install_xhprof 0.9.4 install_mongo ;; -Linux:7.*) +Linux:7.*|Linux:8.*) install_xhprof install_mongodb install_tideways_xhprof From c321ffb0c589aa2ef02ec8b01d8646373763d078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 07:45:53 +0300 Subject: [PATCH 38/65] Allow php 8.x --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index c76f862..ed8a25b 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -72,7 +72,7 @@ Linux:7.*|Linux:8.*) install_mongodb install_tideways_xhprof ;; -*:7.*) +*:7.*|*:8.*) install_xhprof install_mongodb ;; From 3c8bdf0fea44295be9aa093cf1b102c247c737b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 07:47:00 +0300 Subject: [PATCH 39/65] Enable more 7.x versions --- .github/workflows/tests-mongodb.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 499bffe..44214bc 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -11,6 +11,9 @@ jobs: strategy: matrix: php: + - "7.1" + - "7.2" + - "7.3" - "7.4" env: PHPUNIT_VERSION: "7.5" From 21b1f2f2c67524f1e8e9cff7e8e8c6939a482ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 09:01:13 +0300 Subject: [PATCH 40/65] Fix cache key --- .github/workflows/tests-mongodb.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 44214bc..554261e 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -42,9 +42,9 @@ jobs: uses: actions/cache@v2 with: path: vendor - key: ${{ runner.os }}-php-${{ matrix.php }}-{{ env.PHPUNIT_VERSION }}-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ env.PHPUNIT_VERSION }}-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-{{ env.PHPUNIT_VERSION }}- + ${{ runner.os }}-php-${{ matrix.php }}-${{ env.PHPUNIT_VERSION }}- - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' From 635a7007d548068709db8524abf579932bbf7bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 09:02:42 +0300 Subject: [PATCH 41/65] Use shared CACHE_KEY for cache key --- .github/workflows/tests-mongodb.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 554261e..74122a4 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -40,11 +40,13 @@ jobs: - name: Cache Composer packages id: composer-cache uses: actions/cache@v2 + env: + CACHE_KEY: "${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ env.PHPUNIT_VERSION }}" with: path: vendor - key: ${{ runner.os }}-php-${{ matrix.php }}-${{ env.PHPUNIT_VERSION }}-${{ hashFiles('**/composer.json') }} + key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-${{ env.PHPUNIT_VERSION }}- + ${{ env.CACHE_KEY }}- - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' From 5fdae61ad908847a4aa2bc7025adc11dde2f75d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 09:05:17 +0300 Subject: [PATCH 42/65] Add PHP_VERSION environ --- .github/workflows/tests-mongodb.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 74122a4..24c508b 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -17,6 +17,7 @@ jobs: - "7.4" env: PHPUNIT_VERSION: "7.5" + PHP_VERSION: "${{ matrix.php }}" services: mongodb: From ffb9fee1fe85fb7281be1763d454b2dc254add8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 09:15:27 +0300 Subject: [PATCH 43/65] Debug env --- .github/workflows/tests-mongodb.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 24c508b..bda1993 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -56,7 +56,12 @@ jobs: composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - name: Install extensions - run: sudo ./install-extensions.sh + env: + CACHE_KEY: "${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ env.PHPUNIT_VERSION }}" + PHP_VERSION2: "${{ matrix.php }}" + run: | + env + sudo ./install-extensions.sh - name: Run PHPUnit tests run: composer test From bcb826f6fb9d1a00d3faffbbee57b5fcbae08053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 10:14:01 +0300 Subject: [PATCH 44/65] Cleanup TRAVIS_PHP_VERSION --- install-extensions.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index ed8a25b..a77ec4d 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -2,10 +2,9 @@ set -xeu -: "${TRAVIS_PHP_VERSION=7.4}" : "${TIDEWAYS_VERSION=4.1.4}" : "${TIDEWAYS_XHPROF_VERSION=5.0.4}" -: "${PHP_VERSION=${TRAVIS_PHP_VERSION}}" +: "${PHP_VERSION=7.4}" die() { echo >&2 "ERROR: $*" From 472b8add51a916b81c2423791acc762e02298657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 10:15:44 +0300 Subject: [PATCH 45/65] Remove env debug --- .github/workflows/tests-mongodb.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index bda1993..d708d64 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -56,9 +56,6 @@ jobs: composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - name: Install extensions - env: - CACHE_KEY: "${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ env.PHPUNIT_VERSION }}" - PHP_VERSION2: "${{ matrix.php }}" run: | env sudo ./install-extensions.sh From c425976bde2cf513e7247eb32bd0cda7374375f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 10:16:39 +0300 Subject: [PATCH 46/65] Change syntax --- install-extensions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index a77ec4d..9ebde2c 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -2,9 +2,9 @@ set -xeu -: "${TIDEWAYS_VERSION=4.1.4}" -: "${TIDEWAYS_XHPROF_VERSION=5.0.4}" -: "${PHP_VERSION=7.4}" +: "${TIDEWAYS_VERSION:=4.1.4}" +: "${TIDEWAYS_XHPROF_VERSION:=5.0.4}" +: "${PHP_VERSION:=7.4}" die() { echo >&2 "ERROR: $*" From f1ce96d39eaaf347d58f5ed2fe601fb7932eca64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 10:25:46 +0300 Subject: [PATCH 47/65] Switch to bash --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index 9ebde2c..3e671e1 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bin/env bash set -xeu From 9eb3a3b6f65ca94ff84875ff1a426d098e43db57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 10:54:13 +0300 Subject: [PATCH 48/65] fixup! Switch to bash --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index 3e671e1..e0929f7 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -1,4 +1,4 @@ -#!/bin/bin/env bash +#!/usr/bin/env bash set -xeu From 4dfc2ac19c945e56de379395ccebc7cddaa8378b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 11:07:18 +0300 Subject: [PATCH 49/65] Debug PHP_VERSION --- install-extensions.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install-extensions.sh b/install-extensions.sh index e0929f7..dcb99bc 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -2,6 +2,8 @@ set -xeu +echo "PHP_VERSION=$PHP_VERSION" + : "${TIDEWAYS_VERSION:=4.1.4}" : "${TIDEWAYS_XHPROF_VERSION:=5.0.4}" : "${PHP_VERSION:=7.4}" From d8d4085d60c735adbe54f20b79b1f9f25b495a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 13:24:32 +0300 Subject: [PATCH 50/65] Remove sudo --- .github/workflows/tests-mongodb.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index d708d64..e944504 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -56,9 +56,7 @@ jobs: composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - name: Install extensions - run: | - env - sudo ./install-extensions.sh + run: ./install-extensions.sh - name: Run PHPUnit tests run: composer test From e65ba7d1fc2cd8032d2f4033b7db227dc13c287c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 13:27:02 +0300 Subject: [PATCH 51/65] Use has_extension --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index dcb99bc..f3b7480 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -57,7 +57,7 @@ install_tideways_xhprof() { test -f "$library" || die "Extension not available: $library" config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" echo "extension=$library" > "$config" - php -m | grep -F "$extension" + has_extension "$extension" } # Show php config paths From cc3252ed8c6c0eb86d8eb44eed8846ea22a638a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 13:34:29 +0300 Subject: [PATCH 52/65] Use sudo for specific command only --- install-extensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-extensions.sh b/install-extensions.sh index f3b7480..fd5ff84 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -56,7 +56,7 @@ install_tideways_xhprof() { test -f "$library" || die "Extension not available: $library" config="/etc/php/$PHP_VERSION/cli/conf.d/10-tideways_xhprof.ini" - echo "extension=$library" > "$config" + echo "extension=$library" | sudo tee "$config" has_extension "$extension" } From 6d186e29be9ee8497a7a4cd87e890665777fd98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 13:37:10 +0300 Subject: [PATCH 53/65] Use new cache key --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index e944504..e74640e 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -42,7 +42,7 @@ jobs: id: composer-cache uses: actions/cache@v2 env: - CACHE_KEY: "${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ env.PHPUNIT_VERSION }}" + CACHE_KEY: "${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ env.PHPUNIT_VERSION }}-v2" with: path: vendor key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/composer.json') }} From ff63c089dc1b01f05d7cbac5e17ef3eff59102b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 13:37:40 +0300 Subject: [PATCH 54/65] Use PHP_VERSION for cache key --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index e74640e..158c638 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -42,7 +42,7 @@ jobs: id: composer-cache uses: actions/cache@v2 env: - CACHE_KEY: "${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ env.PHPUNIT_VERSION }}-v2" + CACHE_KEY: "${{ runner.os }}-php-${{ env.PHP_VERSION }}-phpunit-${{ env.PHPUNIT_VERSION }}-v2" with: path: vendor key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/composer.json') }} From dfa24108b1307829175b15c1363ecd4f1733ace8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 13:50:58 +0300 Subject: [PATCH 55/65] Disable fail-fast --- .github/workflows/tests-mongodb.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 158c638..b26a57f 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -9,6 +9,7 @@ jobs: name: PHP ${{ matrix.php }} runs-on: ubuntu-20.04 strategy: + fail-fast: false matrix: php: - "7.1" From 0a17cd4b36a5d96bb47c6d4521e19f082fe9b141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 16:26:12 +0300 Subject: [PATCH 56/65] Test array key existence rather count --- tests/TidewaysXHProfTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/TidewaysXHProfTest.php b/tests/TidewaysXHProfTest.php index 28261fd..9249675 100644 --- a/tests/TidewaysXHProfTest.php +++ b/tests/TidewaysXHProfTest.php @@ -18,7 +18,7 @@ public function setUp() public function testDefaults() { $data = $this->runProfiler(); - $this->assertCount(2, $data); + $this->assertArrayHasKey('main()', $data); } public function testCpuFlags() @@ -27,7 +27,7 @@ public function testCpuFlags() ProfilingFlags::CPU, ); $data = $this->runProfiler($flags); - $this->assertCount(2, $data); + $this->assertArrayHasKey('main()', $data); $main = $data['main()']; $this->assertArrayHasKey('cpu', $main); } @@ -39,7 +39,7 @@ public function testCpuMemoryFlags() ProfilingFlags::MEMORY, ); $data = $this->runProfiler($flags); - $this->assertCount(2, $data); + $this->assertArrayHasKey('main()', $data); $main = $data['main()']; $this->assertArrayHasKey('cpu', $main); @@ -52,6 +52,6 @@ public function testNoFlags() ProfilingFlags::NO_BUILTINS, ); $data = $this->runProfiler($flags); - $this->assertCount(2, $data); + $this->assertArrayHasKey('main()', $data); } } From bd4185531ef538b631adceb37f979945c7cb4e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 16:57:25 +0300 Subject: [PATCH 57/65] Install extensions with composer --- .github/workflows/tests-mongodb.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index b26a57f..fcb335b 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -55,9 +55,7 @@ jobs: run: | composer install --prefer-dist --no-progress composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - - - name: Install extensions - run: ./install-extensions.sh + ./install-extensions.sh - name: Run PHPUnit tests run: composer test From 8e655dd6d31817d834e27131f600bb0db58f09ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 16:57:32 +0300 Subject: [PATCH 58/65] Bump cache key --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index fcb335b..dc5d593 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -43,7 +43,7 @@ jobs: id: composer-cache uses: actions/cache@v2 env: - CACHE_KEY: "${{ runner.os }}-php-${{ env.PHP_VERSION }}-phpunit-${{ env.PHPUNIT_VERSION }}-v2" + CACHE_KEY: "${{ runner.os }}-php-${{ env.PHP_VERSION }}-phpunit-${{ env.PHPUNIT_VERSION }}-v3" with: path: vendor key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/composer.json') }} From bc4d77dab20405b20ecd675789f8f474b1745993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 16:57:57 +0300 Subject: [PATCH 59/65] Remove env for tests --- .github/workflows/tests-mongodb.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index dc5d593..908b150 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -59,7 +59,5 @@ jobs: - name: Run PHPUnit tests run: composer test - env: - XHGUI_SAVE_HANDLER: "pdo" # vim:ft=yaml:et:ts=2:sw=2 From adf0e14c103b218908ee940e6e5ff17cb914d7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 16:58:52 +0300 Subject: [PATCH 60/65] Fix test name --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 908b150..5d9e109 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -1,4 +1,4 @@ -name: "Tests" +name: "Tests: MongoDB" on: - pull_request From 3db0d9c5a6190c9f0926ba82aa8f833837467aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 17:00:51 +0300 Subject: [PATCH 61/65] Remove PHP_VERSION debug --- install-extensions.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install-extensions.sh b/install-extensions.sh index fd5ff84..e5c737a 100755 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash -set -xeu - -echo "PHP_VERSION=$PHP_VERSION" +set -eu +set -x : "${TIDEWAYS_VERSION:=4.1.4}" : "${TIDEWAYS_XHPROF_VERSION:=5.0.4}" From 50ee687ac9cc4ff72f7ca854740a63bc4238c72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 17:02:29 +0300 Subject: [PATCH 62/65] Revert "Install extensions with composer" This reverts commit bd4185531ef538b631adceb37f979945c7cb4e4a. --- .github/workflows/tests-mongodb.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index 5d9e109..d12425a 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -55,7 +55,9 @@ jobs: run: | composer install --prefer-dist --no-progress composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION - ./install-extensions.sh + + - name: Install extensions + run: ./install-extensions.sh - name: Run PHPUnit tests run: composer test From 9bd39111f75f6629ca3d883d2ef4c0e456441d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 17:03:16 +0300 Subject: [PATCH 63/65] Install twice --- .github/workflows/tests-mongodb.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index d12425a..ca130b8 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -55,6 +55,7 @@ jobs: run: | composer install --prefer-dist --no-progress composer require --dev phpunit/phpunit:^$PHPUNIT_VERSION + ./install-extensions.sh - name: Install extensions run: ./install-extensions.sh From c2172e69201a0efc36abe3057d2393bb9e6620af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 17:03:56 +0300 Subject: [PATCH 64/65] Bump cache --- .github/workflows/tests-mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index ca130b8..e1ab855 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -43,7 +43,7 @@ jobs: id: composer-cache uses: actions/cache@v2 env: - CACHE_KEY: "${{ runner.os }}-php-${{ env.PHP_VERSION }}-phpunit-${{ env.PHPUNIT_VERSION }}-v3" + CACHE_KEY: "${{ runner.os }}-php-${{ env.PHP_VERSION }}-phpunit-${{ env.PHPUNIT_VERSION }}-v4" with: path: vendor key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/composer.json') }} From a14368a7b0493323f47e64f1a23728a661b1370e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 1 Jun 2022 17:07:33 +0300 Subject: [PATCH 65/65] Try php 8.0 --- .github/workflows/tests-mongodb.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-mongodb.yml b/.github/workflows/tests-mongodb.yml index e1ab855..ccf161e 100644 --- a/.github/workflows/tests-mongodb.yml +++ b/.github/workflows/tests-mongodb.yml @@ -16,6 +16,7 @@ jobs: - "7.2" - "7.3" - "7.4" + - "8.0" env: PHPUNIT_VERSION: "7.5" PHP_VERSION: "${{ matrix.php }}"